Make WordPress Core

Ticket #34816: 34816.2.diff

File 34816.2.diff, 2.4 KB (added by swissspidy, 9 years ago)
  • src/wp-admin/js/theme.js

    diff --git src/wp-admin/js/theme.js src/wp-admin/js/theme.js
    index 1a91279..8c6bb31 100644
    themes.view.Details = wp.Backbone.View.extend({ 
    716716
    717717        // Confirmation dialog for deleting a theme
    718718        deleteTheme: function() {
    719                 return confirm( themes.data.settings.confirmDelete );
     719                event.preventDefault();
     720
     721                $( '#delete-theme-dialog' ).removeClass( 'hidden' );
     722
     723                $( '#delete-theme-dialog-cancel' ).on( 'click', function() {
     724                        $( '#delete-theme-dialog' ).addClass( 'hidden' );
     725                });
     726
     727                $( '#delete-theme-dialog-confirm' ).attr( 'href', $( '.delete-theme' ).attr( 'href' ) );
    720728        },
    721729
    722730        nextTheme: function() {
  • src/wp-admin/themes.php

    diff --git src/wp-admin/themes.php src/wp-admin/themes.php
    index bf65884..83df26c 100644
    wp_reset_vars( array( 'theme', 'search' ) ); 
    129129wp_localize_script( 'theme', '_wpThemeSettings', array(
    130130        'themes'   => $themes,
    131131        'settings' => array(
    132                 'canInstall'    => ( ! is_multisite() && current_user_can( 'install_themes' ) ),
    133                 'installURI'    => ( ! is_multisite() && current_user_can( 'install_themes' ) ) ? admin_url( 'theme-install.php' ) : null,
    134                 'confirmDelete' => __( "Are you sure you want to delete this theme?\n\nClick 'Cancel' to go back, 'OK' to confirm the delete." ),
    135                 'adminUrl'      => parse_url( admin_url(), PHP_URL_PATH ),
     132                'canInstall' => ( ! is_multisite() && current_user_can( 'install_themes' ) ),
     133                'installURI' => ( ! is_multisite() && current_user_can( 'install_themes' ) ) ? admin_url( 'theme-install.php' ) : null,
     134                'adminUrl'   => parse_url( admin_url(), PHP_URL_PATH ),
    136135        ),
    137136        'l10n' => array(
    138137                'addNew'            => __( 'Add New Theme' ),
    $can_install = current_user_can( 'install_themes' ); 
    461460                </div>
    462461        </div>
    463462</script>
    464 
     463<div id="delete-theme-dialog" class="notification-dialog-wrap hidden">
     464        <div class="notification-dialog-background"></div>
     465        <div class="notification-dialog" style="padding:25px;">
     466                <div id="delete-theme-dialog-message">
     467                        <p><?php _e( 'Are you sure you want to delete this theme?' ); ?></p>
     468                        <p><?php _e( "Click 'Cancel' to go back, 'OK' to confirm the delete." ); ?></p>
     469                        <p>
     470                                <a id="delete-theme-dialog-cancel" class="button button-secondary">Cancel</a>
     471                                <a id="delete-theme-dialog-confirm" class="button button-primary">Ok</a>
     472                        </p>
     473                </div>
     474        </div>
     475</div>
    465476<?php require( ABSPATH . 'wp-admin/admin-footer.php' );