From a8bc73c5439e5b1702376180d91c5f4caec84274 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Fri, 7 Mar 2014 16:41:49 +0000 Subject: [PATCH] When `MEDIA_TRASH` is true, show the proper context in the `attachment-details` sidebar. Without this fix, it always showed "Delete Permanently." Props toszcze. Fixes #26783. git-svn-id: https://develop.svn.wordpress.org/trunk@27454 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/css/media-views.css | 9 ++++++--- src/wp-includes/js/media-views.js | 11 +++++++++++ src/wp-includes/media-template.php | 6 +++++- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/wp-includes/css/media-views.css b/src/wp-includes/css/media-views.css index 018ff271cb..c86edcc613 100644 --- a/src/wp-includes/css/media-views.css +++ b/src/wp-includes/css/media-views.css @@ -1388,7 +1388,8 @@ .attachment-info .edit-attachment, .attachment-info .refresh-attachment, -.attachment-info .delete-attachment { +.attachment-info .delete-attachment, +.attachment-info .trash-attachment { display: block; text-decoration: none; white-space: nowrap; @@ -1404,11 +1405,13 @@ display: block; } -.attachment-info .delete-attachment { +.attachment-info .delete-attachment, +.attachment-info .trash-attachment { color: #bc0b0b; } -.attachment-info .delete-attachment:hover { +.attachment-info .delete-attachment:hover, +.attachment-info .trash-attachment:hover { color: red; } diff --git a/src/wp-includes/js/media-views.js b/src/wp-includes/js/media-views.js index 28c56b08a2..76f689b377 100644 --- a/src/wp-includes/js/media-views.js +++ b/src/wp-includes/js/media-views.js @@ -5933,6 +5933,7 @@ 'change [data-setting] select': 'updateSetting', 'change [data-setting] textarea': 'updateSetting', 'click .delete-attachment': 'deleteAttachment', + 'click .trash-attachment': 'trashAttachment', 'click .edit-attachment': 'editAttachment', 'click .refresh-attachment': 'refreshAttachment' }, @@ -5970,7 +5971,17 @@ this.model.destroy(); } }, + /** + * @param {Object} event + */ + trashAttachment: function( event ) { + event.preventDefault(); + this.model.destroy(); + }, + /** + * @param {Object} event + */ editAttachment: function( event ) { event.preventDefault(); this.controller.setState( 'edit-image' ); diff --git a/src/wp-includes/media-template.php b/src/wp-includes/media-template.php index 6bad9a361a..15c84c6392 100644 --- a/src/wp-includes/media-template.php +++ b/src/wp-includes/media-template.php @@ -217,7 +217,11 @@ function wp_print_media_templates() { <# } #> <# if ( ! data.uploading && data.can.remove ) { #> - + + + + + <# } #>