Changeset 22337
- Timestamp:
- 10/30/2012 11:36:38 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/js/media-views.js
r22335 r22337 136 136 this.on( 'activate', this.activate, this ); 137 137 this.on( 'deactivate', this.deactivate, this ); 138 this.on( 'change:details', this.details, this );139 138 }, 140 139 … … 148 147 if ( this.get('multiple') ) 149 148 wp.Uploader.queue.on( 'add', this.selectUpload, this ); 149 150 this.get('selection').on( 'selection:single', this.buildDetails, this ); 151 this.get('selection').on( 'selection:unsingle', this.clearDetails, this ); 150 152 }, 151 153 … … 156 158 157 159 wp.Uploader.queue.off( 'add', this.selectUpload, this ); 160 this.get('selection').off( 'selection:single', this.buildDetails, this ); 161 this.get('selection').off( 'selection:unsingle', this.clearDetails, this ); 158 162 }, 159 163 … … 180 184 }) ); 181 185 182 this.details( { silent: true });186 this.details(); 183 187 frame.sidebar().add({ 184 188 search: new media.view.Search({ … … 212 216 }, 213 217 214 details: function( options ) { 215 var model = this.get('selection').single(), 216 view; 217 218 if ( model ) { 219 view = new media.view.Attachment.Details({ 220 controller: this.frame, 221 model: model, 222 priority: 80 223 }); 224 } else { 225 view = new Backbone.View(); 226 } 227 228 if ( ! options || ! options.silent ) 229 view.render(); 230 231 this.frame.sidebar().add( 'details', view, options ); 218 details: function() { 219 var single = this.get('selection').single(); 220 this[ single ? 'buildDetails' : 'clearDetails' ]( single ); 221 }, 222 223 buildDetails: function( model ) { 224 this.frame.sidebar().add( 'details', new media.view.Attachment.Details({ 225 controller: this.frame, 226 model: model, 227 priority: 80 228 }).render() ); 229 return this; 230 }, 231 232 clearDetails: function( model ) { 233 if ( this.get('selection').single() ) 234 return this; 235 236 this.frame.sidebar().add( 'details', new Backbone.View({ 237 priority: 80 238 }).render() ); 239 return this; 232 240 }, 233 241
Note: See TracChangeset
for help on using the changeset viewer.