From 3d6d32d9e63cb1a80d724e4a5b69a226ca81b281 Mon Sep 17 00:00:00 2001 From: "Dominik Schilling (ocean90)" Date: Thu, 16 Oct 2014 19:45:26 +0000 Subject: [PATCH] Themes: Make it possible to delete broken themes. props ideag, obenland. fixes #28165. git-svn-id: https://develop.svn.wordpress.org/trunk@29924 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/css/themes.css | 16 +++++++++++++--- src/wp-admin/js/theme.js | 4 ++++ src/wp-admin/themes.php | 33 +++++++++++++++++++++++++-------- 3 files changed, 42 insertions(+), 11 deletions(-) diff --git a/src/wp-admin/css/themes.css b/src/wp-admin/css/themes.css index 6ff0f9ffe0..fb976b899b 100644 --- a/src/wp-admin/css/themes.css +++ b/src/wp-admin/css/themes.css @@ -580,11 +580,9 @@ body.folded .theme-overlay .theme-wrap { margin-bottom: 5px; } +.broken-themes a.delete-theme, .theme-overlay .theme-actions .delete-theme { color: #a00; - position: absolute; - right: 10px; - bottom: 5px; text-decoration: none; border-color: transparent; -webkit-box-shadow: none; @@ -592,6 +590,14 @@ body.folded .theme-overlay .theme-wrap { background: transparent; } +.theme-overlay .theme-actions .delete-theme { + position: absolute; + right: 10px; + bottom: 5px; +} + +.broken-themes a.delete-theme:hover, +.broken-themes a.delete-theme:focus, .theme-overlay .theme-actions .delete-theme:hover, .theme-overlay .theme-actions .delete-theme:focus { background: #d54e21; @@ -1729,4 +1735,8 @@ body.full-overlay-active { .available-theme .action-links .delete-theme a { padding: 0; } + + .broken-themes table { + width: 100%; + } } diff --git a/src/wp-admin/js/theme.js b/src/wp-admin/js/theme.js index 7f688a4ac8..a4e70e036a 100644 --- a/src/wp-admin/js/theme.js +++ b/src/wp-admin/js/theme.js @@ -1659,6 +1659,10 @@ $( document ).ready(function() { } else { themes.Run.init(); } + + $( '.broken-themes .delete-theme' ).on( 'click', function() { + return confirm( _wpThemeSettings.settings.confirmDelete ); + }); }); })( jQuery ); diff --git a/src/wp-admin/themes.php b/src/wp-admin/themes.php index 9457fe3693..6243ace0a1 100644 --- a/src/wp-admin/themes.php +++ b/src/wp-admin/themes.php @@ -246,20 +246,37 @@ if ( ! is_multisite() && current_user_can('edit_themes') && $broken_themes = wp_

+ + + + + - - - - "; - } -?> + + + get_stylesheet(); + $delete_url = add_query_arg( array( + 'action' => 'delete', + 'stylesheet' => urlencode( $stylesheet ), + ), admin_url( 'themes.php' ) ); + $delete_url = wp_nonce_url( $delete_url, 'delete-theme_' . $stylesheet ); + ?> + + + +
" . ( $broken_theme->get( 'Name' ) ? $broken_theme->get( 'Name' ) : $broken_theme->get_stylesheet() ) . "" . $broken_theme->errors()->get_error_message() . "
get( 'Name' ) ? $broken_theme->display( 'Name' ) : $broken_theme->get_stylesheet(); ?>errors()->get_error_message(); ?>