Make WordPress Core

Changeset 22923


Ignore:
Timestamp:
11/29/2012 04:58:08 PM (12 years ago)
Author:
ryan
Message:

Revert accidental bits from r22919. see #22628

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/css/media-views.css

    r22920 r22923  
    727727}
    728728
    729 .attachments-browser .attachments,
    730 .attachments-browser .uploader-inline {
     729.attachments-browser .attachments {
    731730    position: absolute;
    732731    top: 50px;
     
    933932}
    934933
    935 .media-frame .uploader-inline {
     934.region-content.uploader-inline {
    936935    margin: 20px;
    937936    padding: 20px;
     
    13751374
    13761375    .attachments-browser .attachments,
    1377     .attachments-browser .uploader-inline,
    13781376    .attachments-browser .media-toolbar {
    13791377        right: 180px;
  • trunk/wp-includes/js/media-views.js

    r22919 r22923  
    263263            toolbar:    'main-attachments',
    264264            sidebar:    'settings',
    265             content:    'browse',
    266265            searchable: true,
    267266            filterable: false,
     
    306305            selection.on( 'add remove reset', this.refreshSelection, this );
    307306
     307            this._updateEmpty();
     308            library.on( 'add remove reset', this._updateEmpty, this );
     309            this.on( 'change:empty', this.refresh, this );
    308310            this.refresh();
     311
     312
    309313            this.on( 'insert', this._insertDisplaySettings, this );
    310314        },
    311315
    312316        deactivate: function() {
     317            this.off( 'change:empty', this.refresh, this );
     318            this.get('library').off( 'add remove reset', this._updateEmpty, this );
     319
    313320            // Unbind all event handlers that use this state as the context
    314321            // from the selection.
     
    328335        },
    329336
     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
    330352        refresh: function() {
     353            this.frame.$el.toggleClass( 'hide-toolbar', this.get('empty') );
    331354            this.content();
    332355            this.refreshSelection();
     
    365388            setUserSetting( 'imgsize', display.size );
    366389            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') );
    367401        },
    368402
     
    12681302        browseContent: function() {
    12691303            var state = this.state();
    1270 
    1271             this.$el.removeClass('hide-toolbar');
    12721304
    12731305            // Browse our library of attachments.
     
    29793011
    29803012            this.createToolbar();
    2981             this.updateContent();
     3013            this.createAttachments();
    29823014            this.createSidebar();
    2983 
    2984             this.collection.on( 'add remove reset', this.updateContent, this );
    29853015        },
    29863016
     
    30303060        },
    30313061
    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 
    30593062        createAttachments: function() {
    3060             if ( this.uploader ) {
    3061                 this.uploader.remove();
    3062                 delete this.uploader;
    3063             }
    3064 
    30653063            this.attachments = new media.view.Attachments({
    30663064                controller: this.controller,
Note: See TracChangeset for help on using the changeset viewer.