Module: WeixinPam::ApplicationHelper

Includes:
FontAwesome::Rails::IconHelper
Defined in:
app/helpers/weixin_pam/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#bootstrap_class_for(flash_type) ⇒ Object



4
5
6
# File 'app/helpers/weixin_pam/application_helper.rb', line 4

def bootstrap_class_for flash_type
  { success: "alert-success", error: "alert-danger", alert: "alert-warning", notice: "alert-info" }[flash_type.intern] || flash_type.to_s
end

#flash_messages(opts = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'app/helpers/weixin_pam/application_helper.rb', line 8

def flash_messages(opts = {})
  flash.each do |msg_type, message|
    concat((:div, message, class: "alert #{bootstrap_class_for(msg_type)} fade in") do 
      concat (:button, 'x', class: "close", data: { dismiss: 'alert' })
      concat message 
    end)
  end
  nil
end