From 1a9fca87d2568b7042677df6f59f77d16c3a19bd Mon Sep 17 00:00:00 2001 From: Jure Grabnar Date: Fri, 28 Jun 2019 08:49:12 +0200 Subject: [PATCH] Fix non-existent protocol-card in preview banner --- app/assets/javascripts/protocols/external_protocols_tab.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/assets/javascripts/protocols/external_protocols_tab.js b/app/assets/javascripts/protocols/external_protocols_tab.js index 9af1e0eba..39abd01d2 100644 --- a/app/assets/javascripts/protocols/external_protocols_tab.js +++ b/app/assets/javascripts/protocols/external_protocols_tab.js @@ -165,6 +165,11 @@ function handleFormSubmit(modal) { function initLoadProtocolModalPreview() { $('.external-import-btn').off('click').on('click', function(e) { var link = $(this).parents('.protocol-card'); + + // When clicking on the banner button, we have no protocol-card parent + if (link.length == 0) + link = $('.protocol-card.active'); + animateSpinner(null, true); $.ajax({ url: link.data('url'),