Module: FoundationRailsHelperMod::FlashHelper

Defined in:
lib/foundation_rails_helper_mod/flash_helper.rb

Constant Summary collapse

DEFAULT_KEY_MATCHING =

<div class=“alert-box [success alert secondary]”>

This is an alert box.
<a href="" class="close">&times;</a>

</div>

{
  :alert     => :alert,
  :notice    => :success,
  :info      => :standard,
  :secondary => :secondary,
}

Instance Method Summary collapse

Instance Method Details

#display_flash_messages(key_matching = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/foundation_rails_helper_mod/flash_helper.rb', line 15

def display_flash_messages(key_matching = {})
  key_matching = DEFAULT_KEY_MATCHING.merge(key_matching)

  flash.inject "" do |message, (key, value)|
    message +=  :div, :class => "alert-box #{key_matching[key] || :standard}" do
      (value + link_to("&times;".html_safe, "#", :class => :close)).html_safe
    end
  end.html_safe
end