10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'app/helpers/bootstrap_flash_helper.rb', line 10
def bootstrap_flash(options = { :close_button => true })
flash_messages = []
flash.each do |type, message|
next if message.blank?
type = type.to_sym
next unless ALERT_MAPPING.keys.include?(type)
tag_class = options.(:class)[:class]
tag_options = {
class: "alert fade in alert-#{ALERT_MAPPING[type]} #{tag_class}"
}.merge(options)
close_button = ""
if options[:close_button]
close_button = content_tag(:button, raw("×"), type: "button", class: "close", "data-dismiss" => "alert")
end
Array(message).each do |msg|
text = content_tag(:div, close_button + msg, tag_options)
flash_messages << text if msg
end
end
flash_messages.join("\n").html_safe
end
|