Media: Add an "upload more files" button to upload states. see #21390.

git-svn-id: http://core.svn.wordpress.org/trunk@22552 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Daryl Koopersmith 2012-11-12 23:52:17 +00:00
parent 8c60f41b2f
commit 8c73f531b9
3 changed files with 23 additions and 2 deletions

View File

@ -619,6 +619,14 @@
height: 50px; height: 50px;
} }
.attachments-browser .media-toolbar-primary > .media-button,
.attachments-browser .media-toolbar-primary > .media-button-group,
.attachments-browser .media-toolbar-secondary > .media-button,
.attachments-browser .media-toolbar-secondary > .media-button-group {
margin-top: 10px;
}
.attachments-browser .attachments { .attachments-browser .attachments {
position: absolute; position: absolute;
top: 50px; top: 50px;

View File

@ -470,7 +470,9 @@
// --------------------------- // ---------------------------
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 },
searchable: false
}, media.controller.Library.prototype.defaults ), }, media.controller.Library.prototype.defaults ),
initialize: function() { initialize: function() {
@ -852,6 +854,7 @@
model: state, model: state,
sortable: state.get('sortable'), sortable: state.get('sortable'),
search: state.get('searchable'), search: state.get('searchable'),
upload: state.get('upload'),
AttachmentView: state.get('AttachmentView') AttachmentView: state.get('AttachmentView')
}).render() ); }).render() );
@ -1526,7 +1529,7 @@
this.$el.html( this.template( this.options ) ); this.$el.html( this.template( this.options ) );
$placeholder = this.$('.browser'); $placeholder = this.$('.browser');
$browser.text( $placeholder.text() ); $browser.detach().text( $placeholder.text() );
$browser[0].className = $placeholder[0].className; $browser[0].className = $placeholder[0].className;
$placeholder.replaceWith( $browser.show() ); $placeholder.replaceWith( $browser.show() );
@ -2505,6 +2508,15 @@
}) ); }) );
} }
if ( this.options.upload && this.controller.uploader ) {
this.toolbar.set( 'upload', new media.view.Button( _.extend({
el: this.controller.uploader.$browser.detach()[0],
priority: -60,
size: 'large',
text: l10n.selectFiles
}, this.options.upload ) ).render() );
}
this.attachments = new media.view.Attachments({ this.attachments = new media.view.Attachments({
controller: this.controller, controller: this.controller,
collection: this.collection, collection: this.collection,

View File

@ -1339,6 +1339,7 @@ function wp_enqueue_media() {
'uploadFilesTitle' => __( 'Upload Files' ), 'uploadFilesTitle' => __( 'Upload Files' ),
'selectFiles' => __( 'Select files' ), 'selectFiles' => __( 'Select files' ),
'uploadImagesTitle' => __( 'Upload Images' ), 'uploadImagesTitle' => __( 'Upload Images' ),
'uploadMoreFiles' => __( 'Upload more files' ),
// Library // Library
'mediaLibraryTitle' => __( 'Media Library' ), 'mediaLibraryTitle' => __( 'Media Library' ),