tj_bootstrap_helper 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,12 +1,23 @@
|
|
1
1
|
module TJBootstrapHelper
|
2
2
|
module Helper
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
# :args: title, size = 1
|
4
|
+
# :args: size = 1, &block
|
5
|
+
def page_header *args, &block
|
6
|
+
if block_given?
|
7
|
+
size = (1..6) === args.first ? args.first : 12
|
8
|
+
content_tag :div, :class => "page-header" do
|
9
|
+
content_tag "h#{size}" do
|
10
|
+
capture(&block)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
else
|
14
|
+
title = args.first
|
15
|
+
size = (1..6) === args.second ? args.second : 1
|
16
|
+
content_tag :div, content_tag("h#{size}", title), :class => "page-header"
|
6
17
|
end
|
7
18
|
end
|
8
19
|
|
9
|
-
# Just like
|
20
|
+
# Just like +link_to+, but wrap with li tag and set +class="active"+
|
10
21
|
# to corresponding page.
|
11
22
|
def nav_li *args, &block
|
12
23
|
options = (block_given? ? args.first : args.second) || {}
|
@@ -17,7 +28,7 @@ module TJBootstrapHelper
|
|
17
28
|
end
|
18
29
|
end
|
19
30
|
|
20
|
-
#
|
31
|
+
# Options
|
21
32
|
# span:: integer between 1..12. Item size.
|
22
33
|
# slice:: integer between 1..12. Items per slice (row).
|
23
34
|
# fluid:: boolean. Whether the div tag is fluid.
|
@@ -43,7 +54,7 @@ module TJBootstrapHelper
|
|
43
54
|
ret
|
44
55
|
end
|
45
56
|
|
46
|
-
#
|
57
|
+
# Options
|
47
58
|
# span:: integer between 1..12. Item size.
|
48
59
|
# slice:: integer between 1..12. Items per slice.
|
49
60
|
# url_method:: string or symbol. URL method of items, default is resources' RESTful URL.
|
@@ -15,6 +15,9 @@
|
|
15
15
|
<ul class="dropdown-menu">
|
16
16
|
<li><a href="#">Profile</a></li>
|
17
17
|
<li class="divider"></li>
|
18
|
+
<%= nav_li "Home", root_path %>
|
19
|
+
<%= nav_li "About", home_about_path %>
|
20
|
+
<%= nav_li "Contact", home_contact_path %>
|
18
21
|
<li><a href="#">Sign Out</a></li>
|
19
22
|
</ul>
|
20
23
|
</div>
|