Make WordPress Core

Changeset 20730


Ignore:
Timestamp:
05/06/2012 11:06:47 PM (14 years ago)
Author:
koopersmith
Message:

Add 'Install now', 'Preview', and 'Details' links to theme install list items. fixes #20403.

Location:
trunk/wp-admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/css/wp-admin.dev.css

    r20716 r20730  
    53745374}
    53755375
    5376 .install-theme-info .theme-version {
     5376.theme-details .theme-version {
    53775377        margin: 15px 0;
    5378         float: right;
    5379 }
    5380 
    5381 .install-theme-info .theme-rating {
     5378        float: left;
     5379}
     5380
     5381.theme-details .theme-rating {
    53825382        margin: 14px 0;
    53835383        width: 100px;
    53845384        height: 17px;
    5385         float: left;
     5385        float: right;
    53865386        background: url('../images/stars.png?ver=20120307') repeat-x bottom left;
    53875387}
    53885388
    5389 .install-theme-info .theme-rating div {
     5389.theme-details .theme-rating div {
    53905390        background: url('../images/stars.png?ver=20120307') repeat-x top left;
    53915391        height: 17px;
    … …  
    53935393}
    53945394
    5395 .install-theme-info .theme-description {
    5396         margin-top: 34px;
    5397         padding-top: 1em;
     5395.theme-details .theme-description {
     5396        float: left;
    53985397        color: #777;
    53995398        line-height: 20px;
  • trunk/wp-admin/includes/class-wp-theme-install-list-table.php

    r20639 r20730  
    193193                ) );
    194194
     195                $actions = array();
     196
     197                $install_url = add_query_arg( array(
     198                        'action' => 'install-theme',
     199                        'theme'  => $theme->slug,
     200                ), self_admin_url( 'update.php' ) );
     201                $actions[] = '<a class="install-now" href="' . wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) . '" title="' . esc_attr( sprintf( __( 'Install %s' ), $name ) ) . '">' . __( 'Install Now' ) . '</a>';
     202
     203                $actions[] = '<a class="install-theme-preview" href="#" title="' . esc_attr( sprintf( __( 'Preview %s' ), $name ) ) . '">' . __( 'Preview' ) . '</a>';
     204
     205                $actions = apply_filters( 'theme_install_actions', $actions, $theme );
     206
    195207                ?>
    196                 <a class="screenshot" href="<?php echo esc_url( $preview_url ); ?>" title="<?php echo esc_attr( $preview_title ); ?>">
     208                <a class="screenshot install-theme-preview" href="<?php echo esc_url( $preview_url ); ?>" title="<?php echo esc_attr( $preview_title ); ?>">
    197209                        <img src='<?php echo esc_url( $theme->screenshot_url ); ?>' width='150' />
    198210                </a>
    … …  
    200212                <h3><?php echo $name; ?></h3>
    201213                <div class="theme-author"><?php printf( __( 'By %s' ), $author ); ?></div>
     214
     215                <div class="action-links">
     216                        <ul>
     217                                <?php foreach ( $actions as $action ): ?>
     218                                        <li><?php echo $action; ?></li>
     219                                <?php endforeach; ?>
     220                                <li class="hide-if-no-js"><a href="#" class="theme-detail" tabindex='4'><?php _e('Details') ?></a></li>
     221                        </ul>
     222                </div>
    202223
    203224                <?php
    … …  
    278299                                <img class="theme-screenshot" src="<?php echo esc_url( $theme->screenshot_url ); ?>" />
    279300                        <?php endif; ?>
    280                         <div class="theme-rating" title="<?php echo esc_attr( $num_ratings ); ?>">
    281                                 <div style="width:<?php echo esc_attr( intval( $theme->rating ) . 'px' ); ?>;"></div>
    282                         </div>
    283                         <div class="theme-version">
    284                                 <strong><?php _e('Version:') ?> </strong>
    285                                 <?php echo wp_kses( $theme->version, $themes_allowedtags ); ?>
    286                         </div>
    287                         <div class="theme-description">
    288                                 <?php echo wp_kses( $theme->description, $themes_allowedtags ); ?>
     301                        <div class="theme-details">
     302                                <div class="theme-rating" title="<?php echo esc_attr( $num_ratings ); ?>">
     303                                        <div style="width:<?php echo esc_attr( intval( $theme->rating ) . 'px' ); ?>;"></div>
     304                                </div>
     305                                <div class="theme-version">
     306                                        <strong><?php _e('Version:') ?> </strong>
     307                                        <?php echo wp_kses( $theme->version, $themes_allowedtags ); ?>
     308                                </div>
     309                                <div class="theme-description">
     310                                        <?php echo wp_kses( $theme->description, $themes_allowedtags ); ?>
     311                                </div>
    289312                        </div>
    290313                        <input class="theme-preview-url" type="hidden" value="<?php echo esc_url( $theme->preview_url ); ?>" />
  • trunk/wp-admin/js/theme.dev.js

    r20455 r20730  
    66jQuery( function($) {
    77        $('#availablethemes').on( 'click', '.theme-detail', function (event) {
    8                 $(this).parents('.action-links').siblings('.themedetaildiv').toggle();
     8                var theme   = $(this).closest('.available-theme'),
     9                        details = theme.find('.themedetaildiv');
     10
     11                if ( ! details.length ) {
     12                        details = theme.find('.install-theme-info .theme-details');
     13                        details = details.clone().addClass('themedetaildiv').appendTo( theme ).hide();
     14                }
     15
     16                details.toggle();
    917                event.preventDefault();
    1018        });
    … …  
    3543        });
    3644
    37         $('#availablethemes').on( 'click', '.installable-theme', function( event ) {
     45        $('#availablethemes').on( 'click', '.install-theme-preview', function( event ) {
    3846                var src;
    3947
    40                 info.html( $(this).find('.install-theme-info').html() );
     48                info.html( $(this).closest('.installable-theme').find('.install-theme-info').html() );
    4149                src = info.find( '.theme-preview-url' ).val();
    4250                panel.html( '<iframe src="' + src + '" />');
Note: See TracChangeset for help on using the changeset viewer.