Make WordPress Core

Changeset 9140


Ignore:
Timestamp:
10/13/2008 11:09:15 PM (16 years ago)
Author:
ryan
Message:

Add save changes reminder to Widgets admin pending revamp in 2.8. Props mdawaffe. fixes #7863

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/widgets.php

    r9053 r9140  
    306306                <?php if ( $control ) : ?>
    307307
    308                 <a class="widget-action widget-control-save hide-if-no-js edit alignleft" href="#save:<?php echo $id_format; ?>"><?php _e('Change'); ?></a>
     308                <a class="widget-action widget-control-save hide-if-no-js edit alignleft" href="#save:<?php echo $id_format; ?>"><?php _e('Done'); ?></a>
    309309
    310310                <?php endif; ?>
  • trunk/wp-admin/js/widgets.js

    r7881 r9140  
    11jQuery(function($) {
    22    $('.noscript-action').remove();
     3
     4    var reminded = false;
     5    var lameWidgetReminder = function() {
     6        if ( reminded )
     7            return;
     8        window.onbeforeunload = function () { return widgetsL10n.lamerReminder };
     9        $('div.wrap:first').prepend( '<div class="updated" style="display:none"><p>' + widgetsL10n.lameReminder + '</p></div>' ).children( ':first' ).slideDown();
     10        $('#current-widgets .submit input[name=save-widgets]').css( 'background-color', '#ffffe0' ).click( function() {
     11            window.onbeforeunload = null;
     12        } );
     13        reminded = true;
     14    };
    315
    416    var increment = 1;
     
    8597        $('#widget-count').text( n.toString() )
    8698
     99        lameWidgetReminder();
    87100        return false;
    88101    };
     
    97110        // onclick for save links
    98111        $('a.widget-control-save', context).click( function() {
     112            lameWidgetReminder();
    99113            toggleWidget( $(this).parents('li:first'), false ).blur()
    100114            return false;
  • trunk/wp-includes/script-loader.php

    r9114 r9140  
    223223            'confirmText' => __("Are you sure you want to delete the file '%title%'?\nClick ok to delete or cancel to go back.")
    224224        ) );
    225         $scripts->add( 'admin-widgets', '/wp-admin/js/widgets.js', array( 'interface' ), '20080503' );
     225        $scripts->add( 'admin-widgets', '/wp-admin/js/widgets.js', array( 'interface' ), '20081010' );
    226226        $scripts->localize( 'admin-widgets', 'widgetsL10n', array(
    227227            'add' => __('Add'),
    228228            'edit' => __('Edit'),
    229229            'cancel' => __('Cancel'),
     230            'lameReminder' => __('Remember to click the "Save Changes" button at the bottom of the Current Widgets column after you\'re all done!'),
     231            'lamerReminder' => __("You're about to leave without having saved your changes!")
    230232        ));
    231233
Note: See TracChangeset for help on using the changeset viewer.