Make WordPress Core

Changeset 22482


Ignore:
Timestamp:
11/09/2012 02:11:37 AM (14 years ago)
Author:
koopersmith
Message:

Media: In the main media library in the insert media dialog, only show attachment display settings when one attachment is selected. see #21390.

File:
1 edited

Legend:

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

    r22480 r22482  
    303303
    304304                        selection.on( 'selection:single selection:unsingle', this.sidebar, this );
    305                         selection.on( 'add remove reset', this.refreshToolbar, this );
     305                        selection.on( 'add remove reset', this.refreshSelection, this );
    306306
    307307                        this._updateEmpty();
     
    364364                },
    365365
    366                 refreshToolbar: function() {
     366                refreshSelection: function() {
    367367                        this.frame.toolbar.view().refresh();
     368                        this.trigger( 'refresh:selection', this, this.get('selection') );
    368369                },
    369370
     
    644645                        });
    645646
    646                         this.bindHandlers();
    647647                        this.createSelection();
    648648                        this.createStates();
     649                        this.bindHandlers();
     650
     651                        // Set the default state.
     652                        this.state( this.options.state );
    649653                },
    650654
     
    685689                        }, this );
    686690
     691                        _.each(['library', 'upload'], function( id ) {
     692                                this.get( id ).on( 'refresh:selection', function( state, selection ) {
     693                                        var sidebar = this.sidebar;
     694
     695                                        if ( ! selection.length )
     696                                                sidebar.mode('clear');
     697                                        else if ( selection.length === 1 )
     698                                                sidebar.mode('attachment-settings');
     699                                        else
     700                                                sidebar.mode('settings');
     701                                }, this );
     702                        }, this );
     703
    687704                        this.sidebar.on( 'gallery-settings', this.onSidebarGallerySettings, this );
    688705                },
     
    706723                                multiple: this.options.multiple,
    707724                                menu:      'main',
    708                                 sidebar:   'attachment-settings',
    709725
    710726                                // Update user settings when users adjust the
     
    773789                                }, batch ) )
    774790                        ]);
    775 
    776                         // Set the default state.
    777                         this.state( options.state );
    778791                },
    779792
Note: See TracChangeset for help on using the changeset viewer.