From 2705a86829d0ce3c1867c0a3ec4d261eff6eccfc Mon Sep 17 00:00:00 2001 From: Burhan Nasir Date: Mon, 5 Feb 2024 13:05:56 +0500 Subject: [PATCH 1/2] Fix: Dont open the detailed view if button is disabled --- assets/js/src/views/media-details.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/assets/js/src/views/media-details.js b/assets/js/src/views/media-details.js index 320d2b9d..8c5b41b8 100644 --- a/assets/js/src/views/media-details.js +++ b/assets/js/src/views/media-details.js @@ -30,11 +30,17 @@ var MediaDetailsView = BrightcoveView.extend({ triggerEditMedia: function (event) { event.preventDefault(); + if (event.target.getAttribute('disabled') !== null) { + return; + } wpbc.broadcast.trigger('edit:media', this.model, this.mediaType); }, triggerPreviewMedia: function (event) { event.preventDefault(); + if (event.target.getAttribute('disabled') !== null) { + return; + } var shortcode = $('#shortcode').val(); wpbc.broadcast.trigger('preview:media', this.model, shortcode); }, From 4ed9f2d071a5898864176880be25a3f64a19fd97 Mon Sep 17 00:00:00 2001 From: Burhan Nasir Date: Tue, 6 Feb 2024 20:25:33 +0500 Subject: [PATCH 2/2] Replace a tag with button --- assets/js/src/views/media-details.js | 6 ------ includes/admin/class-bc-templates.php | 14 +++++++------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/assets/js/src/views/media-details.js b/assets/js/src/views/media-details.js index 8c5b41b8..320d2b9d 100644 --- a/assets/js/src/views/media-details.js +++ b/assets/js/src/views/media-details.js @@ -30,17 +30,11 @@ var MediaDetailsView = BrightcoveView.extend({ triggerEditMedia: function (event) { event.preventDefault(); - if (event.target.getAttribute('disabled') !== null) { - return; - } wpbc.broadcast.trigger('edit:media', this.model, this.mediaType); }, triggerPreviewMedia: function (event) { event.preventDefault(); - if (event.target.getAttribute('disabled') !== null) { - return; - } var shortcode = $('#shortcode').val(); wpbc.broadcast.trigger('preview:media', this.model, shortcode); }, diff --git a/includes/admin/class-bc-templates.php b/includes/admin/class-bc-templates.php index 2210404b..353e9f6a 100644 --- a/includes/admin/class-bc-templates.php +++ b/includes/admin/class-bc-templates.php @@ -685,8 +685,8 @@ class="brightcove-datetime brightcove-end-date" <# } #>
- - + +
@@ -724,14 +724,14 @@ class="brightcove-datetime brightcove-end-date"
<# if ('preview' === data.detailsMode) { #> - + <# } else { #> <# if ( data.images && data.images.thumbnail && data.images.thumbnail.src ) { #> - - + + <# } else { #> - - + + <# } #> <# } #>