twitter-bootstrap-helpers 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -4,4 +4,32 @@ module TwitterBootstrapHelpers
|
|
4
4
|
content_tag :i, '', :class => "icon-#{icon_name}"
|
5
5
|
end
|
6
6
|
end
|
7
|
+
|
8
|
+
def alert_message(opts = {}, &block)
|
9
|
+
alert_classes = ["alert"]
|
10
|
+
alert_classes << "alert-#{opts[:type]}" if opts[:type]
|
11
|
+
alert_classes << opts[:class] if opts[:class]
|
12
|
+
|
13
|
+
contents = capture(&block)
|
14
|
+
|
15
|
+
if opts[:heading]
|
16
|
+
alert_classes << "alert-block"
|
17
|
+
contents = alert_heading_tag + contents
|
18
|
+
end
|
19
|
+
|
20
|
+
if opts[:show_close_button]
|
21
|
+
contents = alert_close_tag + contents
|
22
|
+
end
|
23
|
+
|
24
|
+
content_tag :div, contents, :class => alert_classes.join(' ')
|
25
|
+
end
|
26
|
+
|
27
|
+
def alert_close_tag
|
28
|
+
content_tag(:a, 'x', :class => 'close', :data => {:dismiss => 'alert'})
|
29
|
+
end
|
30
|
+
|
31
|
+
def alert_heading_tag(heading)
|
32
|
+
contents = content_tag(:h4, heading, :class => 'alert-heading')
|
33
|
+
end
|
34
|
+
|
7
35
|
end
|