From cfeb4b4d3d20eb7ec7ca68577c7a8e29e5de1fa8 Mon Sep 17 00:00:00 2001 From: Mojca Lorber Date: Tue, 9 Jun 2020 11:45:03 +0200 Subject: [PATCH 1/4] Fix protocol duplication at saving protocol from task to repository --- .../javascripts/my_modules/protocols.js | 39 +++++++++---------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/app/assets/javascripts/my_modules/protocols.js b/app/assets/javascripts/my_modules/protocols.js index bf028dd1e..aeadf3a6e 100644 --- a/app/assets/javascripts/my_modules/protocols.js +++ b/app/assets/javascripts/my_modules/protocols.js @@ -64,26 +64,26 @@ function initEditDescription() { } function initCopyToRepository() { - var link = $("[data-action='copy-to-repository']"); - var modal = $('#copy-to-repository-modal'); - var modalBody = modal.find('.modal-body'); - var submitBtn = modal.find(".modal-footer [data-action='submit']"); - link - .on('ajax:success', function(e, data) { - modalBody.html(data.html); - modalBody.find("[data-role='copy-to-repository']") + var link = "[data-action='copy-to-repository']"; + var modal = '#copy-to-repository-modal'; + var modalBody = '.modal-body'; + var submitBtn = ".modal-footer [data-action='submit']"; + $('.my-modules-protocols-index') + .on('ajax:success', link, function(e, data) { + $(modal).find(modalBody).html(data.html); + $(modal).find(modalBody).find("[data-role='copy-to-repository']") .on('ajax:success', function(e2, data2) { if (data2.refresh !== null) { // Reload page location.reload(); } else { // Simply hide the modal - modal.modal('hide'); + $(modal).modal('hide'); } }) .on('ajax:error', function(e2, data2) { // Display errors in form - submitBtn[0].disabled = false; + $(modal).find(submitBtn)[0].disabled = false; if (data2.status === 422) { $(this).renderFormErrors('protocol', data2.responseJSON); } else { @@ -92,18 +92,18 @@ function initCopyToRepository() { } }); - modal.modal('show'); - submitBtn[0].disabled = false; + $(modal).modal('show'); + $(modal).find(submitBtn)[0].disabled = false; }) .on('ajax:error', function() {}); - submitBtn.on('click', function() { + $(modal).on('click', submitBtn, function() { // Submit the embedded form - submitBtn[0].disabled = true; - modalBody.find('form').submit(); + $(modal).find(submitBtn)[0].disabled = true; + $(modal).find('form').submit(); }); - modalBody.on('click', "[data-role='link-check']", function() { + $(modal).find(modalBody).on('click', "[data-role='link-check']", function() { var text = $(this).closest('.modal-body').find("[data-role='link-text']"); if ($(this).prop('checked')) { text.show(); @@ -112,11 +112,11 @@ function initCopyToRepository() { } }); - modal.on('hidden.bs.modal', function() { - modalBody.find("[data-role='copy-to-repository']") + $(modal).on('hidden.bs.modal', function() { + $(modal).find(modalBody).find("[data-role='copy-to-repository']") .off('ajax:success ajax:error'); - modalBody.html(''); + $(modal).find(modalBody).html(''); }); } @@ -384,7 +384,6 @@ function refreshProtocolStatusBar() { success: function(data) { $('.my-module-protocol-status').replaceWith(data.html); initLinkUpdate(); - initCopyToRepository(); } }); } From 12e48d1f7a750de3e7be13800fc247365efdab11 Mon Sep 17 00:00:00 2001 From: Miha Mencin Date: Thu, 11 Jun 2020 13:25:56 +0200 Subject: [PATCH 2/4] Bump version to 1.9.2 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 66e2ae6c2..836ae4eda 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.19.1 +1.19.2 From 566a8006568a146c6a66f09afa86d5b6c83b82d9 Mon Sep 17 00:00:00 2001 From: Urban Rotnik Date: Thu, 11 Jun 2020 15:31:55 +0200 Subject: [PATCH 3/4] Revert bump to 1.19.2 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 836ae4eda..66e2ae6c2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.19.2 +1.19.1 From 84aacecb818bd9d05a0e0e384f7e3d1f02cb4c20 Mon Sep 17 00:00:00 2001 From: Urban Rotnik Date: Thu, 11 Jun 2020 15:34:10 +0200 Subject: [PATCH 4/4] Bump version to 1.19.2 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 66e2ae6c2..836ae4eda 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.19.1 +1.19.2