diff --git a/app/assets/javascripts/protocols/steps.js.erb b/app/assets/javascripts/protocols/steps.js.erb index 3c7a501ae..ef9fb25bd 100644 --- a/app/assets/javascripts/protocols/steps.js.erb +++ b/app/assets/javascripts/protocols/steps.js.erb @@ -79,6 +79,7 @@ function applyCancelCallBack() { setTimeout(function() { initStepsComments(); + SmartAnnotation.preventPropagation('.atwho-user-popover'); TinyMCE.destroyAll(); }, 1000); @@ -182,6 +183,7 @@ function formCallback($form) { setTimeout(function() { initStepsComments(); + SmartAnnotation.preventPropagation('.atwho-user-popover'); }, 1000); return true; }); @@ -205,6 +207,7 @@ function formEditAjax($form) { toggleButtons(true); TinyMCE.destroyAll(); + SmartAnnotation.preventPropagation('.atwho-user-popover'); // Show the edited step $new_step.find(".panel-collapse:first").addClass("collapse in"); @@ -221,6 +224,8 @@ function formEditAjax($form) { applyCancelCallBack(); TinyMCE.refresh(); + SmartAnnotation.preventPropagation('.atwho-user-popover'); + //Rerender tables $form.find("[data-role='step-hot-table']").each(function() { renderTable($(this)); @@ -247,6 +252,8 @@ function formNewAjax($form) { TinyMCE.init(); TinyMCE.highlight(); + SmartAnnotation.preventPropagation('.atwho-user-popover'); + //Rerender tables $new_step.find("div.step-result-hot-table").each(function() { $(this).handsontable("render"); @@ -264,6 +271,7 @@ function formNewAjax($form) { formNewAjax($form); applyCancelOnNew(); TinyMCE.destroyAll(); + SmartAnnotation.preventPropagation('.atwho-user-popover'); }); } @@ -576,6 +584,7 @@ $(document).ready(function() { setupAssetsLoading(); initStepsComments(); TinyMCE.highlight(); + SmartAnnotation.preventPropagation('.atwho-user-popover'); $(function () { diff --git a/app/assets/javascripts/sitewide/atwho_res.js.erb b/app/assets/javascripts/sitewide/atwho_res.js.erb index d7fe7fe15..61ba63d2a 100644 --- a/app/assets/javascripts/sitewide/atwho_res.js.erb +++ b/app/assets/javascripts/sitewide/atwho_res.js.erb @@ -21,6 +21,14 @@ var SmartAnnotation = (function() { return publicApi; })(); + // stop the user annotation popover on click propagation + function atwhoStopPropagation(element) { + $(element).on('click', function(e) { + e.stopPropagation(); + e.preventDefault(); + }); + } + function setAtWho(field) { var FilterTypeEnum = Object.freeze({ USER: {tag: "users", @@ -422,9 +430,10 @@ var SmartAnnotation = (function() { atWho.init(); } - var publicApi = { - init: initialize - }; + var publicApi = Object.freeze({ + init: initialize, + preventPropagation: atwhoStopPropagation + }); return publicApi; diff --git a/app/assets/stylesheets/themes/scinote.scss b/app/assets/stylesheets/themes/scinote.scss index 75d3d4ca0..2bb0847e4 100644 --- a/app/assets/stylesheets/themes/scinote.scss +++ b/app/assets/stylesheets/themes/scinote.scss @@ -1916,3 +1916,7 @@ th.custom-field .modal-tooltiptext { word-wrap: break-word; } } + +.popover-remove { + cursor: pointer; +}