Changeset 22945
- Timestamp:
- 11/30/2012 06:01:47 AM (12 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/css/media-views.css
r22923 r22945 727 727 } 728 728 729 .attachments-browser .attachments { 729 .attachments-browser .attachments, 730 .attachments-browser .uploader-inline { 730 731 position: absolute; 731 732 top: 50px; … … 932 933 } 933 934 934 . region-content.uploader-inline {935 .media-frame .uploader-inline { 935 936 margin: 20px; 936 937 padding: 20px; … … 1374 1375 1375 1376 .attachments-browser .attachments, 1377 .attachments-browser .uploader-inline, 1376 1378 .attachments-browser .media-toolbar { 1377 1379 right: 180px; -
trunk/wp-includes/js/media-views.js
r22938 r22945 263 263 toolbar: 'main-attachments', 264 264 sidebar: 'settings', 265 content: 'browse', 265 266 searchable: true, 266 267 filterable: false, … … 305 306 selection.on( 'add remove reset', this.refreshSelection, this ); 306 307 307 this._updateEmpty();308 library.on( 'add remove reset', this._updateEmpty, this );309 this.on( 'change:empty', this.refresh, this );310 308 this.refresh(); 311 312 313 309 this.on( 'insert', this._insertDisplaySettings, this ); 314 310 }, 315 311 316 312 deactivate: function() { 317 this.off( 'change:empty', this.refresh, this );318 this.get('library').off( 'add remove reset', this._updateEmpty, this );319 320 313 // Unbind all event handlers that use this state as the context 321 314 // from the selection. … … 335 328 }, 336 329 337 content: function() {338 var frame = this.frame;339 340 if ( this.get('empty') ) {341 // Attempt to fetch any Attachments we don't already have.342 this.get('library').more();343 344 // In the meantime, render an inline uploader.345 frame.content.mode('upload');346 } else {347 // Browse our library of attachments.348 frame.content.mode('browse');349 }350 },351 352 330 refresh: function() { 353 this.frame.$el.toggleClass( 'hide-toolbar', this.get('empty') );354 331 this.content(); 355 332 this.refreshSelection(); … … 388 365 setUserSetting( 'imgsize', display.size ); 389 366 setUserSetting( 'urlbutton', display.link ); 390 },391 392 _updateEmpty: function() {393 var library = this.get('library'),394 props = library.props;395 396 // If we're filtering the library, bail.397 if ( this.get('filterable') && ( props.get('type') || props.get('parent') ) )398 return;399 400 this.set( 'empty', ! library.length && ! library.props.get('search') );401 367 }, 402 368 … … 525 491 sortable: true, 526 492 searchable: false, 527 toolbar: 'gallery-edit' 493 toolbar: 'gallery-edit', 494 content: 'browse' 528 495 }, 529 496 … … 1301 1268 browseContent: function() { 1302 1269 var state = this.state(); 1270 1271 this.$el.removeClass('hide-toolbar'); 1303 1272 1304 1273 // Browse our library of attachments. … … 3018 2987 3019 2988 this.createToolbar(); 3020 this. createAttachments();2989 this.updateContent(); 3021 2990 this.createSidebar(); 2991 2992 this.collection.on( 'add remove reset', this.updateContent, this ); 3022 2993 }, 3023 2994 … … 3067 3038 }, 3068 3039 3040 updateContent: function() { 3041 var view = this; 3042 3043 if( ! this.attachments ) 3044 this.createAttachments(); 3045 3046 if ( ! this.collection.length ) { 3047 this.collection.more().done( function() { 3048 if ( ! view.collection.length ) 3049 view.createUploader(); 3050 }); 3051 } 3052 }, 3053 3054 createUploader: function() { 3055 if ( this.attachments ) { 3056 this.attachments.remove(); 3057 delete this.attachments; 3058 } 3059 3060 this.uploader = new media.view.UploaderInline({ 3061 controller: this.controller 3062 }); 3063 3064 this.views.add( this.uploader ); 3065 }, 3066 3069 3067 createAttachments: function() { 3068 if ( this.uploader ) { 3069 this.uploader.remove(); 3070 delete this.uploader; 3071 } 3072 3070 3073 this.attachments = new media.view.Attachments({ 3071 3074 controller: this.controller,
Note: See TracChangeset
for help on using the changeset viewer.