Add enable and disable element helpers

This commit is contained in:
Paul Chavard 2018-08-28 15:39:42 +01:00
parent 5592817794
commit 14bf543976

View file

@ -44,6 +44,18 @@ module ApplicationHelper
# rubocop:enable Rails/OutputSafety # rubocop:enable Rails/OutputSafety
end end
def disable_element(selector)
# rubocop:disable Rails/OutputSafety
raw("document.querySelector('#{selector}').disabled = true;")
# rubocop:enable Rails/OutputSafety
end
def enable_element(selector)
# rubocop:disable Rails/OutputSafety
raw("document.querySelector('#{selector}').disabled = false;")
# rubocop:enable Rails/OutputSafety
end
def current_email def current_email
current_user&.email || current_user&.email ||
current_gestionnaire&.email || current_gestionnaire&.email ||