module Interage::FlashMessageHelper

Constants

ALIAS_TYPES

Public Instance Methods

flash_messages() click to toggle source
# File lib/interage/flash_message_helper.rb, line 7
def flash_messages
  messages ||= flashes.map do |type, message|
    bootstrap_alert(handler_type(type), handler_message(message))
  end

  safe_join(messages || [])
end
flashes() click to toggle source
# File lib/interage/flash_message_helper.rb, line 15
def flashes
  flash.to_h.symbolize_keys
end
handler_message(messages) click to toggle source
# File lib/interage/flash_message_helper.rb, line 23
def handler_message(messages)
  return messages unless messages.respond_to?(:map)

  errors = content_tag :ul do
    messages.map do |message|
      concat content_tag(:li, message)
    end
  end

  safe_join [errors]
end
handler_type(type) click to toggle source
# File lib/interage/flash_message_helper.rb, line 19
def handler_type(type)
  ALIAS_TYPES[type] || type
end