Ticket #24859: 24859.diff
File 24859.diff, 3.2 KB (added by , 11 years ago) |
---|
-
src/wp-includes/js/media-views.js
3257 3257 media.view.AttachmentsBrowser = media.View.extend({ 3258 3258 tagName: 'div', 3259 3259 className: 'attachments-browser', 3260 spinnerCount: 0, 3260 3261 3261 3262 initialize: function() { 3262 3263 _.defaults( this.options, { … … 3267 3268 AttachmentView: media.view.Attachment.Library 3268 3269 }); 3269 3270 3271 media.ajax.on( 'ajax', this.updateSpinner, this ); 3272 3270 3273 this.createToolbar(); 3271 3274 this.updateContent(); 3272 3275 this.createSidebar(); … … 3274 3277 this.collection.on( 'add remove reset', this.updateContent, this ); 3275 3278 }, 3276 3279 3280 updateSpinner: function( result, options ) { 3281 var view = this, 3282 spinnerActions = ['query-attachments']; 3283 3284 if ( _.indexOf(spinnerActions, options.data.action) < 0 ) 3285 return; 3286 3287 view.spinnerCount += 1; 3288 view.toolbar.get('spinner').show(); 3289 3290 result.done(function() { 3291 view.spinnerCount -= 1; 3292 if ( view.spinnerCount < 1 ) 3293 view.toolbar.get('spinner').hide(); 3294 }); 3295 }, 3296 3277 3297 dispose: function() { 3278 3298 this.options.selection.off( null, null, this ); 3279 3299 media.View.prototype.dispose.apply( this, arguments ); … … 3303 3323 }).render() ); 3304 3324 } 3305 3325 3326 this.toolbar.set( 'spinner', new media.view.Spinner({ 3327 priority: -70 3328 }) ); 3329 3306 3330 if ( this.options.search ) { 3307 3331 this.toolbar.set( 'search', new media.view.Search({ 3308 3332 controller: this.controller, … … 3963 3987 this.$('img').attr( 'src', this.model.get('url') ); 3964 3988 } 3965 3989 }); 3990 3991 media.view.Spinner = media.View.extend({ 3992 tagName: 'span', 3993 className: 'spinner', 3994 3995 show: function() { 3996 this.$el.show(); 3997 return this; 3998 }, 3999 4000 hide: function() { 4001 this.$el.hide(); 4002 return this; 4003 } 4004 }); 3966 4005 }(jQuery)); 4006 No newline at end of file -
src/wp-includes/js/media-models.js
90 90 * Sends an XHR request to WordPress. 91 91 * See wp.ajax.send() in `wp-includes/js/wp-util.js`. 92 92 */ 93 ajax: wp.ajax.send, 93 ajax: function( action, options ) { 94 if ( _.isObject( action ) ) 95 options = action; 94 96 97 var result = wp.ajax.send.apply( this, arguments ); 98 this.ajax.trigger( 'ajax', result, options ); 99 return result; 100 }, 101 95 102 // Scales a set of dimensions to fit within bounding dimensions. 96 103 fit: function( dimensions ) { 97 104 var width = dimensions.width, … … 144 151 } 145 152 }); 146 153 154 _.extend( media.ajax, Backbone.Events ); 147 155 156 148 157 /** 149 158 * ======================================================================== 150 159 * MODELS -
src/wp-includes/css/media-views.css
590 590 } 591 591 592 592 /** 593 * Media toolbar spinner 594 */ 595 .media-frame .media-toolbar .spinner { 596 margin-top: 15px; 597 } 598 599 /** 593 600 * Search 594 601 */ 595 602 .media-frame .search {