Module: ChaltronHelper
- Defined in:
- app/helpers/chaltron_helper.rb
Instance Method Summary collapse
- #back_link(opts = {}) ⇒ Object
-
#bootstrap_class_for(flash_type) ⇒ Object
Flash messages.
- #flash_message(message, type) ⇒ Object
- #ldap_enabled? ⇒ Boolean
-
#revision ⇒ Object
Get current revision.
Instance Method Details
#back_link(opts = {}) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'app/helpers/chaltron_helper.rb', line 26 def back_link(opts = {}) klass = opts[:class] || 'btn btn-primary' text = opts[:text] || t('chaltron.common.back') ic = opts[:icon] || 'arrow-left ' link_to :back, class: klass do icon(:fas, ic, text) end end |
#bootstrap_class_for(flash_type) ⇒ Object
Flash messages
10 11 12 13 14 15 16 17 |
# File 'app/helpers/chaltron_helper.rb', line 10 def bootstrap_class_for(flash_type) { success: 'alert-success', error: 'alert-danger', alert: 'alert-warning', notice: 'alert-info' }[flash_type] || flash_type.to_s end |
#flash_message(message, type) ⇒ Object
19 20 21 22 23 24 |
# File 'app/helpers/chaltron_helper.rb', line 19 def (, type) content_tag(:div, , class: "alert #{bootstrap_class_for(type)} rounded-0") do content_tag(:strong, I18n.t("chaltron.flash.#{type}") + ': ') + end end |
#ldap_enabled? ⇒ Boolean
3 4 5 |
# File 'app/helpers/chaltron_helper.rb', line 3 def ldap_enabled? Devise.omniauth_providers.include? :ldap end |
#revision ⇒ Object
Get current revision
39 40 41 |
# File 'app/helpers/chaltron_helper.rb', line 39 def revision @revision || get_revision_number end |