bootstrap-view-helpers 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +144 -13
- data/app/helpers/bootstrap/accordion_helper.rb +36 -2
- data/app/helpers/bootstrap/badge_helper.rb +17 -7
- data/app/helpers/bootstrap/button_helper.rb +87 -39
- data/app/helpers/bootstrap/common_helper.rb +47 -26
- data/app/helpers/bootstrap/dropdown_helper.rb +48 -22
- data/app/helpers/bootstrap/form_helper.rb +51 -11
- data/app/helpers/bootstrap/nav_helper.rb +125 -0
- data/app/helpers/bootstrap/stamp_helper.rb +21 -17
- data/app/views/bootstrap_view_helpers/index.html.erb +105 -1
- data/lib/bootstrap-view-helpers/version.rb +1 -1
- metadata +84 -2
data/README.md
CHANGED
@@ -4,16 +4,28 @@ This gem provides helper methods for various Bootstrap components.
|
|
4
4
|
|
5
5
|
Includes support for:
|
6
6
|
|
7
|
+
* navigation
|
8
|
+
* nav bar
|
9
|
+
* nav list
|
7
10
|
* buttons
|
8
11
|
* `<button>`
|
9
12
|
* `<a>` styled as button
|
13
|
+
* button groups
|
14
|
+
* button toolbars
|
10
15
|
* labels and badges
|
11
16
|
* dropdowns
|
12
17
|
* nav dropdowns
|
13
18
|
* button dropdowns
|
14
19
|
* split-button dropdowns
|
15
20
|
* accordion
|
21
|
+
* form helpers
|
22
|
+
* submit_tag_button
|
16
23
|
|
24
|
+
## Note
|
25
|
+
|
26
|
+
This is a new gem undergoing a lot of change. There is a chance that some backwards
|
27
|
+
compatibility will be broken until things settle down.
|
28
|
+
|
17
29
|
## Installation
|
18
30
|
|
19
31
|
Add it to your Gemfile:
|
@@ -28,25 +40,93 @@ Run bundler:
|
|
28
40
|
bundle install
|
29
41
|
```
|
30
42
|
|
43
|
+
## API Documentation
|
44
|
+
|
45
|
+
Complete [API documentation](http://rubydoc.info/gems/bootstrap-view-helpers/frames/file/README.md) at [RubyGems.org](https://rubygems.org/).
|
46
|
+
|
31
47
|
## Examples
|
32
48
|
|
33
|
-
###
|
49
|
+
### Navigation
|
34
50
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
51
|
+
#### Navigation Bar
|
52
|
+
```
|
53
|
+
<%= nav_bar do %>
|
54
|
+
|
55
|
+
<%= brand('Span Brand')%>
|
56
|
+
<%= brand('Link Brand', url: '#')%>
|
57
|
+
|
58
|
+
<%= nav_bar_links do %>
|
59
|
+
|
60
|
+
<%= nav_bar_link('Active', '#', active: true) %>
|
61
|
+
<%= nav_bar_link('Link1', '/link1') %>
|
62
|
+
|
63
|
+
<%= nav_bar_divider %>
|
64
|
+
|
65
|
+
<%= nav_dropdown('Foo') do %>
|
66
|
+
<%= dropdown_item('One', 'foo')%>
|
67
|
+
<% end %>
|
68
|
+
|
69
|
+
<% end %>
|
70
|
+
<% end %>
|
71
|
+
```
|
72
|
+
|
73
|
+
#### Navigation List (sidebar)
|
43
74
|
```erb
|
44
|
-
<%=
|
45
|
-
<%=
|
46
|
-
<%=
|
75
|
+
<%= nav_list(id: 'my') do %>
|
76
|
+
<%= nav_list_header('Buttons & Labels') %>
|
77
|
+
<%= dropdown_item('Buttons', 'butons')%>
|
78
|
+
<%= dropdown_item('Labels', 'butons')%>
|
79
|
+
<% end %>
|
80
|
+
```
|
81
|
+
|
82
|
+
### Buttons
|
83
|
+
|
84
|
+
```ruby
|
85
|
+
# button
|
86
|
+
button('Default')
|
87
|
+
|
88
|
+
# add url option to make <a> styled as button
|
89
|
+
button('Home', url: '/')
|
90
|
+
|
91
|
+
# a button styled as a link
|
92
|
+
button('Home', :link)
|
93
|
+
|
94
|
+
# give it a type; see BUTTON_TYPES
|
95
|
+
button('Info', :info)
|
96
|
+
|
97
|
+
# give it a size (see BUTTON_SIZES)
|
98
|
+
button('Small', :small)
|
99
|
+
|
100
|
+
# size, type, additional class and additional html attributes
|
101
|
+
button('Warning', :warning, :large, id: 'warn-id', class: 'more-class', my_key: 'my_value')
|
102
|
+
```
|
103
|
+
|
104
|
+
### Button Groups
|
105
|
+
|
106
|
+
```erb
|
107
|
+
<%= button_group do %>
|
108
|
+
<%= button("Left", url: "/left") %>
|
109
|
+
<%= button("Right", id: 'right') %>
|
110
|
+
<% end %>
|
111
|
+
```
|
112
|
+
|
113
|
+
### Button Toolbars
|
114
|
+
|
115
|
+
```erb
|
116
|
+
<%= button_toolbar do %>
|
117
|
+
<%= button('Single Button', url: '/single') %>
|
118
|
+
<%= button_group do %>
|
119
|
+
<%= button('Group Button 1') %>
|
120
|
+
<%= button('Group Button 2') %>
|
121
|
+
<% end %>
|
122
|
+
<%= button('Another Single') %>
|
123
|
+
<% end %>
|
47
124
|
```
|
125
|
+
### Labels and Badges
|
48
126
|
|
49
|
-
|
127
|
+
http://twitter.github.io/bootstrap/components.html#labels-badges
|
128
|
+
|
129
|
+
#### Labels (Stamps)
|
50
130
|
|
51
131
|
Because `label` is a Rails helper method we use `stamp` -- because Elle thinks it looks like a stamp.
|
52
132
|
|
@@ -63,4 +143,55 @@ Supports the Bootstrap label types:
|
|
63
143
|
<%= stamp('Info', :info) %>
|
64
144
|
<%= stamp('Warning', :warning, id: 'warn-id', class: 'more-class', my_key: 'my_value') %>
|
65
145
|
```
|
146
|
+
|
147
|
+
#### Badges
|
148
|
+
Supports the Bootstrap badge types:
|
149
|
+
* default
|
150
|
+
* success
|
151
|
+
* warning
|
152
|
+
* important
|
153
|
+
* info
|
154
|
+
* inverse
|
155
|
+
|
156
|
+
```erb
|
157
|
+
<%= badge('Default') %>
|
158
|
+
<%= badge('Info', :info) %>
|
159
|
+
<%= badge('Warning', :warning, id: 'warn-id', class: 'more-class', my_key: 'my_value') %>
|
160
|
+
```
|
161
|
+
|
162
|
+
|
163
|
+
### Accordions
|
164
|
+
|
165
|
+
See: http://twitter.github.io/bootstrap/javascript.html#collapse
|
166
|
+
|
167
|
+
```erb
|
168
|
+
<%= accordion do %>
|
169
|
+
|
170
|
+
<%= accordion_group('Section 1', open: true) do %>
|
171
|
+
content for group 1
|
172
|
+
<% end >
|
173
|
+
|
174
|
+
<%= accordion_group('Section 1') do %>
|
175
|
+
content for group 2
|
176
|
+
<% end %>
|
177
|
+
|
178
|
+
<% end %>
|
179
|
+
```
|
180
|
+
|
181
|
+
### Form Helpers
|
182
|
+
|
183
|
+
#### submit_tag_button
|
184
|
+
|
185
|
+
Returns <input> similar to +#submit_tag()+ but:
|
186
|
+
* styled like a Bootstrap button, type `:primary`
|
187
|
+
* has `:disable_with` set to "Processing ..."
|
66
188
|
|
189
|
+
```ruby
|
190
|
+
submit_button_tag # => <input class="btn btn-primary" data-disable-with="Processing ..." name="commit" type="submit" value="Save changes" />
|
191
|
+
submit_button_tag('Save')
|
192
|
+
submit_button_tag('Delete', :danger)
|
193
|
+
submit_button_tag('Big', :large)
|
194
|
+
submit_button_tag('With Options', :small, :info, id: 'my-id')
|
195
|
+
```
|
196
|
+
|
197
|
+
|
@@ -1,6 +1,29 @@
|
|
1
|
+
# Rails helpers for building Bootstrap accordions.
|
2
|
+
#
|
3
|
+
# See: http://twitter.github.io/bootstrap/javascript.html#collapse
|
4
|
+
#
|
5
|
+
# <%= accordion do %>
|
6
|
+
#
|
7
|
+
# <%= accordion_group('Section 1', open: true) do %>
|
8
|
+
# content for group 1
|
9
|
+
# <% end >
|
10
|
+
#
|
11
|
+
# <%= accordion_group('Section 1') do %>
|
12
|
+
# content for group 2
|
13
|
+
# <% end %>
|
14
|
+
#
|
15
|
+
# <% end %>
|
16
|
+
#
|
1
17
|
module Bootstrap::AccordionHelper
|
2
18
|
|
19
|
+
# Returns the outer html for a Bootstrap accordion.
|
20
|
+
#
|
21
|
+
# @param [Hash] options html attributes for accordion <div>
|
22
|
+
# @return [String] accordion html
|
23
|
+
# @yield Should contain calls to {Bootstrap::AccordionHelper#accordion_group}
|
24
|
+
# @yieldreturn [String] Html from {Bootstrap::AccordionHelper#accordion_group} calls
|
3
25
|
def accordion(options={})
|
26
|
+
options = canonicalize_options(options)
|
4
27
|
options = ensure_accordion_id(options)
|
5
28
|
@accordion_id = options[:id]
|
6
29
|
options = ensure_class(options, 'accordion')
|
@@ -10,12 +33,23 @@ module Bootstrap::AccordionHelper
|
|
10
33
|
end
|
11
34
|
end
|
12
35
|
|
36
|
+
# Returns the html for a Bootstrap accordion group.
|
37
|
+
#
|
38
|
+
# @param [String] text the text in the accordion group header
|
39
|
+
# @param [Hash] options All keys except +:open+ become html attributes for the accordion group
|
40
|
+
# @option options [true] :open Set to +true+ if you want this group initially open
|
41
|
+
# @yield Html contents of accordion group
|
42
|
+
# @yieldreturn [String] Html for accordion group contents
|
13
43
|
def accordion_group(text, options={})
|
44
|
+
options = canonicalize_options(options)
|
45
|
+
open = options.delete(:open)
|
46
|
+
|
14
47
|
options = ensure_accordion_group_id(options)
|
15
48
|
@accordion_group_id = options[:id]
|
16
|
-
|
49
|
+
|
50
|
+
options = ensure_class(options, 'accordion-group')
|
17
51
|
|
18
|
-
content_tag(:div,
|
52
|
+
content_tag(:div, options) do
|
19
53
|
accordion_group_heading(text) + accordion_group_body(open) { yield }
|
20
54
|
end
|
21
55
|
end
|
@@ -1,17 +1,14 @@
|
|
1
|
+
# Rails helper for producing Twitter Bootstrap badges
|
2
|
+
#
|
1
3
|
# See: http://twitter.github.io/bootstrap/components.html#labels-badges
|
2
4
|
#
|
3
|
-
# Helper for producing Twitter Bootstrap badges
|
4
|
-
#
|
5
5
|
# Default badge:
|
6
6
|
#
|
7
|
+
# @example
|
7
8
|
# badge('Default')
|
8
9
|
#
|
9
|
-
# Other badges (see BADGE_TYPES):
|
10
|
-
#
|
11
10
|
# badge('Info', :info)
|
12
11
|
#
|
13
|
-
# Options passed through to <span> tag:
|
14
|
-
#
|
15
12
|
# badge('Warning', :warning, id: 'warn-id', class: 'more-class', my_key: 'my_value')
|
16
13
|
#
|
17
14
|
module Bootstrap::BadgeHelper
|
@@ -19,6 +16,19 @@ module Bootstrap::BadgeHelper
|
|
19
16
|
|
20
17
|
BADGE_TYPES = %w(default success warning important info inverse)
|
21
18
|
|
19
|
+
# Returns html for a Bootstrap badge.
|
20
|
+
#
|
21
|
+
# @overload badge(text, options={})
|
22
|
+
# Returns html for +default+ badge
|
23
|
+
# @param [String] text Text of badge
|
24
|
+
# @param [Hash] options Html attributes for badge <span>
|
25
|
+
# @overload badge(text, badge_type, options={})
|
26
|
+
# Returns html for badge of type _badge_type_
|
27
|
+
# @param [String] text Text of badge
|
28
|
+
# @param [String, Symbol] badge_type one of BADGE_TYPES
|
29
|
+
# @param [Hash] options Html attributes for badge <span>
|
30
|
+
# @return [String] html for badge
|
31
|
+
# @raise [InvalidBadgeTypeError] When a badge type is passed and isn't one of the BADGE_TYPES
|
22
32
|
def badge(*args)
|
23
33
|
text = args.shift
|
24
34
|
options = add_badge_classes(*args)
|
@@ -28,7 +38,7 @@ module Bootstrap::BadgeHelper
|
|
28
38
|
private
|
29
39
|
|
30
40
|
def add_badge_classes(*args)
|
31
|
-
options = args.extract_options!
|
41
|
+
options = canonicalize_options(args.extract_options!)
|
32
42
|
validate_badge_types(args)
|
33
43
|
classes = ['badge'] + args.map { |arg| "badge-#{arg}" }
|
34
44
|
ensure_class(options, classes)
|
@@ -1,43 +1,44 @@
|
|
1
1
|
# Helper for producing Twitter Bootstrap buttons OR links that look like buttons.
|
2
|
-
# See: http://twitter.github.io/bootstrap/base-css.html#buttons
|
3
2
|
#
|
4
|
-
#
|
3
|
+
# See:
|
4
|
+
# * http://twitter.github.io/bootstrap/base-css.html#buttons
|
5
|
+
# * http://twitter.github.io/bootstrap/components.html#buttonGroups
|
6
|
+
# * http://twitter.github.io/bootstrap/components.html#buttonDropdowns
|
7
|
+
# @example Button / Link
|
5
8
|
#
|
6
|
-
#
|
9
|
+
# # button
|
10
|
+
# button('Default')
|
7
11
|
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
# button('Home', url: '/home') #=> <a href="/home" class="btn">Home</a>
|
11
|
-
#
|
12
|
-
# Or make a <button> look like a link:
|
12
|
+
# # add url option to make <a> styled as button
|
13
|
+
# button('Home', url: '/')
|
13
14
|
#
|
15
|
+
# # a button styled as a link
|
14
16
|
# button('Home', :link)
|
15
17
|
#
|
16
|
-
#
|
17
|
-
#
|
18
|
+
# # give it a type; see BUTTON_TYPES
|
18
19
|
# button('Info', :info)
|
19
20
|
#
|
20
|
-
#
|
21
|
-
#
|
21
|
+
# # give it a size (see BUTTON_SIZES)
|
22
22
|
# button('Small', :small)
|
23
23
|
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
29
|
-
#
|
30
|
-
#
|
31
|
-
#
|
32
|
-
#
|
33
|
-
#
|
34
|
-
#
|
35
|
-
#
|
36
|
-
#
|
37
|
-
#
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
24
|
+
# # size, type, additional class and additional html attributes
|
25
|
+
# button('Warning', :warning, :large, id: 'warn-id', class: 'more-class', my_key: 'my_value')
|
26
|
+
#
|
27
|
+
# @example Button Group
|
28
|
+
# <%= button_group do %>
|
29
|
+
# <%= button("Left", url: "/left") %>
|
30
|
+
# <%= button("Right", id: 'right') %>
|
31
|
+
# <% end %>
|
32
|
+
#
|
33
|
+
# @example Button Toolbar
|
34
|
+
# <%= button_toolbar do %>
|
35
|
+
# <%= button('Single Button', url: '/single') %>
|
36
|
+
# <%= button_group do %>
|
37
|
+
# <%= button('Group Button 1') %>
|
38
|
+
# <%= button('Group Button 2') %>
|
39
|
+
# <% end %>
|
40
|
+
# <%= button('Another Single') %>
|
41
|
+
# <% end %>
|
41
42
|
module Bootstrap::ButtonHelper
|
42
43
|
InvalidButtonModifierError = Class.new(StandardError)
|
43
44
|
|
@@ -47,9 +48,36 @@ module Bootstrap::ButtonHelper
|
|
47
48
|
|
48
49
|
BUTTON_ALL = BUTTON_TYPES + BUTTON_SIZES + BUTTON_OTHERS
|
49
50
|
|
51
|
+
# Returns <button> or <a> styled as Bootstrap button
|
52
|
+
#
|
53
|
+
# @overload button(text, options={})
|
54
|
+
# Default button
|
55
|
+
# @param [String] text text of button
|
56
|
+
# @param [Hash] options All keys except +:url+ become html attributes for the generated tag
|
57
|
+
# @option options [String] :url if present, return a <a> styled as a button
|
58
|
+
# @overload button(text, type, options={})
|
59
|
+
# Button of type _type_
|
60
|
+
# @param [String] text text of button
|
61
|
+
# @param [String, Symbol] type type of button; see {Bootstrap::ButtonHelper::BUTTON_TYPES}
|
62
|
+
# @param [Hash] options All keys except +:url+ become html attributes for the generated tag
|
63
|
+
# @option options [String] :url if present, return a <a> styled as a button
|
64
|
+
# @overload button(text, size, options={})
|
65
|
+
# Button of size _size_
|
66
|
+
# @param [String] text text of button
|
67
|
+
# @param [String, Symbol] size size of button; see {Bootstrap::ButtonHelper::BUTTON_SIZES}
|
68
|
+
# @param [Hash] options All keys except +:url+ become html attributes for the generated tag
|
69
|
+
# @option options [String] :url if present, return a <a> styled as a button
|
70
|
+
# @overload button(text, type, size, options={})
|
71
|
+
# Button of type _type_, size _size_
|
72
|
+
# @param [String] text text of button
|
73
|
+
# @param [String, Symbol] type type of button; see {Bootstrap::ButtonHelper::BUTTON_TYPES}
|
74
|
+
# @param [String, Symbol] size size of button; see {Bootstrap::ButtonHelper::BUTTON_SIZES}
|
75
|
+
# @param [Hash] options All keys except +:url+ become html attributes for the generated tag
|
76
|
+
# @option options [String] :url if present, return a <a> styled as a button
|
77
|
+
# @return [String] Html for a <button> (or <a> if +url+ option passed in)
|
50
78
|
def button(*args)
|
51
79
|
text = args.shift
|
52
|
-
options = args.extract_options!
|
80
|
+
options = canonicalize_options(args.extract_options!)
|
53
81
|
href = options.delete(:url)
|
54
82
|
options = add_button_classes(options, args)
|
55
83
|
|
@@ -60,28 +88,48 @@ module Bootstrap::ButtonHelper
|
|
60
88
|
end
|
61
89
|
end
|
62
90
|
|
63
|
-
|
64
|
-
|
91
|
+
# Returns a Bootstrap button toolbar
|
92
|
+
#
|
93
|
+
# @param [Hash] options will be come html attributes of generated <div>
|
94
|
+
# @yield block usually consists of calls to {Bootstrap::ButtonHelper#button} or {Bootstrap::ButtonHelper#button_group}
|
95
|
+
# @yieldreturn [String] html for contents of toolbar
|
96
|
+
#
|
97
|
+
# @return [String] html for button toolbar
|
98
|
+
def button_toolbar(options={})
|
99
|
+
options = canonicalize_options(options)
|
100
|
+
options = ensure_class(options, 'btn-toolbar')
|
101
|
+
|
102
|
+
content_tag(:div, options) do
|
65
103
|
yield
|
66
104
|
end
|
67
105
|
end
|
68
106
|
|
69
|
-
|
70
|
-
|
107
|
+
# Returns a Bootstrap button group
|
108
|
+
#
|
109
|
+
# @param [Hash] options will be come html attributes of generated <div>
|
110
|
+
# @yield block usually consists of calls to {Bootstrap::ButtonHelper#button}
|
111
|
+
# @yieldreturn [String] html for contents of group
|
112
|
+
#
|
113
|
+
# @return [String] html for button group
|
114
|
+
def button_group(options={})
|
115
|
+
options = canonicalize_options(options)
|
116
|
+
options = ensure_class(options, 'btn-group')
|
117
|
+
|
118
|
+
content_tag(:div, options) do
|
71
119
|
yield
|
72
120
|
end
|
73
121
|
end
|
74
122
|
|
123
|
+
def validate_button_types_and_sizes(types_and_sizes)
|
124
|
+
types_and_sizes.each { |e| raise(InvalidButtonModifierError, e.inspect) unless BUTTON_ALL.include?(e.to_s) }
|
125
|
+
end
|
126
|
+
|
75
127
|
private
|
76
128
|
|
77
129
|
def add_button_classes(options, button_types_and_sizes)
|
78
|
-
|
130
|
+
validate_button_types_and_sizes(button_types_and_sizes)
|
79
131
|
classes = ['btn'] + button_types_and_sizes.map { |e| "btn-#{e}" }
|
80
132
|
ensure_class(options, classes)
|
81
133
|
end
|
82
134
|
|
83
|
-
def validate_types_and_sizes(types_and_sizes)
|
84
|
-
types_and_sizes.each { |e| raise(InvalidButtonModifierError, e.inspect) unless BUTTON_ALL.include?(e.to_s) }
|
85
|
-
end
|
86
|
-
|
87
135
|
end
|
@@ -1,52 +1,73 @@
|
|
1
|
+
# Utililty methods used by Bootstrap::*Heler classes
|
1
2
|
module Bootstrap::CommonHelper
|
2
3
|
ArgumentError = Class.new(::ArgumentError)
|
3
4
|
|
4
|
-
# Returns a new
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
|
10
|
-
def arrayify_class(hash)
|
5
|
+
# Returns a new Hash with:
|
6
|
+
# * keys converted to Symbols
|
7
|
+
# * the +:class+ key has it value converted to an Array of String
|
8
|
+
# @raise [ArgumentError] if _hash_ is not a Hash
|
9
|
+
# @return [Hash]
|
10
|
+
def canonicalize_options(hash)
|
11
11
|
raise ArgumentError.new("expected a Hash, got #{hash.inspect}") unless hash.is_a?(Hash)
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
hash.dup.tap do |h|
|
16
|
-
classes = h[:class]
|
17
|
-
h[:class] = case
|
18
|
-
when classes.blank? then []
|
19
|
-
when classes.is_a?(Array) then classes.dup
|
20
|
-
else classes.to_s.split(/\s/)
|
21
|
-
end
|
22
|
-
h[:class].map!(&:to_s)
|
12
|
+
|
13
|
+
hash.symbolize_keys.tap do |h|
|
14
|
+
h[:class] = arrayify_class_and_stringify_elements(h[:class])
|
23
15
|
end
|
24
16
|
end
|
17
|
+
|
18
|
+
# Returns a new Array of String
|
19
|
+
# @example
|
20
|
+
# arrayify_class_and_stringify_elements(nil) #=> []
|
21
|
+
# arrayify_class_and_stringify_elements('foo') #=> ["foo"]
|
22
|
+
# arrayify_class_and_stringify_elements([:foo, 'bar']) #=> ["foo", "bar"]
|
23
|
+
# @return [Array of String]
|
24
|
+
def arrayify_class_and_stringify_elements(klass)
|
25
|
+
return false if klass == false
|
26
|
+
|
27
|
+
case
|
28
|
+
when klass.blank? then []
|
29
|
+
when klass.is_a?(Array) then klass
|
30
|
+
else klass.to_s.strip.split(/\s/)
|
31
|
+
end.map(&:to_s)
|
32
|
+
end
|
25
33
|
|
26
34
|
# Returns down-caret character used in various dropdown menus.
|
35
|
+
# @param [Hash] options html options for <span>
|
36
|
+
# @example
|
37
|
+
# caret(id: 'my-id') #=> <span class='caret' id='my-id'></span>
|
38
|
+
# @return [String]
|
27
39
|
def caret(options={})
|
40
|
+
options= canonicalize_options(options)
|
28
41
|
options = ensure_class(options, 'caret')
|
29
42
|
content_tag(:span, nil, options)
|
30
43
|
end
|
31
44
|
|
32
|
-
#
|
45
|
+
# Returns new Hash where :class value includes _klasses_.
|
46
|
+
#
|
47
|
+
# Assumes _hash_ has a key :class (Symbol) whose value is an Array of String.
|
48
|
+
# {Bootstrap::CommonHelper#canonicalize_options} will return such a Hash.
|
33
49
|
#
|
34
|
-
#
|
35
|
-
# ensure_class({class:
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
50
|
+
# @example
|
51
|
+
# ensure_class({class: []}, 'foo') #=> {class: 'foo'}
|
52
|
+
# ensure_class({class: ['bar'], id: 'my-id'}, ['foo', 'foo2']) #=> {:class=>["bar", "foo", "foo2"], :id=>"my-id"}
|
53
|
+
# @param [Hash] hash
|
54
|
+
# @param [String, Array] klasses one or more classes to add to the +:class+ key of _hash_
|
55
|
+
# @return [Hash]
|
56
|
+
def ensure_class(hash, klasses)
|
57
|
+
hash.dup.tap do |h|
|
58
|
+
Array(klasses).map(&:to_s).each do |k|
|
40
59
|
h[:class] << k unless h[:class].include?(k)
|
41
60
|
end
|
42
61
|
end
|
43
62
|
end
|
44
63
|
|
45
64
|
# Returns extra arguments that are Bootstrap modifiers. Basically 2nd argument
|
46
|
-
# up to (not including) the last (
|
65
|
+
# up to (not including) the last (Hash) argument.
|
47
66
|
#
|
67
|
+
# @example
|
48
68
|
# extract_extras('text') #=> []
|
49
69
|
# extract_extras('text', :small, :info, id: 'foo') #=> [:small, :info]
|
70
|
+
# @return [Array]
|
50
71
|
def extract_extras(*args)
|
51
72
|
args.extract_options!
|
52
73
|
args.shift
|
@@ -1,40 +1,66 @@
|
|
1
|
-
#
|
1
|
+
# Rails helper methods for various Bootstrap dropdown menus
|
2
2
|
#
|
3
3
|
# * http://twitter.github.io/bootstrap/components.html#buttonDropdowns
|
4
4
|
# * http://twitter.github.io/bootstrap/components.html#navbar
|
5
5
|
#
|
6
|
-
#
|
7
|
-
#
|
6
|
+
# @example nav dropdown
|
7
|
+
# <%= nav_dropdown('Admin') do %>
|
8
|
+
# <%= dropdown_item('Users', '/admin/users') %>
|
9
|
+
# <%= dropdown_item('Logs', '/admin/logs') %>
|
10
|
+
# <%= dropdown_divider %>
|
11
|
+
# <%= dropdown_item('Exceptions', '/admin/exceptions') %>
|
12
|
+
# <% end %>
|
8
13
|
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
+
# @example button dropdown
|
15
|
+
# <%= button_dropdown('Actions') do %>
|
16
|
+
# <%= dropdown_item('Action 1', '/action1') %>
|
17
|
+
# <%= dropdown_item('Action 2', '/action2') %>
|
18
|
+
# <% end %>
|
14
19
|
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
+
# @example split-button dropdown
|
21
|
+
# <%= split_button_dropdown('Default', url: '/default') do %>
|
22
|
+
# <%= dropdown_item('Action 1', '/action1') %>
|
23
|
+
# <%= dropdown_item('Action 2', '/action2') %>
|
24
|
+
# <% end %>#
|
20
25
|
#
|
21
26
|
module Bootstrap::DropdownHelper
|
22
27
|
|
23
|
-
#
|
28
|
+
# Returns a drop-down menu of links
|
29
|
+
#
|
30
|
+
# Usually called from yielded block of {Bootstrap::NavHelper#nav_bar}
|
31
|
+
#
|
32
|
+
# @param [String] text text of dropdown link
|
33
|
+
# @yield yielded block is usually calls to {Bootstrap::NavHelper#dropdown_item} or {Bootstrap::NavHelper#dropdown_divider}
|
34
|
+
# @return [String] '<li class='dropdown'><ul class='dropdown-menu'> with contents of yielded block
|
24
35
|
def nav_dropdown(text)
|
25
36
|
content_tag(:li, class: 'dropdown') do
|
26
37
|
nav_dropdown_link(text) + dropdown_ul { yield }
|
27
38
|
end
|
28
39
|
end
|
29
40
|
|
30
|
-
#
|
41
|
+
# Returns a Bootstrap button dropdown
|
42
|
+
#
|
43
|
+
# Parameters have same semantics as in {Bootstrap::ButtonHelper#button}
|
44
|
+
#
|
45
|
+
# @overload button_dropdown('Text')
|
46
|
+
# @overload button_dropdown('Text', :info)
|
47
|
+
# @overload button_dropdown('Text', :info, :mini)
|
48
|
+
# @yield yielded block is usually calls to {Bootstrap::NavHelper#dropdown_item} or {Bootstrap::NavHelper#dropdown_divider}# @return [String]
|
31
49
|
def button_dropdown(*args)
|
32
50
|
content_tag(:div, class: 'btn-group') do
|
33
51
|
button_dropdown_link(*args) + dropdown_ul { yield }
|
34
52
|
end
|
35
53
|
end
|
36
54
|
|
37
|
-
#
|
55
|
+
# Returns a Bootstrap split-button dropdown
|
56
|
+
#
|
57
|
+
# Parameters have same semantics as in {Bootstrap::ButtonHelper#button}
|
58
|
+
#
|
59
|
+
# @overload split_button_dropdown('Text')
|
60
|
+
# @overload split_button_dropdown('Text', url: '/url')
|
61
|
+
# @overload split_button_dropdown('Text', :large, :danger, url: '/url')
|
62
|
+
# @yield yielded block is usually calls to {Bootstrap::NavHelper#dropdown_item} or {Bootstrap::NavHelper#dropdown_divider}
|
63
|
+
# @return [String]
|
38
64
|
def split_button_dropdown(*args)
|
39
65
|
extras = extract_extras(*args)
|
40
66
|
|
@@ -43,12 +69,11 @@ module Bootstrap::DropdownHelper
|
|
43
69
|
end
|
44
70
|
end
|
45
71
|
|
46
|
-
#
|
47
|
-
#
|
48
|
-
# dropdown_item('Action', '/action')
|
49
|
-
# dropdown_item('Action') # href set to 'javascript:void(0)'
|
50
|
-
# dropdown_item('Action', id: 'foo') # options passed to <a> tag
|
72
|
+
# Returns a link for use within various *_dropdown methods
|
51
73
|
#
|
74
|
+
# @overload dropdown_item('Text')
|
75
|
+
# @overload dropdown_item('Text', url: '/url')
|
76
|
+
# @return [String]
|
52
77
|
def dropdown_item(*args)
|
53
78
|
options = args.extract_options!
|
54
79
|
text = args.shift or raise "Need text to link to"
|
@@ -59,7 +84,8 @@ module Bootstrap::DropdownHelper
|
|
59
84
|
end
|
60
85
|
end
|
61
86
|
|
62
|
-
#
|
87
|
+
# Returns a divider for various dropdowns
|
88
|
+
# @return [String] <li class="divider">
|
63
89
|
def dropdown_divider
|
64
90
|
content_tag(:li, nil, class: 'divider')
|
65
91
|
end
|
@@ -1,19 +1,59 @@
|
|
1
|
+
# Rails helper methods associated with forms for Bootstrap.
|
2
|
+
#
|
3
|
+
# @example +#submit_button_tag()+ instead of +#submit_button()+
|
4
|
+
# submit_button_tag
|
5
|
+
# submit_button_tag('Save')
|
6
|
+
# submit_button_tag('Delete', :danger)
|
7
|
+
# submit_button_tag('Big', :large)
|
8
|
+
# submit_button_tag('With Options', :small, :info, id: 'my-id')
|
1
9
|
module Bootstrap::FormHelper
|
10
|
+
InvalidButtonModifierError = Class.new(StandardError)
|
2
11
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
12
|
+
# Returns <input> similar to +#submit_tag()+ but:
|
13
|
+
# * styled like a Bootstrap button, type :primary
|
14
|
+
# * has +:disable_with+ set to "Processing ..."
|
15
|
+
# See {Bootstrap::ButtonHelper} for documentation on button type and size
|
16
|
+
# @overload submit_button_tag(options={})
|
17
|
+
# @param [Hash] options all options except +:disable_with+ become html attributes for <input> tag
|
18
|
+
# @option options [String, false] :disable_with either override or turn off the disabling of the button
|
19
|
+
# @overload submit_button_tag(text, options={})
|
20
|
+
# @param [String] text value of <input>
|
21
|
+
# @param [Hash] options see +options+ param in first method signature
|
22
|
+
# @overload submit_button_tag(text, type, options={})
|
23
|
+
# @param [String] text value of <input>
|
24
|
+
# @param [String, Symbol] type type of button
|
25
|
+
# @param [Hash] options see +options+ param in first method signature
|
26
|
+
# @overload submit_button_tag(text, size, options={})
|
27
|
+
# @param [String] text value of <input>
|
28
|
+
# @param [String, Symbol] size size of button
|
29
|
+
# @param [Hash] options see +options+ param in first method signature
|
30
|
+
# @overload submit_button_tag(text, type, size, options={})
|
31
|
+
# @param [String] text value of <input>
|
32
|
+
# @param [String, Symbol] type type of button
|
33
|
+
# @param [String, Symbol] size size of button
|
34
|
+
# @param [Hash] options see +options+ param in first method signature
|
35
|
+
# @return [String]
|
36
|
+
def submit_button_tag(*args)
|
37
|
+
options = canonicalize_options(args.extract_options!)
|
13
38
|
|
39
|
+
value = if Bootstrap::ButtonHelper::BUTTON_ALL.include?(args.first.to_s)
|
40
|
+
"Save changes"
|
41
|
+
else
|
42
|
+
args.shift.presence || "Save changes"
|
43
|
+
end
|
44
|
+
|
45
|
+
button_classes = if args.present?
|
46
|
+
args.each { |e| raise(InvalidButtonModifierError, e.inspect) unless
|
47
|
+
Bootstrap::ButtonHelper::BUTTON_ALL.include?(e.to_s) }
|
48
|
+
['btn'] + args.map { |e| "btn-#{e}" }
|
49
|
+
else
|
50
|
+
['btn', 'btn-primary']
|
51
|
+
end
|
52
|
+
options = ensure_class(options, button_classes)
|
53
|
+
|
14
54
|
options[:disable_with] = "Processing ..." unless options.has_key?(:disable_with)
|
15
55
|
|
16
|
-
|
56
|
+
submit_tag(value, options)
|
17
57
|
end
|
18
58
|
|
19
59
|
end
|
@@ -0,0 +1,125 @@
|
|
1
|
+
# Rails view helpers for various Bootstrap navigation components.
|
2
|
+
#
|
3
|
+
# See: http://twitter.github.io/bootstrap/components.html#navbar
|
4
|
+
# @example navigation bar (across top of page)
|
5
|
+
# <%= nav_bar do %>
|
6
|
+
#
|
7
|
+
# <%= brand('Span Brand')%>
|
8
|
+
# <%= brand('Link Brand', url: '#')%>
|
9
|
+
#
|
10
|
+
# <%= nav_bar_links do %>
|
11
|
+
#
|
12
|
+
# <%= nav_bar_link('Active', '#', active: true) %>
|
13
|
+
# <%= nav_bar_link('Link1', '/link1') %>
|
14
|
+
#
|
15
|
+
# <%= nav_bar_divider %>
|
16
|
+
#
|
17
|
+
# <%= nav_dropdown('Foo') do %>
|
18
|
+
# <%= dropdown_item('One', 'foo')%>
|
19
|
+
# <% end %>
|
20
|
+
#
|
21
|
+
# <% end %>
|
22
|
+
# <% end %>
|
23
|
+
#
|
24
|
+
# @example navigation list (e.g., in sidebar)
|
25
|
+
# <%= nav_list(id: 'my') do %>
|
26
|
+
# <%= nav_list_header('Buttons & Labels') %>
|
27
|
+
# <%= dropdown_item('Buttons', 'butons')%>
|
28
|
+
# <%= dropdown_item('Labels', 'butons')%>
|
29
|
+
# <% end %>
|
30
|
+
module Bootstrap::NavHelper
|
31
|
+
|
32
|
+
# Returns a Bootstrap navigation bar
|
33
|
+
# @yield yield block usually consists of other {Bootstrap::NavHelper} helpers
|
34
|
+
# @yieldreturn the contents of the navigation bar
|
35
|
+
# @return [String]
|
36
|
+
def nav_bar()
|
37
|
+
content_tag(:header, class: 'navbar') do
|
38
|
+
content_tag(:nav, class: 'navbar-inner') do
|
39
|
+
yield
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# Returns a Bootstrap brand element
|
45
|
+
#
|
46
|
+
# @param [String] text text of the brand
|
47
|
+
# @param [Hash] options except for +:url+, becomes html attributes of returned tag
|
48
|
+
# @option options [String] :url if present, returned tag is an <a> (else <span>)
|
49
|
+
# @return [String] <a> if +:url+ option present, else <span>
|
50
|
+
def brand(text, options = {})
|
51
|
+
options = canonicalize_options(options)
|
52
|
+
options = ensure_class(options, 'brand')
|
53
|
+
url = options.delete(:url)
|
54
|
+
|
55
|
+
if url.present?
|
56
|
+
link_to(text, url, options)
|
57
|
+
else
|
58
|
+
content_tag(:span, text, options)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# Returns <ul> for a group of nav bar links.
|
63
|
+
#
|
64
|
+
# Usually called in +yield+ block of {Bootstrap::NavHelper#nav_bar}
|
65
|
+
#
|
66
|
+
# @yield block usually consists of calls to {Bootstrap::NavHelper#nav_bar_link} and {Bootstrap::NavHelper#nav_bar_divider}
|
67
|
+
# @return [String] <div class='nav'> containing results of yielded block
|
68
|
+
def nav_bar_links(options={})
|
69
|
+
options = canonicalize_options(options)
|
70
|
+
options = ensure_class(options, 'nav')
|
71
|
+
|
72
|
+
content_tag(:div, options) do
|
73
|
+
yield
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# Returns a nav_bar_link
|
78
|
+
#
|
79
|
+
# Usually called within yield block of {Bootstrap::NavHelper#nav_bar}
|
80
|
+
#
|
81
|
+
# @param [String] text text of link
|
82
|
+
# @param [String] url url of link
|
83
|
+
# @param [Hash] options except for +:active+, becomes html attributes of link
|
84
|
+
# @option options [true] :active if set to true, displays as inactive
|
85
|
+
# @return [String] returns <a> within <li>
|
86
|
+
def nav_bar_link(text, url, options={})
|
87
|
+
a_options = canonicalize_options(options)
|
88
|
+
active = a_options.delete(:active)
|
89
|
+
|
90
|
+
li_options = {class: ('active' if active)}
|
91
|
+
|
92
|
+
content_tag(:li, li_options) do
|
93
|
+
link_to(text, url, a_options)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
# Returns divider (vertical bar) for separating items in a nav_bar
|
98
|
+
#
|
99
|
+
# @return [String] <li class="divider-vertical"></li>
|
100
|
+
def nav_bar_divider
|
101
|
+
content_tag(:li, nil, class: "divider-vertical")
|
102
|
+
end
|
103
|
+
|
104
|
+
# Returns nav list
|
105
|
+
#
|
106
|
+
# @param [Hash] options becomes html attributes of enclosing <div>
|
107
|
+
# @yield block consists of calls to {Bootstrap::NavHelper#nav_list_header} and {Bootstrap::NavHelper#dropdown_item}
|
108
|
+
# @return [String] <div class='well'><ul class='nav nav-list'> containg results of yielded block
|
109
|
+
def nav_list(options={})
|
110
|
+
options = canonicalize_options(options)
|
111
|
+
options = ensure_class(options, 'well')
|
112
|
+
content_tag(:div, options) do
|
113
|
+
content_tag(:ul, class: 'nav nav-list') do
|
114
|
+
yield
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
# Returns header for nav_list
|
120
|
+
# @param [String] text text of header
|
121
|
+
# @return [String]
|
122
|
+
def nav_list_header(text)
|
123
|
+
content_tag(:li, text, class: 'nav-header')
|
124
|
+
end
|
125
|
+
end
|
@@ -1,28 +1,32 @@
|
|
1
|
+
# Rails helper for producing Twitter Bootstrap labels. We use +#stamp()+ because +#label()+ is
|
2
|
+
# a standard Rails helper method.
|
3
|
+
#
|
1
4
|
# See: http://twitter.github.io/bootstrap/components.html#labels-badges
|
2
5
|
#
|
3
|
-
#
|
4
|
-
# a Rails helper method.
|
5
|
-
#
|
6
|
-
# Default label:
|
7
|
-
#
|
6
|
+
# @example
|
8
7
|
# stamp('Default')
|
9
|
-
#
|
10
|
-
# Other labels (see LABEL_TYPES):
|
11
|
-
#
|
12
|
-
# stamp('Info', :info)
|
13
|
-
#
|
14
|
-
# Options passed through to <span> tag:
|
15
|
-
#
|
8
|
+
# stamp('Info', :info)
|
16
9
|
# stamp('Warning', :warning, id: 'warn-id', class: 'more-class', my_key: 'my_value')
|
17
10
|
#
|
18
11
|
module Bootstrap::StampHelper
|
19
12
|
InvalidStampTypeError = Class.new(StandardError)
|
20
13
|
|
21
14
|
LABEL_TYPES = %w(default success warning important info inverse)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
#
|
15
|
+
|
16
|
+
#=> see {Bootstrap::StampHelper::LABEL_TYPES}
|
17
|
+
|
18
|
+
# Returns a Bootstrap label
|
19
|
+
#
|
20
|
+
# @overload stamp(text, options={})
|
21
|
+
# Returns a label of type :default
|
22
|
+
# @param [String] text text of the label
|
23
|
+
# @param [Hash] options html attributes for returned <span>
|
24
|
+
# @overload stamp(text, type, options={})
|
25
|
+
# Returns a label of type _type_
|
26
|
+
# @param [String] text text of the label
|
27
|
+
# @param [Symbol, String] type type of label see {Bootstrap::StampHelper::LABEL_TYPES}
|
28
|
+
# @param [Hash] options html attributes for returned <span>
|
29
|
+
# @return [String]
|
26
30
|
def stamp(*args)
|
27
31
|
text = args.shift
|
28
32
|
options = add_label_classes(*args)
|
@@ -32,7 +36,7 @@ module Bootstrap::StampHelper
|
|
32
36
|
private
|
33
37
|
|
34
38
|
def add_label_classes(*args)
|
35
|
-
options = args.extract_options!
|
39
|
+
options = canonicalize_options(args.extract_options!)
|
36
40
|
validate_label_types(args)
|
37
41
|
classes = ['label'] + args.map { |arg| "label-#{arg}" }
|
38
42
|
ensure_class(options, classes)
|
@@ -1,3 +1,107 @@
|
|
1
1
|
<h1>Examples</h1>
|
2
2
|
|
3
|
-
<%=
|
3
|
+
<%= split_button_dropdown('Default', url: '/default') do %>
|
4
|
+
<%= dropdown_item('Action 1', '/action1') %>
|
5
|
+
<%= dropdown_item('Action 2', '/action2') %>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<%= button_dropdown('Actions foo', url: 'foo') do %>
|
9
|
+
<%= dropdown_item('Action 1', '/action1') %>
|
10
|
+
<%= dropdown_item('Action 2', '/action2') %>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<%= nav_dropdown('Admin') do %>
|
14
|
+
<%= dropdown_item('Users', 'admin_users_path') %>
|
15
|
+
<%= dropdown_item('Logs', 'admin_logs_path') %>
|
16
|
+
<%= dropdown_divider %>
|
17
|
+
<%= dropdown_item('Exceptions', 'admin_exceptions_path') %>
|
18
|
+
<% end %>
|
19
|
+
|
20
|
+
|
21
|
+
<%= button_group do %>
|
22
|
+
<%= button("Left", url: "/left") %>
|
23
|
+
<%= button("Right", id: 'right') %>
|
24
|
+
<% end %>
|
25
|
+
|
26
|
+
<%= button_toolbar do %>
|
27
|
+
<%= button('Single Button', url: '/single') %>
|
28
|
+
<%= button_group do %>
|
29
|
+
<%= button('Group Button 1') %>
|
30
|
+
<%= button('Group Button 2') %>
|
31
|
+
<% end %>
|
32
|
+
<%= button('Another Single') %>
|
33
|
+
<% end %>
|
34
|
+
#
|
35
|
+
<div>
|
36
|
+
<%= badge('Default') %>
|
37
|
+
</div><div>
|
38
|
+
<%= badge('Default') %>
|
39
|
+
</div><div>
|
40
|
+
<%= badge('Default') %>
|
41
|
+
</div><div>
|
42
|
+
<%= badge('Default') %>
|
43
|
+
</div><div>
|
44
|
+
<%= badge('Default') %>
|
45
|
+
</div><div>
|
46
|
+
<%= badge('Default') %>
|
47
|
+
</div><div>
|
48
|
+
<%= badge('Default') %>
|
49
|
+
</div><div>
|
50
|
+
<%= badge('Default') %>
|
51
|
+
</div><div>
|
52
|
+
<%= badge('Default') %>
|
53
|
+
</div><div>
|
54
|
+
<%= badge('Default') %>
|
55
|
+
</div><div>
|
56
|
+
<%= badge('Default') %>
|
57
|
+
</div><div>
|
58
|
+
<%= badge('Default') %>
|
59
|
+
</div><div>
|
60
|
+
<%= badge('Default') %>
|
61
|
+
</div><div>
|
62
|
+
<%= badge('Default') %>
|
63
|
+
</div><div>
|
64
|
+
<%= badge('Default') %>
|
65
|
+
</div><div>
|
66
|
+
<%= badge('Default') %>
|
67
|
+
</div><div>
|
68
|
+
<%= badge('Default') %>
|
69
|
+
</div><div>
|
70
|
+
<%= badge('Default') %>
|
71
|
+
</div><div>
|
72
|
+
<%= badge('Default') %>
|
73
|
+
</div><div>
|
74
|
+
<%= badge('Default') %>
|
75
|
+
</div><div>
|
76
|
+
<%= badge('Default') %>
|
77
|
+
</div><div>
|
78
|
+
<%= badge('Default') %>
|
79
|
+
</div><div>
|
80
|
+
<%= badge('Default') %>
|
81
|
+
</div><div>
|
82
|
+
<%= badge('Default') %>
|
83
|
+
</div><div>
|
84
|
+
<%= badge('Default') %>
|
85
|
+
</div><div>
|
86
|
+
<%= badge('Default') %>
|
87
|
+
</div><div>
|
88
|
+
<%= badge('Default') %>
|
89
|
+
</div><div>
|
90
|
+
<%= badge('Default') %>
|
91
|
+
</div><div>
|
92
|
+
<%= badge('Default') %>
|
93
|
+
</div><div>
|
94
|
+
<%= badge('Default') %>
|
95
|
+
</div><div>
|
96
|
+
<%= badge('Default') %>
|
97
|
+
</div><div>
|
98
|
+
<%= badge('Default') %>
|
99
|
+
</div><div>
|
100
|
+
<%= badge('Default') %>
|
101
|
+
</div><div>
|
102
|
+
<%= badge('Default') %>
|
103
|
+
</div><div>
|
104
|
+
<%= badge('Default') %>
|
105
|
+
</div><div>
|
106
|
+
<%= badge('Default') %>
|
107
|
+
</div>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootstrap-view-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -27,6 +27,54 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: jquery-rails
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: sass-rails
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '3.2'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.2'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: bootstrap-sass
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 2.3.1.0
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 2.3.1.0
|
30
78
|
- !ruby/object:Gem::Dependency
|
31
79
|
name: rspec-rails
|
32
80
|
requirement: !ruby/object:Gem::Requirement
|
@@ -107,6 +155,38 @@ dependencies:
|
|
107
155
|
- - ! '>='
|
108
156
|
- !ruby/object:Gem::Version
|
109
157
|
version: '0'
|
158
|
+
- !ruby/object:Gem::Dependency
|
159
|
+
name: yard
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
162
|
+
requirements:
|
163
|
+
- - ! '>='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
type: :development
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
- !ruby/object:Gem::Dependency
|
175
|
+
name: redcarpet
|
176
|
+
requirement: !ruby/object:Gem::Requirement
|
177
|
+
none: false
|
178
|
+
requirements:
|
179
|
+
- - ! '>='
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '0'
|
182
|
+
type: :development
|
183
|
+
prerelease: false
|
184
|
+
version_requirements: !ruby/object:Gem::Requirement
|
185
|
+
none: false
|
186
|
+
requirements:
|
187
|
+
- - ! '>='
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '0'
|
110
190
|
description: Rails view helpers for Bootstrap
|
111
191
|
email:
|
112
192
|
- steve.downtown@gmail.com
|
@@ -121,6 +201,7 @@ files:
|
|
121
201
|
- app/helpers/bootstrap/common_helper.rb
|
122
202
|
- app/helpers/bootstrap/dropdown_helper.rb
|
123
203
|
- app/helpers/bootstrap/form_helper.rb
|
204
|
+
- app/helpers/bootstrap/nav_helper.rb
|
124
205
|
- app/helpers/bootstrap/stamp_helper.rb
|
125
206
|
- app/views/bootstrap_view_helpers/index.html.erb
|
126
207
|
- config/routes.rb
|
@@ -156,3 +237,4 @@ signing_key:
|
|
156
237
|
specification_version: 3
|
157
238
|
summary: Rails view helpers for Bootstrap
|
158
239
|
test_files: []
|
240
|
+
has_rdoc:
|