Module: Interage::FlashMessageHelper
- Included in:
- ApplicationHelper
- Defined in:
- lib/interage/flash_message_helper.rb
Constant Summary collapse
- ALIAS_TYPES =
{ notice: 'success', alert: 'info', error: 'danger' }.freeze
Instance Method Summary collapse
- #flash_messages ⇒ Object
- #flashes ⇒ Object
- #handler_message(messages) ⇒ Object
- #handler_type(type) ⇒ Object
Instance Method Details
#flash_messages ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/interage/flash_message_helper.rb', line 7 def ||= flashes.map do |type, | bootstrap_alert(handler_type(type), ()) end safe_join( || []) end |
#flashes ⇒ Object
15 16 17 |
# File 'lib/interage/flash_message_helper.rb', line 15 def flashes flash.to_h.symbolize_keys end |
#handler_message(messages) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/interage/flash_message_helper.rb', line 23 def () return unless .respond_to?(:map) errors = content_tag :ul do .map do || concat content_tag(:li, ) end end safe_join [errors] end |
#handler_type(type) ⇒ Object
19 20 21 |
# File 'lib/interage/flash_message_helper.rb', line 19 def handler_type(type) ALIAS_TYPES[type] || type end |