Changeset 37346
- Timestamp:
- 05/02/2016 07:12:37 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/customize-controls.js
r37339 r37346 3328 3328 processing = api.state( 'processing' ), 3329 3329 submitWhenDoneProcessing, 3330 submit; 3330 submit, 3331 modifiedWhileSaving = {}; 3331 3332 3332 3333 body.addClass( 'saving' ); 3334 3335 function captureSettingModifiedDuringSave( setting ) { 3336 modifiedWhileSaving[ setting.id ] = true; 3337 } 3338 api.bind( 'change', captureSettingModifiedDuringSave ); 3333 3339 3334 3340 submit = function () { … … 3339 3345 request = wp.ajax.post( 'customize_save', query ); 3340 3346 3347 // Disable save button during the save request. 3348 saveBtn.prop( 'disabled', true ); 3349 3341 3350 api.trigger( 'save', request ); 3342 3351 3343 3352 request.always( function () { 3344 3353 body.removeClass( 'saving' ); 3354 saveBtn.prop( 'disabled', false ); 3355 api.unbind( 'change', captureSettingModifiedDuringSave ); 3345 3356 } ); 3346 3357 … … 3366 3377 3367 3378 request.done( function( response ) { 3368 // Clear setting dirty states 3369 api.each( function ( value ) { 3370 value._dirty = false; 3379 3380 // Clear setting dirty states, if setting wasn't modified while saving. 3381 api.each( function( setting ) { 3382 if ( ! modifiedWhileSaving[ setting.id ] ) { 3383 setting._dirty = false; 3384 } 3371 3385 } ); 3372 3386 … … 3374 3388 3375 3389 api.trigger( 'saved', response ); 3390 3391 // Restore the global dirty state if any settings were modified during save. 3392 if ( ! _.isEmpty( modifiedWhileSaving ) ) { 3393 api.state( 'saved' ).set( false ); 3394 } 3376 3395 } ); 3377 3396 };
Note: See TracChangeset
for help on using the changeset viewer.