bootstrap-navbar 3.0.5 → 3.0.6
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 +4 -4
- data/lib/bootstrap-navbar/helpers.rb +1 -1
- data/lib/bootstrap-navbar/helpers/bootstrap4.rb +71 -60
- data/lib/bootstrap-navbar/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 503df312703c1b1e21ba7c001b5cb57eb622f265e25c4387459c792375b2202a
|
4
|
+
data.tar.gz: 15d6d53635832ca900705bec6363c8823d1e0c17da181bdba4d0e0a507d02b13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e60999f19b6ed1f441d1886db34118a4c92f98b13856ecddd50061b2dd1445e1e62c3c0f04ffbcf5664df83bc054e0650a8ce21178d0b8b472386dc097f4cb95
|
7
|
+
data.tar.gz: b6ae2867cd7d0c87de839fa16676b35917c4500fb9063f8c83532da7e727e2f1a441840b22999978c34c2901d41860d1321c630b5bd0fe1bfc74c3ec50aa418a
|
@@ -2,11 +2,26 @@ module BootstrapNavbar::Helpers::Bootstrap4
|
|
2
2
|
def navbar(options = {}, &block)
|
3
3
|
options = options.dup
|
4
4
|
container = options.key?(:container) ? options.delete(:container) : false
|
5
|
+
brand = if options[:brand]
|
6
|
+
prepare_html <<~HTML
|
7
|
+
<a href="#{options.delete(:brand_url) || '/'}" class="navbar-brand">
|
8
|
+
#{options.delete(:brand)}
|
9
|
+
</a>
|
10
|
+
HTML
|
11
|
+
end
|
5
12
|
wrapper options do
|
6
13
|
if container
|
7
|
-
container
|
14
|
+
container container do
|
15
|
+
prepare_html <<~HTML
|
16
|
+
#{brand}
|
17
|
+
#{capture(&block) if block_given?}
|
18
|
+
HTML
|
19
|
+
end
|
8
20
|
else
|
9
|
-
|
21
|
+
prepare_html <<~HTML
|
22
|
+
#{brand}
|
23
|
+
#{capture(&block) if block_given?}
|
24
|
+
HTML
|
10
25
|
end
|
11
26
|
end
|
12
27
|
end
|
@@ -26,25 +41,25 @@ module BootstrapNavbar::Helpers::Bootstrap4
|
|
26
41
|
'aria-expanded' => false,
|
27
42
|
'aria-label' => 'Toggle navigation'
|
28
43
|
)
|
29
|
-
prepare_html
|
30
|
-
<button#{toggler_attributes}>
|
31
|
-
|
32
|
-
</button>
|
33
|
-
<div#{attributes}>
|
34
|
-
|
35
|
-
</div>
|
36
|
-
HTML
|
44
|
+
prepare_html <<~HTML
|
45
|
+
<button#{toggler_attributes}>
|
46
|
+
<span class="navbar-toggler-icon"></span>
|
47
|
+
</button>
|
48
|
+
<div#{attributes}>
|
49
|
+
#{capture(&block) if block_given?}
|
50
|
+
</div>
|
51
|
+
HTML
|
37
52
|
end
|
38
53
|
|
39
54
|
def navbar_group(options = {}, &block)
|
40
55
|
options = options.dup
|
41
56
|
options[:class] = [options[:class], 'navbar-nav'].compact.join(' ')
|
42
57
|
attributes = attributes_for_tag(options)
|
43
|
-
prepare_html
|
44
|
-
<ul#{attributes}>
|
45
|
-
|
46
|
-
</ul>
|
47
|
-
HTML
|
58
|
+
prepare_html <<~HTML
|
59
|
+
<ul#{attributes}>
|
60
|
+
#{capture(&block) if block_given?}
|
61
|
+
</ul>
|
62
|
+
HTML
|
48
63
|
end
|
49
64
|
|
50
65
|
def navbar_item(text, url = nil, list_item_options = nil, link_options = nil, &block)
|
@@ -58,13 +73,13 @@ HTML
|
|
58
73
|
link_options[:class] = link_options[:class].join(' ')
|
59
74
|
list_item_attributes = attributes_for_tag(list_item_options)
|
60
75
|
link_attributes = attributes_for_tag(link_options)
|
61
|
-
prepare_html
|
62
|
-
<li#{list_item_attributes}>
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
</li>
|
67
|
-
HTML
|
76
|
+
prepare_html <<~HTML
|
77
|
+
<li#{list_item_attributes}>
|
78
|
+
<a href="#{url}"#{link_attributes}>
|
79
|
+
#{text}
|
80
|
+
</a>
|
81
|
+
</li>
|
82
|
+
HTML
|
68
83
|
end
|
69
84
|
|
70
85
|
def navbar_dropdown(text, id = '', list_item_options = {}, link_options = {}, &block)
|
@@ -75,14 +90,14 @@ HTML
|
|
75
90
|
link_options[:class] = [link_options[:class], 'nav-link', 'dropdown-toggle'].compact.join(' ')
|
76
91
|
id ||= "navbarDropdownMenuLink#{text}"
|
77
92
|
link_attributes = attributes_for_tag(link_options)
|
78
|
-
prepare_html
|
79
|
-
<li#{list_item_attributes}>
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
</li>
|
85
|
-
HTML
|
93
|
+
prepare_html <<~HTML
|
94
|
+
<li#{list_item_attributes}>
|
95
|
+
<a href="#" data-toggle="dropdown" id="##{id}" aria-haspopup="true" aria-expanded="false" role="button" #{link_attributes}>#{text}</a>
|
96
|
+
<div class="#{wrapper_class}" aria-labelledby="#{id}">
|
97
|
+
#{capture(&block) if block_given?}
|
98
|
+
</div>
|
99
|
+
</li>
|
100
|
+
HTML
|
86
101
|
end
|
87
102
|
|
88
103
|
def navbar_dropdown_item(text, url = '#', link_options = {}, &block)
|
@@ -91,42 +106,39 @@ HTML
|
|
91
106
|
link_options[:class] << 'active' if current_url_or_sub_url?(url)
|
92
107
|
link_options[:class] = link_options[:class].join(' ')
|
93
108
|
link_attributes = attributes_for_tag(link_options)
|
94
|
-
prepare_html
|
95
|
-
<a href="#{url}"#{link_attributes}>
|
96
|
-
|
97
|
-
</a>
|
98
|
-
|
109
|
+
prepare_html <<~HTML
|
110
|
+
<a href="#{url}"#{link_attributes}>
|
111
|
+
#{text}
|
112
|
+
</a>
|
113
|
+
HTML
|
99
114
|
end
|
100
115
|
|
101
116
|
def navbar_dropdown_divider
|
102
|
-
|
103
|
-
<div class="dropdown-divider"></div>
|
104
|
-
HTML
|
117
|
+
'<div class="dropdown-divider"></div>'
|
105
118
|
end
|
106
119
|
|
107
120
|
private
|
108
121
|
|
109
|
-
def container(&block)
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
#{text}
|
121
|
-
</a>
|
122
|
-
HTML
|
122
|
+
def container(container, &block)
|
123
|
+
container_class = [
|
124
|
+
'container',
|
125
|
+
(container unless container == true)
|
126
|
+
].compact.join('-')
|
127
|
+
attributes = attributes_for_tag(class: container_class)
|
128
|
+
prepare_html <<~HTML
|
129
|
+
<div#{attributes}>
|
130
|
+
#{capture(&block) if block_given?}
|
131
|
+
</div>
|
132
|
+
HTML
|
123
133
|
end
|
124
134
|
|
125
135
|
def wrapper(options, &block)
|
126
136
|
options = options.dup
|
127
137
|
options[:class] = [options[:class], 'navbar'].compact
|
128
138
|
options[:class] << "navbar-#{options.key?(:color_scheme) ? options.delete(:color_scheme) : 'dark'}"
|
129
|
-
|
139
|
+
if bg = options.delete(:bg)
|
140
|
+
options[:class] << "bg-#{bg == true ? 'dark' : bg}"
|
141
|
+
end
|
130
142
|
if options.key?(:sticky) && options.delete(:sticky) === true
|
131
143
|
options[:class] << 'sticky-top'
|
132
144
|
elsif options.key?(:placement)
|
@@ -134,13 +146,12 @@ HTML
|
|
134
146
|
end
|
135
147
|
options[:class] << "navbar-expand-#{options.delete(:expand_at) || 'sm'}"
|
136
148
|
options[:class] = options[:class].join(' ')
|
137
|
-
brand = brand_link(options.delete(:brand), options.delete(:brand_url)) if options[:brand]
|
138
149
|
attributes = attributes_for_tag(options)
|
139
|
-
prepare_html
|
140
|
-
<nav#{attributes}>
|
141
|
-
|
142
|
-
|
143
|
-
</nav>
|
144
|
-
HTML
|
150
|
+
prepare_html <<~HTML
|
151
|
+
<nav#{attributes}>
|
152
|
+
#{brand}
|
153
|
+
#{capture(&block) if block_given?}
|
154
|
+
</nav>
|
155
|
+
HTML
|
145
156
|
end
|
146
157
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootstrap-navbar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manuel Meurer
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -153,7 +153,7 @@ homepage: http://bootstrap-ruby.github.io/bootstrap-navbar
|
|
153
153
|
licenses:
|
154
154
|
- MIT
|
155
155
|
metadata: {}
|
156
|
-
post_install_message:
|
156
|
+
post_install_message:
|
157
157
|
rdoc_options: []
|
158
158
|
require_paths:
|
159
159
|
- lib
|
@@ -168,8 +168,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
168
|
- !ruby/object:Gem::Version
|
169
169
|
version: '0'
|
170
170
|
requirements: []
|
171
|
-
rubygems_version: 3.
|
172
|
-
signing_key:
|
171
|
+
rubygems_version: 3.1.3
|
172
|
+
signing_key:
|
173
173
|
specification_version: 4
|
174
174
|
summary: Helpers to generate a Bootstrap style navbar
|
175
175
|
test_files:
|