From 8c73f531b9aeca4ee2343678fa013c7f69ae29c6 Mon Sep 17 00:00:00 2001 From: Daryl Koopersmith Date: Mon, 12 Nov 2012 23:52:17 +0000 Subject: [PATCH] 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 --- wp-includes/css/media-views.css | 8 ++++++++ wp-includes/js/media-views.js | 16 ++++++++++++++-- wp-includes/media.php | 1 + 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/wp-includes/css/media-views.css b/wp-includes/css/media-views.css index 4e2b11ff9e..c8ddb5ae1e 100644 --- a/wp-includes/css/media-views.css +++ b/wp-includes/css/media-views.css @@ -619,6 +619,14 @@ 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 { position: absolute; top: 50px; diff --git a/wp-includes/js/media-views.js b/wp-includes/js/media-views.js index 5d8cee5735..38e4b25c09 100644 --- a/wp-includes/js/media-views.js +++ b/wp-includes/js/media-views.js @@ -470,7 +470,9 @@ // --------------------------- media.controller.Upload = media.controller.Library.extend({ defaults: _.defaults({ - id: 'upload' + id: 'upload', + upload: { text: l10n.uploadMoreFiles }, + searchable: false }, media.controller.Library.prototype.defaults ), initialize: function() { @@ -852,6 +854,7 @@ model: state, sortable: state.get('sortable'), search: state.get('searchable'), + upload: state.get('upload'), AttachmentView: state.get('AttachmentView') }).render() ); @@ -1526,7 +1529,7 @@ this.$el.html( this.template( this.options ) ); $placeholder = this.$('.browser'); - $browser.text( $placeholder.text() ); + $browser.detach().text( $placeholder.text() ); $browser[0].className = $placeholder[0].className; $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({ controller: this.controller, collection: this.collection, diff --git a/wp-includes/media.php b/wp-includes/media.php index 6197621410..3fe014dff2 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -1339,6 +1339,7 @@ function wp_enqueue_media() { 'uploadFilesTitle' => __( 'Upload Files' ), 'selectFiles' => __( 'Select files' ), 'uploadImagesTitle' => __( 'Upload Images' ), + 'uploadMoreFiles' => __( 'Upload more files' ), // Library 'mediaLibraryTitle' => __( 'Media Library' ),