From aba2e372e0cc455b736c7371d7efcb20d979da26 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Fri, 11 Jul 2014 05:43:26 +0000 Subject: [PATCH] Media Grid: "Add New" should open and close, not just open. See #24716. git-svn-id: https://develop.svn.wordpress.org/trunk@29087 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/js/media-grid.js | 2 +- src/wp-includes/js/media-views.js | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/wp-includes/js/media-grid.js b/src/wp-includes/js/media-grid.js index e5a69640ba..0ac6f44c9b 100644 --- a/src/wp-includes/js/media-grid.js +++ b/src/wp-includes/js/media-grid.js @@ -230,7 +230,7 @@ }, addNewClickHandler: function() { - this.trigger( 'show:upload:attachment' ); + this.trigger( 'toggle:upload:attachment' ); }, /** diff --git a/src/wp-includes/js/media-views.js b/src/wp-includes/js/media-views.js index 0ffb74bdb2..ae183db7a0 100644 --- a/src/wp-includes/js/media-views.js +++ b/src/wp-includes/js/media-views.js @@ -5602,7 +5602,8 @@ AttachmentView: media.view.Attachment.Library }); - this.listenTo( this.controller, 'show:upload:attachment', _.bind( this.showUploader, this ) ); + this.listenTo( this.controller, 'toggle:upload:attachment', _.bind( this.toggleUploader, this ) ); + this.createToolbar(); this.createUploader(); this.createAttachments(); @@ -5744,8 +5745,12 @@ this.views.add( this.uploader ); }, - showUploader: function() { - this.uploader.show(); + toggleUploader: function() { + if ( this.uploader.$el.hasClass( 'hidden' ) ) { + this.uploader.show(); + } else { + this.uploader.hide(); + } }, createAttachments: function() {