Module: HomePage::ApplicationHelper

Defined in:
app/helpers/home_page/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#bootstrap_flash_rawObject

Taken from github.com/seyhunak/twitter-bootstrap-rails Modified to support html in flash message



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/helpers/home_page/application_helper.rb', line 5

def bootstrap_flash_raw
  flash_messages = []
  
  flash.each do |type, message|
    flash.delete(type)
    
    # Skip Devise :timeout and :timedout flags
    next if type == :timeout
    next if type == :timedout
    
    content =  type.to_s == "filter" ? "" : (:button, raw("×"), :class => "close", "data-dismiss" => "alert")
    type = :success if ["notice", "filter"].include? type.to_s
    type = :danger   if ["alert", "error", "recaptcha_error"].include? type.to_s
    content += raw(message)
    text = (:div, content, :class => "alert fade in alert-#{type}") 
    flash_messages << text if message
  end
  
  flash_messages.join("\n").html_safe
end