From b379473aa48ced14f2c0679c54d354123555b427 Mon Sep 17 00:00:00 2001 From: Daryl Koopersmith Date: Sun, 6 May 2012 23:06:47 +0000 Subject: [PATCH] Add 'Install now', 'Preview', and 'Details' links to theme install list items. fixes #20403. git-svn-id: https://develop.svn.wordpress.org/trunk@20730 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/css/wp-admin.dev.css | 15 +++---- .../class-wp-theme-install-list-table.php | 43 ++++++++++++++----- wp-admin/js/theme.dev.js | 14 ++++-- 3 files changed, 51 insertions(+), 21 deletions(-) diff --git a/wp-admin/css/wp-admin.dev.css b/wp-admin/css/wp-admin.dev.css index b0828abf07..94a307b293 100644 --- a/wp-admin/css/wp-admin.dev.css +++ b/wp-admin/css/wp-admin.dev.css @@ -5373,28 +5373,27 @@ body.full-overlay-active { border: 1px solid #ccc; } -.install-theme-info .theme-version { +.theme-details .theme-version { margin: 15px 0; - float: right; + float: left; } -.install-theme-info .theme-rating { +.theme-details .theme-rating { margin: 14px 0; width: 100px; height: 17px; - float: left; + float: right; background: url('../images/stars.png?ver=20120307') repeat-x bottom left; } -.install-theme-info .theme-rating div { +.theme-details .theme-rating div { background: url('../images/stars.png?ver=20120307') repeat-x top left; height: 17px; float: left; } -.install-theme-info .theme-description { - margin-top: 34px; - padding-top: 1em; +.theme-details .theme-description { + float: left; color: #777; line-height: 20px; } diff --git a/wp-admin/includes/class-wp-theme-install-list-table.php b/wp-admin/includes/class-wp-theme-install-list-table.php index 4231cd224c..842a8ffc6d 100644 --- a/wp-admin/includes/class-wp-theme-install-list-table.php +++ b/wp-admin/includes/class-wp-theme-install-list-table.php @@ -192,14 +192,35 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table { 'theme' => $theme->slug, ) ); + $actions = array(); + + $install_url = add_query_arg( array( + 'action' => 'install-theme', + 'theme' => $theme->slug, + ), self_admin_url( 'update.php' ) ); + $actions[] = '' . __( 'Install Now' ) . ''; + + $actions[] = '' . __( 'Preview' ) . ''; + + $actions = apply_filters( 'theme_install_actions', $actions, $theme ); + ?> - +

+ + install_theme_info( $theme ); } @@ -277,15 +298,17 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table { screenshot_url ) ): ?> -
-
-
-
- - version, $themes_allowedtags ); ?> -
-
- description, $themes_allowedtags ); ?> +
+
+
+
+
+ + version, $themes_allowedtags ); ?> +
+
+ description, $themes_allowedtags ); ?> +
diff --git a/wp-admin/js/theme.dev.js b/wp-admin/js/theme.dev.js index 98571b6c0f..2110feb81d 100644 --- a/wp-admin/js/theme.dev.js +++ b/wp-admin/js/theme.dev.js @@ -5,7 +5,15 @@ */ jQuery( function($) { $('#availablethemes').on( 'click', '.theme-detail', function (event) { - $(this).parents('.action-links').siblings('.themedetaildiv').toggle(); + var theme = $(this).closest('.available-theme'), + details = theme.find('.themedetaildiv'); + + if ( ! details.length ) { + details = theme.find('.install-theme-info .theme-details'); + details = details.clone().addClass('themedetaildiv').appendTo( theme ).hide(); + } + + details.toggle(); event.preventDefault(); }); }); @@ -34,10 +42,10 @@ jQuery( function($) { event.preventDefault(); }); - $('#availablethemes').on( 'click', '.installable-theme', function( event ) { + $('#availablethemes').on( 'click', '.install-theme-preview', function( event ) { var src; - info.html( $(this).find('.install-theme-info').html() ); + info.html( $(this).closest('.installable-theme').find('.install-theme-info').html() ); src = info.find( '.theme-preview-url' ).val(); panel.html( '