Add save changes reminder to Widgets admin pending revamp in 2.8. Props mdawaffe. fixes #7863
git-svn-id: http://svn.automattic.com/wordpress/trunk@9140 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
586e660529
commit
82be75124d
|
@ -305,7 +305,7 @@ function wp_widget_control( $sidebar_args ) {
|
|||
|
||||
<?php if ( $control ) : ?>
|
||||
|
||||
<a class="widget-action widget-control-save hide-if-no-js edit alignleft" href="#save:<?php echo $id_format; ?>"><?php _e('Change'); ?></a>
|
||||
<a class="widget-action widget-control-save hide-if-no-js edit alignleft" href="#save:<?php echo $id_format; ?>"><?php _e('Done'); ?></a>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
|
|
|
@ -1,6 +1,18 @@
|
|||
jQuery(function($) {
|
||||
$('.noscript-action').remove();
|
||||
|
||||
var reminded = false;
|
||||
var lameWidgetReminder = function() {
|
||||
if ( reminded )
|
||||
return;
|
||||
window.onbeforeunload = function () { return widgetsL10n.lamerReminder };
|
||||
$('div.wrap:first').prepend( '<div class="updated" style="display:none"><p>' + widgetsL10n.lameReminder + '</p></div>' ).children( ':first' ).slideDown();
|
||||
$('#current-widgets .submit input[name=save-widgets]').css( 'background-color', '#ffffe0' ).click( function() {
|
||||
window.onbeforeunload = null;
|
||||
} );
|
||||
reminded = true;
|
||||
};
|
||||
|
||||
var increment = 1;
|
||||
|
||||
// Open or close widget control form
|
||||
|
@ -84,6 +96,7 @@ jQuery(function($) {
|
|||
var n = parseInt( $('#widget-count').text(), 10 ) + 1;
|
||||
$('#widget-count').text( n.toString() )
|
||||
|
||||
lameWidgetReminder();
|
||||
return false;
|
||||
};
|
||||
|
||||
|
@ -96,6 +109,7 @@ jQuery(function($) {
|
|||
|
||||
// onclick for save links
|
||||
$('a.widget-control-save', context).click( function() {
|
||||
lameWidgetReminder();
|
||||
toggleWidget( $(this).parents('li:first'), false ).blur()
|
||||
return false;
|
||||
} );
|
||||
|
|
|
@ -222,11 +222,13 @@ function wp_default_scripts( &$scripts ) {
|
|||
'saveText' => attribute_escape(__('Save »')),
|
||||
'confirmText' => __("Are you sure you want to delete the file '%title%'?\nClick ok to delete or cancel to go back.")
|
||||
) );
|
||||
$scripts->add( 'admin-widgets', '/wp-admin/js/widgets.js', array( 'interface' ), '20080503' );
|
||||
$scripts->add( 'admin-widgets', '/wp-admin/js/widgets.js', array( 'interface' ), '20081010' );
|
||||
$scripts->localize( 'admin-widgets', 'widgetsL10n', array(
|
||||
'add' => __('Add'),
|
||||
'edit' => __('Edit'),
|
||||
'cancel' => __('Cancel'),
|
||||
'lameReminder' => __('Remember to click the "Save Changes" button at the bottom of the Current Widgets column after you\'re all done!'),
|
||||
'lamerReminder' => __("You're about to leave without having saved your changes!")
|
||||
));
|
||||
|
||||
$scripts->add( 'word-count', '/wp-admin/js/word-count.js', array( 'jquery' ), '20080423' );
|
||||
|
|
Loading…
Reference in New Issue