Ticket #22628: 22628.2.diff
| File 22628.2.diff, 4.1 KB (added by koopersmith, 7 months ago) |
|---|
-
wp-includes/css/media-views.css
721 721 margin-top: 10px; 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; 727 728 left: 0; … … 926 927 display: block; 927 928 } 928 929 929 . region-content.uploader-inline {930 .media-frame .uploader-inline { 930 931 margin: 20px; 931 932 padding: 20px; 932 933 text-align: center; … … 1368 1369 } 1369 1370 1370 1371 .attachments-browser .attachments, 1372 .attachments-browser .uploader-inline, 1371 1373 .attachments-browser .media-toolbar { 1372 1374 right: 180px; 1373 1375 } -
wp-includes/js/media-views.js
262 262 describe: false, 263 263 toolbar: 'main-attachments', 264 264 sidebar: 'settings', 265 content: 'browse', 265 266 searchable: true, 266 267 filterable: false, 267 268 uploads: true … … 304 305 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. 322 315 this.get('selection').off( null, null, this ); … … 334 327 this.resetDisplays(); 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(); 356 333 }, … … 389 366 setUserSetting( 'urlbutton', display.link ); 390 367 }, 391 368 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 },402 403 369 refreshSelection: function() { 404 370 var selection = this.get('selection'), 405 371 mode = this.frame.content.mode(); … … 1302 1268 browseContent: function() { 1303 1269 var state = this.state(); 1304 1270 1271 this.$el.removeClass('hide-toolbar'); 1272 1305 1273 // Browse our library of attachments. 1306 1274 this.content.view( new media.view.AttachmentsBrowser({ 1307 1275 controller: this, … … 3010 2978 }); 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 3017 2987 dispose: function() { … … 3059 3029 } 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, 3065 3067 collection: this.collection,