bootstrap-view-helpers 0.0.13 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/app/helpers/bootstrap/accordion_helper.rb +8 -6
- data/app/helpers/bootstrap/alert_helper.rb +10 -3
- data/app/helpers/bootstrap/badge_helper.rb +4 -3
- data/app/helpers/bootstrap/button_helper.rb +18 -2
- data/app/helpers/bootstrap/common_helper.rb +1 -1
- data/app/helpers/bootstrap/dropdown_helper.rb +7 -4
- data/app/helpers/bootstrap/form_helper.rb +6 -1
- data/app/helpers/bootstrap/icon_renderer.rb +3 -2
- data/app/helpers/bootstrap/modal_helper.rb +10 -4
- data/app/helpers/bootstrap/nav_helper.rb +40 -23
- data/app/helpers/bootstrap/stamp_helper.rb +2 -1
- data/app/views/application/_bootstrap_view_helper_nav_bar.html.erb +18 -14
- data/app/views/application/_bootstrap_view_helper_side_bar.html.erb +15 -14
- data/app/views/bootstrap_view_helpers/_alert_options.html.erb +0 -2
- data/app/views/bootstrap_view_helpers/_alert_types.html.erb +3 -1
- data/app/views/bootstrap_view_helpers/buttons.html.erb +0 -6
- data/app/views/bootstrap_view_helpers/labels_and_badges.html.erb +8 -8
- data/app/views/layouts/bootstrap_view_helpers.html.erb +5 -7
- data/config/routes.rb +1 -1
- data/lib/bootstrap-view-helpers/version.rb +1 -1
- metadata +32 -137
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a35b9241c628b52551279929f4bbd3827d1e01b6
|
4
|
+
data.tar.gz: 3af5d1f897639a97e0060a9fd29ea11b85442e2f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b3d2bb44b86c9e8f3ec60ec1488b7eaaa5ad0b583af3e44c300deb2e4433990a0426d123a59bd995750bedf0ccd4dbd0ea1dc779547ef571157947ab342de14f
|
7
|
+
data.tar.gz: 9b64cdb58379cf244e59f9e26c1ec033a47d6ecfccc1d3fbff643db98218bb99f93d5b39c76e0736b2b583b039ca66e8ab04e70ee44e73b55ec2bb757b47991d
|
@@ -26,7 +26,7 @@ module Bootstrap::AccordionHelper
|
|
26
26
|
options = canonicalize_options(options)
|
27
27
|
options = ensure_accordion_id(options)
|
28
28
|
@accordion_id = options[:id]
|
29
|
-
options = ensure_class(options, '
|
29
|
+
options = ensure_class(options, 'panel-group')
|
30
30
|
|
31
31
|
content_tag(:div, options) do
|
32
32
|
yield
|
@@ -47,7 +47,7 @@ module Bootstrap::AccordionHelper
|
|
47
47
|
# options = ensure_accordion_group_id(options)
|
48
48
|
@accordion_group_id = get_next_group_id
|
49
49
|
|
50
|
-
options = ensure_class(options, '
|
50
|
+
options = ensure_class(options, 'panel panel-default')
|
51
51
|
|
52
52
|
content_tag(:div, options) do
|
53
53
|
accordion_group_heading(text) + accordion_group_body(open) { yield }
|
@@ -57,17 +57,19 @@ module Bootstrap::AccordionHelper
|
|
57
57
|
private
|
58
58
|
|
59
59
|
def accordion_group_heading(text)
|
60
|
-
content_tag(:div, class: '
|
61
|
-
content_tag(:
|
60
|
+
content_tag(:div, class: 'panel-heading') do
|
61
|
+
content_tag(:h4, class: 'panel-title') do
|
62
|
+
content_tag(:a, text, href: "##{@accordion_group_id}", data: {toggle: 'collapse', parent: "##{@accordion_id}" })
|
63
|
+
end
|
62
64
|
end
|
63
65
|
end
|
64
66
|
|
65
67
|
def accordion_group_body(open)
|
66
|
-
classes = %w(
|
68
|
+
classes = %w(panel-collapse collapse)
|
67
69
|
classes << 'in' if open
|
68
70
|
|
69
71
|
content_tag(:div, id: @accordion_group_id, class: classes) do
|
70
|
-
content_tag(:div, class: '
|
72
|
+
content_tag(:div, class: 'panel-body') do
|
71
73
|
yield
|
72
74
|
end
|
73
75
|
end
|
@@ -19,8 +19,9 @@
|
|
19
19
|
module Bootstrap::AlertHelper
|
20
20
|
InvalidAlertTypeError = Class.new(StandardError)
|
21
21
|
|
22
|
-
ALERT_ATTRIBUTES = %w(
|
23
|
-
|
22
|
+
ALERT_ATTRIBUTES = %w(default success info warning danger)
|
23
|
+
COMPILED_ALERT_CLASSES = ALERT_ATTRIBUTES.map{|a| "alert-#{a}"}
|
24
|
+
|
24
25
|
# @overload alert(text, alert_type, options={})
|
25
26
|
# @param text [String] text of the label
|
26
27
|
# @param alert_type [Symbol, String] if present must be one of {Bootstrap::AlertHelper::ALERT_ATTRIBUTES}
|
@@ -35,6 +36,7 @@ module Bootstrap::AlertHelper
|
|
35
36
|
options = add_alert_classes(options, args)
|
36
37
|
heading = options.delete(:heading)
|
37
38
|
show_close = options.delete(:close) != false
|
39
|
+
options = ensure_class(options, 'alert-dismissible') if show_close
|
38
40
|
|
39
41
|
content_tag(:div, options) do
|
40
42
|
alert_close(show_close) +
|
@@ -48,7 +50,7 @@ module Bootstrap::AlertHelper
|
|
48
50
|
# @return [String] html for alert close button unless _show_ is +false+
|
49
51
|
def alert_close(show=true)
|
50
52
|
return '' unless show
|
51
|
-
content_tag(:button, '×'.html_safe, class: 'close', data: {dismiss: 'alert'})
|
53
|
+
content_tag(:button, '×'.html_safe, class: 'close', data: {dismiss: 'alert'}, aria: {label: "Close"})
|
52
54
|
end
|
53
55
|
|
54
56
|
# Return an alert heading
|
@@ -72,6 +74,7 @@ module Bootstrap::AlertHelper
|
|
72
74
|
def add_alert_classes(options, alert_attributes)
|
73
75
|
validate_alert_attributes(alert_attributes)
|
74
76
|
classes = ['alert'] + alert_attributes.map { |e| "alert-#{e}" }
|
77
|
+
classes << "alert-default" if is_default?(classes, options, alert_attributes)
|
75
78
|
ensure_class(options, classes)
|
76
79
|
end
|
77
80
|
|
@@ -79,5 +82,9 @@ module Bootstrap::AlertHelper
|
|
79
82
|
alert_attributes.each { |e| raise(InvalidAlertTypeError, e.inspect) unless ALERT_ATTRIBUTES.include?(e.to_s) }
|
80
83
|
end
|
81
84
|
|
85
|
+
def is_default?(classes, options, alert_attributes)
|
86
|
+
classes == ['alert'] &&
|
87
|
+
!options[:class].any?{|c| COMPILED_ALERT_CLASSES.include?(c)}
|
88
|
+
end
|
82
89
|
|
83
90
|
end
|
@@ -14,8 +14,8 @@
|
|
14
14
|
module Bootstrap::BadgeHelper
|
15
15
|
InvalidBadgeTypeError = Class.new(StandardError)
|
16
16
|
|
17
|
-
BADGE_TYPES = %w(default success warning
|
18
|
-
|
17
|
+
BADGE_TYPES = %w(default primary success info warning danger)
|
18
|
+
|
19
19
|
# Returns html for a Bootstrap badge.
|
20
20
|
#
|
21
21
|
# @overload badge(text, options={})
|
@@ -40,7 +40,8 @@ module Bootstrap::BadgeHelper
|
|
40
40
|
def add_badge_classes(*args)
|
41
41
|
options = canonicalize_options(args.extract_options!)
|
42
42
|
validate_badge_types(args)
|
43
|
-
classes = ['
|
43
|
+
classes = ['label', 'label-pill'] + args.map { |arg| "label-#{arg}" }
|
44
|
+
classes << 'label-default' if classes == ['label', 'label-pill']
|
44
45
|
ensure_class(options, classes)
|
45
46
|
end
|
46
47
|
|
@@ -44,7 +44,7 @@ module Bootstrap::ButtonHelper
|
|
44
44
|
|
45
45
|
BUTTON_TYPES = %w(default primary info success warning danger inverse link)
|
46
46
|
BUTTON_SIZES = %w(default large small mini)
|
47
|
-
BUTTON_OTHERS = %w(
|
47
|
+
BUTTON_OTHERS = %w()
|
48
48
|
|
49
49
|
BUTTON_ALL = BUTTON_TYPES + BUTTON_SIZES + BUTTON_OTHERS
|
50
50
|
|
@@ -76,11 +76,13 @@ module Bootstrap::ButtonHelper
|
|
76
76
|
# @option options [String] :url if present, return a <a> styled as a button
|
77
77
|
# @return [String] Html for a <button> (or <a> if +url+ option passed in)
|
78
78
|
def button(*args)
|
79
|
-
text = args.shift
|
80
79
|
options = canonicalize_options(args.extract_options!)
|
80
|
+
text = args.shift
|
81
81
|
href = options.delete(:url)
|
82
82
|
options = add_button_classes(options, args)
|
83
83
|
|
84
|
+
text = yield if block_given?
|
85
|
+
|
84
86
|
if href.present?
|
85
87
|
link_to(text, href, options)
|
86
88
|
else
|
@@ -132,8 +134,22 @@ module Bootstrap::ButtonHelper
|
|
132
134
|
|
133
135
|
def add_button_classes(options, button_types_and_sizes)
|
134
136
|
validate_button_types_and_sizes(button_types_and_sizes)
|
137
|
+
map_button_types_and_sizes(button_types_and_sizes)
|
135
138
|
classes = ['btn'] + button_types_and_sizes.map { |e| "btn-#{e}" }
|
139
|
+
classes << 'btn-default' if classes == ['btn']
|
136
140
|
ensure_class(options, classes)
|
137
141
|
end
|
142
|
+
|
143
|
+
BUTTON_TYPES_AND_SIZES_MAP = {
|
144
|
+
:default => :default,
|
145
|
+
:mini => :xs,
|
146
|
+
:small => :sm,
|
147
|
+
:large => :lg
|
148
|
+
}
|
149
|
+
def map_button_types_and_sizes(button_types_and_sizes)
|
150
|
+
button_types_and_sizes.map! do |e|
|
151
|
+
(BUTTON_TYPES_AND_SIZES_MAP[e.to_sym] || e).to_s
|
152
|
+
end
|
153
|
+
end
|
138
154
|
|
139
155
|
end
|
@@ -58,7 +58,7 @@ module Bootstrap::CommonHelper
|
|
58
58
|
# @param [String, Array] klasses one or more classes to add to the +:class+ key of _hash_
|
59
59
|
# @return [Hash]
|
60
60
|
def ensure_class(hash, klasses)
|
61
|
-
canonicalize_options(hash)
|
61
|
+
hash = canonicalize_options(hash)
|
62
62
|
|
63
63
|
hash.dup.tap do |h|
|
64
64
|
Array(klasses).map(&:to_s).each do |k|
|
@@ -24,6 +24,7 @@
|
|
24
24
|
# <% end %>#
|
25
25
|
#
|
26
26
|
module Bootstrap::DropdownHelper
|
27
|
+
include ActionView::Helpers::SanitizeHelper
|
27
28
|
|
28
29
|
# Returns a drop-down menu of links
|
29
30
|
#
|
@@ -34,7 +35,7 @@ module Bootstrap::DropdownHelper
|
|
34
35
|
# @return [String] '<li class='dropdown'><ul class='dropdown-menu'> with contents of yielded block
|
35
36
|
def nav_dropdown(text, options={})
|
36
37
|
options = canonicalize_options(options)
|
37
|
-
options = ensure_class(options, 'dropdown')
|
38
|
+
options = ensure_class(options, 'nav-item dropdown')
|
38
39
|
|
39
40
|
content_tag(:li, options) do
|
40
41
|
nav_dropdown_link(text) + dropdown_ul { yield }
|
@@ -82,6 +83,8 @@ module Bootstrap::DropdownHelper
|
|
82
83
|
text = args.shift or raise "Need text to link to"
|
83
84
|
url = args.shift || 'javascript:void(0)'
|
84
85
|
|
86
|
+
options = ensure_class(options, 'dropdown')
|
87
|
+
|
85
88
|
content_tag(:li) do
|
86
89
|
link_to(text, url, options)
|
87
90
|
end
|
@@ -96,8 +99,8 @@ module Bootstrap::DropdownHelper
|
|
96
99
|
private
|
97
100
|
|
98
101
|
def nav_dropdown_link(text)
|
99
|
-
content_tag(:a, class: "dropdown-toggle", data: {toggle: "dropdown"}, href: "#") do
|
100
|
-
safe_join( [
|
102
|
+
content_tag(:a, class: "nav-link dropdown-toggle", data: {toggle: "dropdown"}, href: "#") do
|
103
|
+
safe_join( [ sanitize(text), caret ], ' ' )
|
101
104
|
end
|
102
105
|
end
|
103
106
|
|
@@ -105,7 +108,7 @@ module Bootstrap::DropdownHelper
|
|
105
108
|
text = args.shift
|
106
109
|
classes = %w(btn dropdown-toggle) + args.map { |e| "btn-#{e}" }
|
107
110
|
content_tag(:a, class: classes, data: {toggle: "dropdown"}, href: "#") do
|
108
|
-
safe_join( [
|
111
|
+
safe_join( [ sanitize(text), caret ], ' ' )
|
109
112
|
end
|
110
113
|
end
|
111
114
|
|
@@ -87,7 +87,12 @@ module Bootstrap::FormHelper
|
|
87
87
|
end
|
88
88
|
options = ensure_class(options, button_classes)
|
89
89
|
|
90
|
-
options[:
|
90
|
+
disable_or_remove = options[:data] && options[:data].delete(:disable_with)
|
91
|
+
|
92
|
+
unless disable_or_remove === false
|
93
|
+
options[:data] ||= {}
|
94
|
+
options[:data][:disable_with] = disable_or_remove || "Processing ..."
|
95
|
+
end
|
91
96
|
|
92
97
|
submit_tag(value, options)
|
93
98
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# @private
|
2
2
|
class Bootstrap::IconRenderer
|
3
3
|
ArgumentError = Class.new(StandardError)
|
4
|
+
include ActionView::Helpers::SanitizeHelper
|
4
5
|
|
5
6
|
delegate :canonicalize_options, :content_tag, :ensure_class, :h, to: :template
|
6
7
|
attr_accessor :template, :options, :args, :text
|
@@ -33,7 +34,7 @@ class Bootstrap::IconRenderer
|
|
33
34
|
|
34
35
|
def process_icon_type
|
35
36
|
icon_type = args.shift.presence or raise(ArgumentError, "must pass an icon type")
|
36
|
-
icon_class = icon_type == 'blank' ? '
|
37
|
+
icon_class = icon_type == 'blank' ? 'glyphicon glyphicon-search' : "glyphicon glyphicon-#{icon_type.gsub("_", "-")}"
|
37
38
|
self.options = ensure_class(self.options, icon_class)
|
38
39
|
|
39
40
|
if icon_type == 'blank'
|
@@ -51,7 +52,7 @@ class Bootstrap::IconRenderer
|
|
51
52
|
self.text = if args.size == 0
|
52
53
|
nil
|
53
54
|
elsif args.size == 1
|
54
|
-
|
55
|
+
sanitize(" #{args.first}")
|
55
56
|
else
|
56
57
|
raise ArgumentError, 'too many arguments'
|
57
58
|
end
|
@@ -16,11 +16,15 @@ module Bootstrap::ModalHelper
|
|
16
16
|
def modal(options={})
|
17
17
|
options = canonicalize_options(options)
|
18
18
|
options.has_key?(:id) or raise(ArgumentError, "missing :id option")
|
19
|
-
options = ensure_class(options, %w(modal
|
19
|
+
options = ensure_class(options, %w(modal fade))
|
20
20
|
options.merge!(tabindex: "-1", role: "dialog")
|
21
21
|
|
22
22
|
content_tag(:div, options) do
|
23
|
-
|
23
|
+
content_tag(:div, class: "modal-dialog") do
|
24
|
+
content_tag(:div, class: "modal-content") do
|
25
|
+
yield
|
26
|
+
end
|
27
|
+
end
|
24
28
|
end
|
25
29
|
end
|
26
30
|
|
@@ -34,7 +38,7 @@ module Bootstrap::ModalHelper
|
|
34
38
|
|
35
39
|
content_tag(:div, options) do
|
36
40
|
modal_header_close_button(show_close) +
|
37
|
-
content_tag(:
|
41
|
+
content_tag(:h4, class: "modal-title") do
|
38
42
|
content
|
39
43
|
end
|
40
44
|
end
|
@@ -73,7 +77,9 @@ module Bootstrap::ModalHelper
|
|
73
77
|
# Returns a Bootstrap modal close button
|
74
78
|
def modal_header_close_button(show=true)
|
75
79
|
return ''.html_safe unless show
|
76
|
-
button(
|
80
|
+
button(type: 'button', class: 'close', data: {dismiss: 'modal'}) do
|
81
|
+
content_tag(:span, "×".html_safe)
|
82
|
+
end
|
77
83
|
end
|
78
84
|
|
79
85
|
# Returns a close button for Bootstrap modal footer.
|
@@ -29,14 +29,14 @@
|
|
29
29
|
# <%= dropdown_item('Labels', 'butons')%>
|
30
30
|
# <% end %>
|
31
31
|
module Bootstrap::NavHelper
|
32
|
-
|
32
|
+
include ActionView::Helpers::SanitizeHelper
|
33
33
|
# Returns a Bootstrap navigation bar
|
34
34
|
# @yield yield block usually consists of other {Bootstrap::NavHelper} helpers
|
35
35
|
# @yieldreturn the contents of the navigation bar
|
36
36
|
# @return [String]
|
37
37
|
def nav_bar()
|
38
|
-
content_tag(:
|
39
|
-
content_tag(:
|
38
|
+
content_tag(:nav, class: 'navbar navbar-default') do
|
39
|
+
content_tag(:div, class: 'container-fluid') do
|
40
40
|
yield
|
41
41
|
end
|
42
42
|
end
|
@@ -52,40 +52,51 @@ module Bootstrap::NavHelper
|
|
52
52
|
# @return [String] <a> if +:url+ option present, else <span>
|
53
53
|
def brand(text, options = {})
|
54
54
|
options = canonicalize_options(options)
|
55
|
-
options = ensure_class(options, 'brand')
|
55
|
+
options = ensure_class(options, 'navbar-brand')
|
56
56
|
|
57
57
|
with_environment = options.delete(:with_environment)
|
58
58
|
if with_environment && Rails.env != 'production'
|
59
|
-
|
59
|
+
if text.present?
|
60
|
+
text = "#{text} - #{Rails.env}"
|
61
|
+
else
|
62
|
+
text = Rails.env
|
63
|
+
end
|
60
64
|
options = ensure_class(options, "rails-#{Rails.env}")
|
61
65
|
end
|
62
66
|
|
63
67
|
url = options.delete(:url)
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
68
|
+
content_tag(:div, class: "navbar-header") do
|
69
|
+
if url.present?
|
70
|
+
link_to(text, url, options)
|
71
|
+
else
|
72
|
+
content_tag(:span, text, options)
|
73
|
+
end
|
69
74
|
end
|
70
75
|
end
|
71
76
|
|
72
77
|
# Returns <div> for a group of nav bar links, <ul>s.
|
73
78
|
#
|
79
|
+
def nav_bar_wrapper(options = {})
|
80
|
+
content_tag(:div, class: "navbar-collapse collapse sidebar-navbar-collapse") do
|
81
|
+
yield
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
74
85
|
# Usually called in +yield+ block of {Bootstrap::NavHelper#nav_bar}
|
75
86
|
#
|
76
87
|
# @param options [Hash] options except for +:pull+ become html attributes of generated <div>
|
77
88
|
# @option options [:left, :right] pull will add class of "pull-left|right" for Bootstrap nav bar positioning
|
78
89
|
# @yield block usually consists of calls to {Bootstrap::NavHelper#nav_bar_link} and {Bootstrap::NavHelper#nav_bar_divider}
|
79
90
|
# @return [String] <div class='nav'> containing results of yielded block
|
80
|
-
def nav_bar_links(options={})
|
91
|
+
def nav_bar_links(options = {})
|
81
92
|
options = canonicalize_options(options)
|
82
|
-
options = ensure_class(options, 'nav')
|
93
|
+
options = ensure_class(options, 'nav navbar-nav')
|
83
94
|
|
84
95
|
if pull = options.delete(:pull)
|
85
|
-
options = ensure_class(options, "
|
96
|
+
options = ensure_class(options, "navbar-#{pull}")
|
86
97
|
end
|
87
98
|
|
88
|
-
content_tag(:
|
99
|
+
content_tag(:ul, options) do
|
89
100
|
yield
|
90
101
|
end
|
91
102
|
end
|
@@ -103,8 +114,8 @@ module Bootstrap::NavHelper
|
|
103
114
|
a_options = canonicalize_options(options)
|
104
115
|
active = a_options.delete(:active)
|
105
116
|
|
106
|
-
li_options = {class: ('active' if active)}
|
107
|
-
|
117
|
+
li_options = ensure_class({class: ('active' if active)}, "")
|
118
|
+
|
108
119
|
content_tag(:li, li_options) do
|
109
120
|
link_to(text, url, a_options)
|
110
121
|
end
|
@@ -112,9 +123,9 @@ module Bootstrap::NavHelper
|
|
112
123
|
|
113
124
|
# Returns divider (vertical bar) for separating items in a nav_bar
|
114
125
|
#
|
115
|
-
# @return [String] <li class="divider
|
126
|
+
# @return [String] <li class="divider"></li>
|
116
127
|
def nav_bar_divider
|
117
|
-
content_tag(:li, nil, class: "divider
|
128
|
+
content_tag(:li, nil, class: "divider")
|
118
129
|
end
|
119
130
|
|
120
131
|
# Returns nav list
|
@@ -126,7 +137,7 @@ module Bootstrap::NavHelper
|
|
126
137
|
options = canonicalize_options(options)
|
127
138
|
options = ensure_class(options, 'well')
|
128
139
|
content_tag(:div, options) do
|
129
|
-
content_tag(:ul, class: 'nav nav-
|
140
|
+
content_tag(:ul, class: 'nav nav-stacked') do
|
130
141
|
yield
|
131
142
|
end
|
132
143
|
end
|
@@ -137,7 +148,7 @@ module Bootstrap::NavHelper
|
|
137
148
|
# @param text [String] text of header
|
138
149
|
# @return [String] <li.nav-header>text</li>
|
139
150
|
def nav_list_header(text)
|
140
|
-
content_tag(:li, text, class: '
|
151
|
+
content_tag(:li, text, class: '')
|
141
152
|
end
|
142
153
|
|
143
154
|
# Wraps _text_ so it has proper leading and color for text in a nav bar. Usually
|
@@ -151,12 +162,12 @@ module Bootstrap::NavHelper
|
|
151
162
|
# @option options [:left, :right] :pull (:left) adds the Boostrap positioning class
|
152
163
|
# @option options [Boolean] :pad (true) include padding around text
|
153
164
|
# @return [String]
|
154
|
-
def nav_bar_text(text, options={})
|
165
|
+
def nav_bar_text(text, options = {})
|
155
166
|
options = canonicalize_options(options)
|
156
167
|
|
157
168
|
unless options.delete(:pad) == false
|
158
169
|
padding = (" " * 3).html_safe
|
159
|
-
text = padding +
|
170
|
+
text = padding + sanitize(text) + padding
|
160
171
|
end
|
161
172
|
|
162
173
|
pull_class = (options.delete(:pull).to_s == 'right' ? 'pull-right' : 'pull-left')
|
@@ -164,4 +175,10 @@ module Bootstrap::NavHelper
|
|
164
175
|
|
165
176
|
content_tag(:p, text, options)
|
166
177
|
end
|
167
|
-
|
178
|
+
|
179
|
+
def vertical_nav(options = {})
|
180
|
+
content_tag(:div, class: "sidebar-nav") do
|
181
|
+
yield
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
@@ -11,7 +11,7 @@
|
|
11
11
|
module Bootstrap::StampHelper
|
12
12
|
InvalidStampTypeError = Class.new(StandardError)
|
13
13
|
|
14
|
-
LABEL_TYPES = %w(default success warning
|
14
|
+
LABEL_TYPES = %w(default primary success info warning danger)
|
15
15
|
|
16
16
|
#=> see {Bootstrap::StampHelper::LABEL_TYPES}
|
17
17
|
|
@@ -39,6 +39,7 @@ module Bootstrap::StampHelper
|
|
39
39
|
options = canonicalize_options(args.extract_options!)
|
40
40
|
validate_label_types(args)
|
41
41
|
classes = ['label'] + args.map { |arg| "label-#{arg}" }
|
42
|
+
classes << 'label-default' if classes == ['label']
|
42
43
|
ensure_class(options, classes)
|
43
44
|
end
|
44
45
|
|
@@ -2,20 +2,24 @@
|
|
2
2
|
|
3
3
|
<%= brand('Bootstrap View Helpers', url: bvh_path) %>
|
4
4
|
|
5
|
-
<%=
|
6
|
-
<%=
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
5
|
+
<%= nav_bar_wrapper do %>
|
6
|
+
<%= nav_bar_links do %>
|
7
|
+
<%= nav_bar_link('Application Home', bvh_app_home_link) %>
|
8
|
+
<%= nav_bar_link('Active', '#', active: true) %>
|
9
|
+
<%= nav_bar_link('Link 1', '#') %>
|
10
|
+
<%= nav_bar_divider %>
|
11
|
+
<%= nav_bar_link('Link 2', '#') %>
|
12
|
+
<%= nav_dropdown('Dropdown A') do %>
|
13
|
+
<%= dropdown_item('Bee', '#') %>
|
14
|
+
<% end %>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<%= nav_bar_links(pull: 'right') do %>
|
18
|
+
<%= nav_dropdown('Dropdown 1') do %>
|
19
|
+
<%= dropdown_item('One', '#') %>
|
20
|
+
<% end %>
|
16
21
|
<% end %>
|
22
|
+
|
23
|
+
<%= nav_bar_text("Logged in as admin", pull: 'right') %>
|
17
24
|
<% end %>
|
18
|
-
|
19
|
-
<%= nav_bar_text("Logged in as admin", pull: 'right') %>
|
20
|
-
|
21
25
|
<% end %>
|
@@ -1,16 +1,17 @@
|
|
1
|
-
<%=
|
2
|
-
|
3
|
-
|
1
|
+
<%= vertical_nav do %>
|
2
|
+
<%= nav_list do %>
|
3
|
+
|
4
|
+
<%= nav_list_header('Sidebar Header') %>
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
6
|
+
<%= dropdown_item('Accordions', bvh_path('accordions')) %>
|
7
|
+
<%= dropdown_item('Alerts', bvh_path('alerts')) %>
|
8
|
+
<%= dropdown_item('Buttons', bvh_path('buttons')) %>
|
9
|
+
<%= dropdown_item('Icons', bvh_path('icons')) %>
|
10
|
+
<%= dropdown_item('Form helpers', bvh_path('form_helpers')) %>
|
11
|
+
<%= dropdown_item('Flash', bvh_path('flash_helper')) %>
|
12
|
+
<%= dropdown_item('Labels and badges', bvh_path('labels_and_badges')) %>
|
13
|
+
<%= dropdown_item('Modal Helpers', bvh_path('modal')) %>
|
14
|
+
<%= dropdown_item('Nav Helpers', bvh_path) %>
|
15
|
+
<%= dropdown_item('Table Helpers', bvh_path('tables')) %>
|
16
|
+
<% end %>
|
16
17
|
<% end %>
|
@@ -109,12 +109,6 @@
|
|
109
109
|
<code>button('Mini', :mini)</code>
|
110
110
|
</td>
|
111
111
|
</tr>
|
112
|
-
<tr>
|
113
|
-
<td><%= button('Block', :block) %></td>
|
114
|
-
<td>
|
115
|
-
<code>button('Block', :block) # (occupies 100% width of container)</code>
|
116
|
-
</td>
|
117
|
-
</tr>
|
118
112
|
<tr>
|
119
113
|
<td><%= button('Small Info', :small, :info) %></td>
|
120
114
|
<td>
|
@@ -32,9 +32,9 @@
|
|
32
32
|
</td>
|
33
33
|
</tr>
|
34
34
|
<tr>
|
35
|
-
<td><%= stamp('
|
35
|
+
<td><%= stamp('Danger', :danger) %>
|
36
36
|
<td>
|
37
|
-
<code>stamp('
|
37
|
+
<code>stamp('Danger', :danger)</code>
|
38
38
|
</td>
|
39
39
|
</tr>
|
40
40
|
<tr>
|
@@ -44,9 +44,9 @@
|
|
44
44
|
</td>
|
45
45
|
</tr>
|
46
46
|
<tr>
|
47
|
-
<td><%= stamp('
|
47
|
+
<td><%= stamp('Primary', :primary) %>
|
48
48
|
<td>
|
49
|
-
<code>stamp('
|
49
|
+
<code>stamp('Primary', :primary)</code>
|
50
50
|
</td>
|
51
51
|
</tr>
|
52
52
|
<tr>
|
@@ -89,9 +89,9 @@
|
|
89
89
|
</td>
|
90
90
|
</tr>
|
91
91
|
<tr>
|
92
|
-
<td><%= badge('4', :
|
92
|
+
<td><%= badge('4', :danger) %>
|
93
93
|
<td>
|
94
|
-
<code>badge('4', :
|
94
|
+
<code>badge('4', :danger)</code>
|
95
95
|
</td>
|
96
96
|
</tr>
|
97
97
|
<tr>
|
@@ -101,9 +101,9 @@
|
|
101
101
|
</td>
|
102
102
|
</tr>
|
103
103
|
<tr>
|
104
|
-
<td><%= badge('10', :
|
104
|
+
<td><%= badge('10', :primary) %>
|
105
105
|
<td>
|
106
|
-
<code>badge('10', :
|
106
|
+
<code>badge('10', :primary)</code>
|
107
107
|
</td>
|
108
108
|
</tr>
|
109
109
|
<tr>
|
@@ -9,13 +9,11 @@
|
|
9
9
|
<body>
|
10
10
|
<%= render partial: 'bootstrap_view_helper_nav_bar' %>
|
11
11
|
<div class='container-fluid'>
|
12
|
-
<div class='
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
<%= yield %>
|
18
|
-
</div>
|
12
|
+
<div class='col-md-3'>
|
13
|
+
<%= render partial: 'bootstrap_view_helper_side_bar' %>
|
14
|
+
</div>
|
15
|
+
<div class='col-md-9'>
|
16
|
+
<%= yield %>
|
19
17
|
</div>
|
20
18
|
</div>
|
21
19
|
</body>
|
data/config/routes.rb
CHANGED
metadata
CHANGED
@@ -1,270 +1,167 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootstrap-view-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.14
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Steve Downey
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2016-01-26 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rails
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: jquery-rails
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: sass-rails
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ~>
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
47
|
+
version: 5.0.4
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ~>
|
60
53
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
54
|
+
version: 5.0.4
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: bootstrap-sass
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - ~>
|
68
60
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
70
|
-
type: :
|
61
|
+
version: 3.3.6
|
62
|
+
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
66
|
- - ~>
|
76
67
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
68
|
+
version: 3.3.6
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: rspec-rails
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - '>='
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '0'
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - '>='
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '0'
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: capybara
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
|
-
- -
|
87
|
+
- - '>='
|
100
88
|
- !ruby/object:Gem::Version
|
101
89
|
version: '0'
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
|
-
- -
|
94
|
+
- - '>='
|
108
95
|
- !ruby/object:Gem::Version
|
109
96
|
version: '0'
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: guard-rspec
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
|
-
- -
|
101
|
+
- - '>='
|
116
102
|
- !ruby/object:Gem::Version
|
117
103
|
version: '0'
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
|
-
- -
|
108
|
+
- - '>='
|
124
109
|
- !ruby/object:Gem::Version
|
125
110
|
version: '0'
|
126
111
|
- !ruby/object:Gem::Dependency
|
127
112
|
name: guard-spork
|
128
113
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
114
|
requirements:
|
131
|
-
- -
|
115
|
+
- - '>='
|
132
116
|
- !ruby/object:Gem::Version
|
133
117
|
version: '0'
|
134
118
|
type: :development
|
135
119
|
prerelease: false
|
136
120
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
121
|
requirements:
|
139
|
-
- -
|
122
|
+
- - '>='
|
140
123
|
- !ruby/object:Gem::Version
|
141
124
|
version: '0'
|
142
125
|
- !ruby/object:Gem::Dependency
|
143
126
|
name: coveralls
|
144
127
|
requirement: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
|
-
requirements:
|
147
|
-
- - ! '>='
|
148
|
-
- !ruby/object:Gem::Version
|
149
|
-
version: '0'
|
150
|
-
type: :development
|
151
|
-
prerelease: false
|
152
|
-
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
|
-
requirements:
|
155
|
-
- - ! '>='
|
156
|
-
- !ruby/object:Gem::Version
|
157
|
-
version: '0'
|
158
|
-
- !ruby/object:Gem::Dependency
|
159
|
-
name: sqlite3
|
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: better_errors
|
176
|
-
requirement: !ruby/object:Gem::Requirement
|
177
|
-
none: false
|
178
128
|
requirements:
|
179
|
-
- -
|
129
|
+
- - '>='
|
180
130
|
- !ruby/object:Gem::Version
|
181
131
|
version: '0'
|
182
132
|
type: :development
|
183
133
|
prerelease: false
|
184
134
|
version_requirements: !ruby/object:Gem::Requirement
|
185
|
-
none: false
|
186
135
|
requirements:
|
187
|
-
- -
|
136
|
+
- - '>='
|
188
137
|
- !ruby/object:Gem::Version
|
189
138
|
version: '0'
|
190
139
|
- !ruby/object:Gem::Dependency
|
191
|
-
name:
|
140
|
+
name: pry
|
192
141
|
requirement: !ruby/object:Gem::Requirement
|
193
|
-
none: false
|
194
142
|
requirements:
|
195
|
-
- -
|
143
|
+
- - '>='
|
196
144
|
- !ruby/object:Gem::Version
|
197
145
|
version: '0'
|
198
146
|
type: :development
|
199
147
|
prerelease: false
|
200
148
|
version_requirements: !ruby/object:Gem::Requirement
|
201
|
-
none: false
|
202
149
|
requirements:
|
203
|
-
- -
|
150
|
+
- - '>='
|
204
151
|
- !ruby/object:Gem::Version
|
205
152
|
version: '0'
|
206
153
|
- !ruby/object:Gem::Dependency
|
207
|
-
name:
|
208
|
-
requirement: !ruby/object:Gem::Requirement
|
209
|
-
none: false
|
210
|
-
requirements:
|
211
|
-
- - ! '>='
|
212
|
-
- !ruby/object:Gem::Version
|
213
|
-
version: '0'
|
214
|
-
type: :development
|
215
|
-
prerelease: false
|
216
|
-
version_requirements: !ruby/object:Gem::Requirement
|
217
|
-
none: false
|
218
|
-
requirements:
|
219
|
-
- - ! '>='
|
220
|
-
- !ruby/object:Gem::Version
|
221
|
-
version: '0'
|
222
|
-
- !ruby/object:Gem::Dependency
|
223
|
-
name: yard
|
224
|
-
requirement: !ruby/object:Gem::Requirement
|
225
|
-
none: false
|
226
|
-
requirements:
|
227
|
-
- - ! '>='
|
228
|
-
- !ruby/object:Gem::Version
|
229
|
-
version: '0'
|
230
|
-
type: :development
|
231
|
-
prerelease: false
|
232
|
-
version_requirements: !ruby/object:Gem::Requirement
|
233
|
-
none: false
|
234
|
-
requirements:
|
235
|
-
- - ! '>='
|
236
|
-
- !ruby/object:Gem::Version
|
237
|
-
version: '0'
|
238
|
-
- !ruby/object:Gem::Dependency
|
239
|
-
name: quiet_assets
|
240
|
-
requirement: !ruby/object:Gem::Requirement
|
241
|
-
none: false
|
242
|
-
requirements:
|
243
|
-
- - ! '>='
|
244
|
-
- !ruby/object:Gem::Version
|
245
|
-
version: '0'
|
246
|
-
type: :development
|
247
|
-
prerelease: false
|
248
|
-
version_requirements: !ruby/object:Gem::Requirement
|
249
|
-
none: false
|
250
|
-
requirements:
|
251
|
-
- - ! '>='
|
252
|
-
- !ruby/object:Gem::Version
|
253
|
-
version: '0'
|
254
|
-
- !ruby/object:Gem::Dependency
|
255
|
-
name: thin
|
154
|
+
name: sqlite3
|
256
155
|
requirement: !ruby/object:Gem::Requirement
|
257
|
-
none: false
|
258
156
|
requirements:
|
259
|
-
- -
|
157
|
+
- - '>='
|
260
158
|
- !ruby/object:Gem::Version
|
261
159
|
version: '0'
|
262
160
|
type: :development
|
263
161
|
prerelease: false
|
264
162
|
version_requirements: !ruby/object:Gem::Requirement
|
265
|
-
none: false
|
266
163
|
requirements:
|
267
|
-
- -
|
164
|
+
- - '>='
|
268
165
|
- !ruby/object:Gem::Version
|
269
166
|
version: '0'
|
270
167
|
description: Produce Bootstrap html with semantic helper methods.
|
@@ -330,27 +227,25 @@ files:
|
|
330
227
|
- README.md
|
331
228
|
homepage: https://github.com/stevedowney/bootstrap-view-helpers
|
332
229
|
licenses: []
|
230
|
+
metadata: {}
|
333
231
|
post_install_message:
|
334
232
|
rdoc_options: []
|
335
233
|
require_paths:
|
336
234
|
- lib
|
337
235
|
required_ruby_version: !ruby/object:Gem::Requirement
|
338
|
-
none: false
|
339
236
|
requirements:
|
340
|
-
- -
|
237
|
+
- - '>='
|
341
238
|
- !ruby/object:Gem::Version
|
342
239
|
version: '0'
|
343
240
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
344
|
-
none: false
|
345
241
|
requirements:
|
346
|
-
- -
|
242
|
+
- - '>='
|
347
243
|
- !ruby/object:Gem::Version
|
348
244
|
version: '0'
|
349
245
|
requirements: []
|
350
246
|
rubyforge_project:
|
351
|
-
rubygems_version:
|
247
|
+
rubygems_version: 2.0.14
|
352
248
|
signing_key:
|
353
|
-
specification_version:
|
249
|
+
specification_version: 4
|
354
250
|
summary: Rails view helpers for Bootstrap
|
355
251
|
test_files: []
|
356
|
-
has_rdoc:
|