Media: Only show the edit selection link for the media library. Make the upload attachments list sortable. Only retain the `silent` option when running `Attachments.validate()`. see #21390.

git-svn-id: https://develop.svn.wordpress.org/trunk@22597 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Daryl Koopersmith 2012-11-15 03:09:35 +00:00
parent 3db488d2e3
commit 4a96fa19a4
2 changed files with 16 additions and 10 deletions

View File

@ -358,6 +358,11 @@ window.wp = window.wp || {};
},
validate: function( attachment, options ) {
// Only retain the `silent` option.
options = {
silent: options && options.silent
};
return this[ this.validator( attachment ) ? 'add' : 'remove' ]( attachment, options );
},

View File

@ -458,9 +458,10 @@
// ---------------------------
media.controller.Upload = media.controller.Library.extend({
defaults: _.defaults({
id: 'upload',
upload: { text: l10n.uploadMoreFiles },
searchable: false
id: 'upload',
upload: { text: l10n.uploadMoreFiles },
searchable: false,
sortable: true
}, media.controller.Library.prototype.defaults ),
initialize: function() {
@ -471,10 +472,6 @@
// all uploading) attachments.
if ( ! library ) {
library = new Attachments();
library.props.set({
orderby: 'date',
order: 'ASC'
});
library.observe( wp.Uploader.queue );
this.set( 'library', library );
}
@ -995,7 +992,8 @@
// Main states.
new media.controller.Library( _.defaults({
selection: options.selection,
library: media.query( options.library )
library: media.query( options.library ),
editable: true
}, main ) ),
new media.controller.Upload( main ),
@ -1256,7 +1254,8 @@
// Toolbars
mainAttachmentsToolbar: function() {
this.toolbar.view( new media.view.Toolbar.Insert({
controller: this
controller: this,
editable: this.state().get('editable')
}) );
},
@ -1770,7 +1769,9 @@
collection: selection,
priority: -40,
editable: function() {
// If the selection is editable, pass the callback to
// switch the content mode.
editable: this.options.editable && function() {
this.controller.content.mode('edit-selection');
}
}).render(),