Changeset 40051
- Timestamp:
- 02/08/2017 07:43:58 PM (8 years ago)
- Location:
- trunk/src/wp-includes/js
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/media-views.js
r40050 r40051 3957 3957 priority: -55, 3958 3958 click: function() { 3959 var removed = [], selection = this.controller.state().get( 'selection' ); 3959 var removed = [], 3960 destroy = [], 3961 selection = this.controller.state().get( 'selection' ); 3960 3962 3961 3963 if ( ! selection.length || ! window.confirm( l10n.warnBulkDelete ) ) { … … 3969 3971 } 3970 3972 3971 model.destroy();3973 destroy.push( model ); 3972 3974 } ); 3973 3975 3974 selection.remove( removed ); 3975 this.controller.trigger( 'selection:action:done' ); 3976 if ( removed.length ) { 3977 selection.remove( removed ); 3978 } 3979 3980 if ( destroy.length ) { 3981 $.when.apply( null, destroy.map( function (item) { 3982 return item.destroy(); 3983 } ) ).then( _.bind( function() { 3984 this.controller.trigger( 'selection:action:done' ); 3985 }, this ) ); 3986 } 3976 3987 } 3977 3988 }).render() ); -
trunk/src/wp-includes/js/media/views/attachments/browser.js
r37755 r40051 226 226 priority: -55, 227 227 click: function() { 228 var removed = [], selection = this.controller.state().get( 'selection' ); 228 var removed = [], 229 destroy = [], 230 selection = this.controller.state().get( 'selection' ); 229 231 230 232 if ( ! selection.length || ! window.confirm( l10n.warnBulkDelete ) ) { … … 238 240 } 239 241 240 model.destroy();242 destroy.push( model ); 241 243 } ); 242 244 243 selection.remove( removed ); 244 this.controller.trigger( 'selection:action:done' ); 245 if ( removed.length ) { 246 selection.remove( removed ); 247 } 248 249 if ( destroy.length ) { 250 $.when.apply( null, destroy.map( function (item) { 251 return item.destroy(); 252 } ) ).then( _.bind( function() { 253 this.controller.trigger( 'selection:action:done' ); 254 }, this ) ); 255 } 245 256 } 246 257 }).render() );
Note: See TracChangeset
for help on using the changeset viewer.