i18n_rails_helpers 1.4.7 → 1.4.8
Sign up to get free protection for your applications and to get access to all the features.
- data/app/helpers/bootstrap_helper.rb +13 -1
- data/lib/i18n_rails_helpers/version.rb +1 -1
- metadata +1 -1
@@ -55,6 +55,18 @@ module BootstrapHelper
|
|
55
55
|
|
56
56
|
# Messages
|
57
57
|
# ========
|
58
|
+
# Map common rails flash types to bootstrap alert names.
|
59
|
+
def boot_alert_name(type)
|
60
|
+
case type
|
61
|
+
when 'alert'
|
62
|
+
'danger'
|
63
|
+
when 'notice'
|
64
|
+
'info'
|
65
|
+
else
|
66
|
+
type
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
58
70
|
def boot_alert(*args, &block)
|
59
71
|
if block_given?
|
60
72
|
type = args[0]
|
@@ -65,7 +77,7 @@ module BootstrapHelper
|
|
65
77
|
end
|
66
78
|
|
67
79
|
type ||= 'info'
|
68
|
-
content_tag(:div, :class => "alert alert
|
80
|
+
content_tag(:div, :class => "alert alert-#{boot_alert_name(type)}") do
|
69
81
|
link_to('×'.html_safe, '#', :class => 'close', 'data-dismiss' => 'alert') + content
|
70
82
|
end
|
71
83
|
end
|