Changeset 22919
- Timestamp:
- 11/29/2012 01:33:57 PM (12 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/css/media-views.css
r22894 r22919 722 722 } 723 723 724 .attachments-browser .attachments { 724 .attachments-browser .attachments, 725 .attachments-browser .uploader-inline { 725 726 position: absolute; 726 727 top: 50px; … … 927 928 } 928 929 929 . region-content.uploader-inline {930 .media-frame .uploader-inline { 930 931 margin: 20px; 931 932 padding: 20px; … … 1369 1370 1370 1371 .attachments-browser .attachments, 1372 .attachments-browser .uploader-inline, 1371 1373 .attachments-browser .media-toolbar { 1372 1374 right: 180px; -
trunk/wp-includes/js/media-views.js
r22907 r22919 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 … … 1302 1268 browseContent: function() { 1303 1269 var state = this.state(); 1270 1271 this.$el.removeClass('hide-toolbar'); 1304 1272 1305 1273 // Browse our library of attachments. … … 3011 2979 3012 2980 this.createToolbar(); 3013 this. createAttachments();2981 this.updateContent(); 3014 2982 this.createSidebar(); 2983 2984 this.collection.on( 'add remove reset', this.updateContent, this ); 3015 2985 }, 3016 2986 … … 3060 3030 }, 3061 3031 3032 updateContent: function() { 3033 var view = this; 3034 3035 if( ! this.attachments ) 3036 this.createAttachments(); 3037 3038 if ( ! this.collection.length ) { 3039 this.collection.more().done( function() { 3040 if ( ! view.collection.length ) 3041 view.createUploader(); 3042 }); 3043 } 3044 }, 3045 3046 createUploader: function() { 3047 if ( this.attachments ) { 3048 this.attachments.remove(); 3049 delete this.attachments; 3050 } 3051 3052 this.uploader = new media.view.UploaderInline({ 3053 controller: this.controller 3054 }); 3055 3056 this.views.add( this.uploader ); 3057 }, 3058 3062 3059 createAttachments: function() { 3060 if ( this.uploader ) { 3061 this.uploader.remove(); 3062 delete this.uploader; 3063 } 3064 3063 3065 this.attachments = new media.view.Attachments({ 3064 3066 controller: this.controller,
Note: See TracChangeset
for help on using the changeset viewer.