Module: BootstrapFlashHelper

Defined in:
app/helpers/bootstrap_flash_helper.rb

Instance Method Summary collapse

Instance Method Details

#bootstrap_flashObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/helpers/bootstrap_flash_helper.rb', line 2

def bootstrap_flash
  flash_messages = []
  flash.each do |type, message|
    # Skip Devise :timeout flag
    next if type == :timeout
    type = :success if type == :notice
    type = :error   if type == :alert
    text = (:div, 
             (:button, raw("×"), :class => "close", "data-dismiss" => "alert") +
             message, :class => "alert fade in alert-#{type}")
    flash_messages << text if message
  end
  flash_messages.join("\n").html_safe
end