Merge pull request #3766 from tchak/fix-sentry-bug
Do not crash if element to remove is not found
This commit is contained in:
commit
ca5f31e374
2 changed files with 2 additions and 1 deletions
|
@ -53,7 +53,7 @@ module ApplicationHelper
|
|||
script = "(function() {";
|
||||
script << "var el = document.querySelector('#{selector}');"
|
||||
method = (inner ? "el.innerHTML = ''" : "el.parentNode.removeChild(el)")
|
||||
script << "setTimeout(function() { #{method}; }, #{timeout});";
|
||||
script << "if (el) { setTimeout(function() { #{method}; }, #{timeout}); }";
|
||||
script << "})();"
|
||||
# rubocop:disable Rails/OutputSafety
|
||||
raw(script);
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
<%= render_flash(timeout: 5000, sticky: true) %>
|
||||
<%= remove_element("#piece_justificative_#{@champ.id}") %>
|
||||
<%= show_element("#champs_#{@champ.id}") %>
|
||||
|
|
Loading…
Reference in a new issue