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
This commit is contained in:
Dominik Schilling (ocean90) 2014-10-16 19:45:26 +00:00
parent a3e0c08f2f
commit 3d6d32d9e6
3 changed files with 42 additions and 11 deletions

View File

@ -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%;
}
}

View File

@ -1659,6 +1659,10 @@ $( document ).ready(function() {
} else {
themes.Run.init();
}
$( '.broken-themes .delete-theme' ).on( 'click', function() {
return confirm( _wpThemeSettings.settings.confirmDelete );
});
});
})( jQuery );

View File

@ -246,20 +246,37 @@ if ( ! is_multisite() && current_user_can('edit_themes') && $broken_themes = wp_
<h3><?php _e('Broken Themes'); ?></h3>
<p><?php _e('The following themes are installed but incomplete. Themes must have a stylesheet and a template.'); ?></p>
<?php
$can_delete = current_user_can( 'delete_themes' );
?>
<table>
<tr>
<th><?php _ex('Name', 'theme name'); ?></th>
<th><?php _e('Description'); ?></th>
<?php if ( $can_delete ) { ?>
<th></th>
<?php } ?>
</tr>
</tr>
<?php
foreach ( $broken_themes as $broken_theme ) {
echo "
<?php foreach ( $broken_themes as $broken_theme ) : ?>
<tr>
<td>" . ( $broken_theme->get( 'Name' ) ? $broken_theme->get( 'Name' ) : $broken_theme->get_stylesheet() ) . "</td>
<td>" . $broken_theme->errors()->get_error_message() . "</td>
</tr>";
}
?>
<td><?php echo $broken_theme->get( 'Name' ) ? $broken_theme->display( 'Name' ) : $broken_theme->get_stylesheet(); ?></td>
<td><?php echo $broken_theme->errors()->get_error_message(); ?></td>
<?php
if ( $can_delete ) {
$stylesheet = $broken_theme->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 );
?>
<td><a href="<?php echo esc_url( $delete_url ); ?>" class="button button-secondary delete-theme"><?php _e( 'Delete' ); ?></a></td>
<?php
}
?>
</tr>
<?php endforeach; ?>
</table>
</div>