Changeset 22923
- Timestamp:
- 11/29/2012 04:58:08 PM (12 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/css/media-views.css
r22920 r22923 727 727 } 728 728 729 .attachments-browser .attachments, 730 .attachments-browser .uploader-inline { 729 .attachments-browser .attachments { 731 730 position: absolute; 732 731 top: 50px; … … 933 932 } 934 933 935 . media-frame.uploader-inline {934 .region-content.uploader-inline { 936 935 margin: 20px; 937 936 padding: 20px; … … 1375 1374 1376 1375 .attachments-browser .attachments, 1377 .attachments-browser .uploader-inline,1378 1376 .attachments-browser .media-toolbar { 1379 1377 right: 180px; -
trunk/wp-includes/js/media-views.js
r22919 r22923 263 263 toolbar: 'main-attachments', 264 264 sidebar: 'settings', 265 content: 'browse',266 265 searchable: true, 267 266 filterable: false, … … 306 305 selection.on( 'add remove reset', this.refreshSelection, this ); 307 306 307 this._updateEmpty(); 308 library.on( 'add remove reset', this._updateEmpty, this ); 309 this.on( 'change:empty', this.refresh, this ); 308 310 this.refresh(); 311 312 309 313 this.on( 'insert', this._insertDisplaySettings, this ); 310 314 }, 311 315 312 316 deactivate: function() { 317 this.off( 'change:empty', this.refresh, this ); 318 this.get('library').off( 'add remove reset', this._updateEmpty, this ); 319 313 320 // Unbind all event handlers that use this state as the context 314 321 // from the selection. … … 328 335 }, 329 336 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 330 352 refresh: function() { 353 this.frame.$el.toggleClass( 'hide-toolbar', this.get('empty') ); 331 354 this.content(); 332 355 this.refreshSelection(); … … 365 388 setUserSetting( 'imgsize', display.size ); 366 389 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') ); 367 401 }, 368 402 … … 1268 1302 browseContent: function() { 1269 1303 var state = this.state(); 1270 1271 this.$el.removeClass('hide-toolbar');1272 1304 1273 1305 // Browse our library of attachments. … … 2979 3011 2980 3012 this.createToolbar(); 2981 this. updateContent();3013 this.createAttachments(); 2982 3014 this.createSidebar(); 2983 2984 this.collection.on( 'add remove reset', this.updateContent, this );2985 3015 }, 2986 3016 … … 3030 3060 }, 3031 3061 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.controller3054 });3055 3056 this.views.add( this.uploader );3057 },3058 3059 3062 createAttachments: function() { 3060 if ( this.uploader ) {3061 this.uploader.remove();3062 delete this.uploader;3063 }3064 3065 3063 this.attachments = new media.view.Attachments({ 3066 3064 controller: this.controller,
Note: See TracChangeset
for help on using the changeset viewer.