Ticket #23120: 23120.13.diff
File 23120.13.diff, 3.7 KB (added by , 10 years ago) |
---|
-
src/wp-admin/css/edit.css
329 329 width: 68%; 330 330 } 331 331 332 .widget { 333 position: relative; 334 border-left: 0 solid transparent; 335 transition: border-left 0.2s ease-in-out; 336 } 337 338 .widget.saved h4:before { 339 opacity: 0; 340 display: block; 341 content: "\f147"; 342 transition: opacity 0.2s ease-in-out; 343 -webkit-font-smoothing: antialiased; 344 font: normal 32px/1 'dashicons'; 345 position: absolute; 346 top: 2px; 347 left: 9px; 348 line-height: 43px; 349 color: #fff; 350 } 351 352 .widget.saved h4 { 353 border-left: 48px solid #84d24c; 354 } 355 356 .widget.saved h4:before { 357 opacity: 1; 358 } 359 360 .widget.save-failed .spinner { 361 opacity: 1; 362 filter: alpha( opacity=100 ); 363 background: url( '' ); 364 background-color: #a00; 365 padding: 3px; 366 float: left; 367 } 368 369 .widget.save-failed .spinner:before { 370 font: normal 20px/1 'dashicons'; 371 content: '\f335'; 372 color: #fff; 373 } 374 375 .widget.save-failed .saved-failed-notice { 376 float: left; 377 line-height: 32px; 378 margin-right: 5px; 379 } 380 332 381 #post-status-info { 333 382 width: 100%; 334 383 border-spacing: 0; -
src/wp-admin/js/widgets.js
1 /*global ajaxurl, isRtl */1 /*global ajaxurl, isRtl, _wpWidgetSettings */ 2 2 var wpWidgets; 3 3 (function($) { 4 4 … … 337 337 338 338 save : function( widget, del, animate, order ) { 339 339 var sidebarId = widget.closest('div.widgets-sortables').attr('id'), 340 data = widget.find('form').serialize(), a ;340 data = widget.find('form').serialize(), a, $spinner; 341 341 342 widget = $(widget); 343 $('.spinner', widget).show(); 342 widget = $(widget); 343 $spinner = $('.spinner', widget); 344 $spinner.show(); 344 345 345 346 a = { 346 347 action: 'save-widget', … … 377 378 widget.remove(); 378 379 } 379 380 } else { 380 $ ('.spinner').hide();381 $spinner.hide(); 381 382 if ( r && r.length > 2 ) { 382 383 $( 'div.widget-content', widget ).html( r ); 383 384 wpWidgets.appendTitle( widget ); … … 387 388 if ( order ) { 388 389 wpWidgets.saveOrder(); 389 390 } 391 }) 392 .done( function() { // The widget save was successful, collapse the widget and alert the user 393 if (false){ 394 395 setTimeout( function() { 396 widget.find( '.widget-title' ).click(); /* Collapses the widget */ 397 // Indicate save successful 398 widget.addClass( 'saved' ); 399 // Remove the saved indicator ofter a brief delay 400 setTimeout( function() { 401 widget.removeClass( 'saved' ); 402 }, 2500 ); 403 }, 100 ); 404 } 405 }) 406 .fail( function() { // The widget save failed, alert the user 407 setTimeout( function() { 408 widget.addClass( 'save-failed' ); 409 widget 410 .find( '.widget-control-actions' ) 411 .find( '.alignright' ) 412 .append( '<div class="saved-failed-notice">' + _wpWidgetSettings.saveFailed + '</div>' ); 413 $spinner.show(); 414 setTimeout( function() { 415 widget.removeClass( 'save-failed' ); 416 widget 417 .find( '.saved-failed-notice' ).remove(); 418 $spinner.hide(); 419 }, 2500 ); 420 }, 100 ); 390 421 }); 391 422 }, 392 423 -
src/wp-admin/widgets.php
29 29 add_filter( 'admin_body_class', 'wp_widgets_access_body_class' ); 30 30 } else { 31 31 wp_enqueue_script('admin-widgets'); 32 32 wp_localize_script( 'admin-widgets', '_wpWidgetSettings', array( 33 'saveFailed' => __( 'Save failed, try again' ) 34 ) ); 33 35 if ( wp_is_mobile() ) 34 36 wp_enqueue_script( 'jquery-touch-punch' ); 35 37 }