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:
parent
3db488d2e3
commit
4a96fa19a4
@ -358,6 +358,11 @@ window.wp = window.wp || {};
|
|||||||
},
|
},
|
||||||
|
|
||||||
validate: function( attachment, options ) {
|
validate: function( attachment, options ) {
|
||||||
|
// Only retain the `silent` option.
|
||||||
|
options = {
|
||||||
|
silent: options && options.silent
|
||||||
|
};
|
||||||
|
|
||||||
return this[ this.validator( attachment ) ? 'add' : 'remove' ]( attachment, options );
|
return this[ this.validator( attachment ) ? 'add' : 'remove' ]( attachment, options );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -458,9 +458,10 @@
|
|||||||
// ---------------------------
|
// ---------------------------
|
||||||
media.controller.Upload = media.controller.Library.extend({
|
media.controller.Upload = media.controller.Library.extend({
|
||||||
defaults: _.defaults({
|
defaults: _.defaults({
|
||||||
id: 'upload',
|
id: 'upload',
|
||||||
upload: { text: l10n.uploadMoreFiles },
|
upload: { text: l10n.uploadMoreFiles },
|
||||||
searchable: false
|
searchable: false,
|
||||||
|
sortable: true
|
||||||
}, media.controller.Library.prototype.defaults ),
|
}, media.controller.Library.prototype.defaults ),
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
@ -471,10 +472,6 @@
|
|||||||
// all uploading) attachments.
|
// all uploading) attachments.
|
||||||
if ( ! library ) {
|
if ( ! library ) {
|
||||||
library = new Attachments();
|
library = new Attachments();
|
||||||
library.props.set({
|
|
||||||
orderby: 'date',
|
|
||||||
order: 'ASC'
|
|
||||||
});
|
|
||||||
library.observe( wp.Uploader.queue );
|
library.observe( wp.Uploader.queue );
|
||||||
this.set( 'library', library );
|
this.set( 'library', library );
|
||||||
}
|
}
|
||||||
@ -995,7 +992,8 @@
|
|||||||
// Main states.
|
// Main states.
|
||||||
new media.controller.Library( _.defaults({
|
new media.controller.Library( _.defaults({
|
||||||
selection: options.selection,
|
selection: options.selection,
|
||||||
library: media.query( options.library )
|
library: media.query( options.library ),
|
||||||
|
editable: true
|
||||||
}, main ) ),
|
}, main ) ),
|
||||||
|
|
||||||
new media.controller.Upload( main ),
|
new media.controller.Upload( main ),
|
||||||
@ -1256,7 +1254,8 @@
|
|||||||
// Toolbars
|
// Toolbars
|
||||||
mainAttachmentsToolbar: function() {
|
mainAttachmentsToolbar: function() {
|
||||||
this.toolbar.view( new media.view.Toolbar.Insert({
|
this.toolbar.view( new media.view.Toolbar.Insert({
|
||||||
controller: this
|
controller: this,
|
||||||
|
editable: this.state().get('editable')
|
||||||
}) );
|
}) );
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1770,7 +1769,9 @@
|
|||||||
collection: selection,
|
collection: selection,
|
||||||
priority: -40,
|
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');
|
this.controller.content.mode('edit-selection');
|
||||||
}
|
}
|
||||||
}).render(),
|
}).render(),
|
||||||
|
Loading…
Reference in New Issue
Block a user