From f171b362a949947dc990d71e0006fd519c8a5db2 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 22 Jul 2014 01:29:17 +0000 Subject: [PATCH] Media Grid: Add a View button to Attachment Details modal. props adamsilverstein. fixes #28977. git-svn-id: https://develop.svn.wordpress.org/trunk@29262 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/js/media-grid.js | 10 +++++++++- src/wp-includes/media-template.php | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/js/media-grid.js b/src/wp-includes/js/media-grid.js index 67f4dc53b0..49f512f9b5 100644 --- a/src/wp-includes/js/media-grid.js +++ b/src/wp-includes/js/media-grid.js @@ -285,7 +285,8 @@ 'click .trash-attachment': 'trashAttachment', 'click .edit-attachment': 'editAttachment', 'click .refresh-attachment': 'refreshAttachment', - 'click .edit-image': 'handleEditImageClick' + 'click .edit-image': 'handleEditImageClick', + 'click .view-attachment': 'handleViewAttachmentClick' }, initialize: function() { @@ -328,6 +329,13 @@ this.controller.setState( 'edit-image' ); }, + /** + * When View is clicked, navigate to the attachment page + */ + handleViewAttachmentClick: function() { + window.location = this.model.get( 'link' ); + }, + afterDelete: function( model ) { if ( ! model.destroyed ) { return; diff --git a/src/wp-includes/media-template.php b/src/wp-includes/media-template.php index c71086ee70..692c0edac2 100644 --- a/src/wp-includes/media-template.php +++ b/src/wp-includes/media-template.php @@ -297,6 +297,8 @@ function wp_print_media_templates() { <# } #> + + <# if ( ! data.uploading && data.can.remove ) { #>