This repository has been archived on 2023-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
2018-11-22 19:58:12 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-11-22 19:33:08 +00:00
|
|
|
module ApplicationHelper
|
2019-06-23 15:59:44 +00:00
|
|
|
def federal_subjects_controller?
|
|
|
|
controller_path == 'federal_subjects'
|
2019-03-27 05:47:21 +00:00
|
|
|
end
|
|
|
|
|
2019-03-27 03:23:23 +00:00
|
|
|
def staff_controller?
|
|
|
|
controller_path.start_with?('staff')
|
|
|
|
end
|
|
|
|
|
2019-07-22 18:46:57 +00:00
|
|
|
def translate_enum(type, value)
|
|
|
|
translate value, scope: [:enums, type]
|
|
|
|
end
|
|
|
|
|
2019-08-15 08:34:48 +00:00
|
|
|
def open_action(url)
|
|
|
|
link_to url, role: :button, class: 'btn btn-light btn-sm' do
|
|
|
|
concat tag.i class: 'far fa-eye'
|
|
|
|
concat ' '.html_safe
|
|
|
|
concat translate :open_action
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-12-03 17:58:39 +00:00
|
|
|
def bootstrap_class_for_flash(flash_type)
|
|
|
|
case flash_type
|
|
|
|
when 'success'
|
|
|
|
'alert-success'
|
2018-12-14 02:13:49 +00:00
|
|
|
when 'error', 'recaptcha_error'
|
2018-12-03 17:58:39 +00:00
|
|
|
'alert-danger'
|
|
|
|
when 'alert'
|
|
|
|
'alert-warning'
|
|
|
|
else
|
|
|
|
'alert-info'
|
|
|
|
end
|
|
|
|
end
|
2018-11-22 19:33:08 +00:00
|
|
|
end
|