bootstrap-navbar 3.0.7 → 3.1.0
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/bootstrap4.rb +16 -8
- data/lib/bootstrap-navbar/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c052de755ae4a79228172a5542806fcbc43b938203d6d9791d210543bb14d72
|
4
|
+
data.tar.gz: 46311e56c6a5e5dc824db02ca9377c8c1798d046807103aaf7428960b696b3bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14629006361ae67397f55ba652a84845ba4ef1ae505a52c29f3c7486b19e078e8d796453cb880921b393dbe157e80ac7020438e040d49222bc363d13cafb04c6
|
7
|
+
data.tar.gz: 61cdb5083e9b9421df76db12078d3ef12faf735fe53ecafd3fdfaece19502a040314ae6615d0f390e77a715431198ac42a926260e7e1d7f46f4d3415994e723e
|
@@ -63,7 +63,7 @@ module BootstrapNavbar::Helpers::Bootstrap4
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def navbar_item(text, url = nil, list_item_options = nil, link_options = nil, &block)
|
66
|
-
text, url, list_item_options, link_options = capture(&block), text, url, list_item_options if block_given?
|
66
|
+
text, url, list_item_options, link_options = capture(&block), text, (url || {}), list_item_options if block_given?
|
67
67
|
url ||= '#'
|
68
68
|
list_item_options = list_item_options ? list_item_options.dup : {}
|
69
69
|
link_options = link_options ? link_options.dup : {}
|
@@ -82,25 +82,30 @@ module BootstrapNavbar::Helpers::Bootstrap4
|
|
82
82
|
HTML
|
83
83
|
end
|
84
84
|
|
85
|
-
def navbar_dropdown(text,
|
85
|
+
def navbar_dropdown(text, list_item_options = {}, link_options = {}, wrapper_options = {}, &block)
|
86
86
|
list_item_options, link_options = list_item_options.dup, link_options.dup
|
87
87
|
list_item_options[:class] = [list_item_options[:class], 'nav-item', 'dropdown'].compact.join(' ')
|
88
|
-
wrapper_class = [*list_item_options.delete(:wrapper_class), 'dropdown-menu'].compact.join(' ')
|
89
88
|
list_item_attributes = attributes_for_tag(list_item_options)
|
90
89
|
link_options[:class] = [link_options[:class], 'nav-link', 'dropdown-toggle'].compact.join(' ')
|
91
|
-
id ||= "navbarDropdownMenuLink#{text}"
|
92
90
|
link_attributes = attributes_for_tag(link_options)
|
91
|
+
wrapper_options = { class: [*wrapper_options.delete(:class), 'dropdown-menu'].compact.join(' ') }
|
92
|
+
if id = link_options[:id]
|
93
|
+
wrapper_options[:'aria-labelledby'] = id
|
94
|
+
end
|
95
|
+
wrapper_attributes = attributes_for_tag(wrapper_options)
|
93
96
|
prepare_html <<~HTML
|
94
97
|
<li#{list_item_attributes}>
|
95
|
-
<a href="#" data-toggle="dropdown"
|
96
|
-
<div
|
98
|
+
<a href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" role="button"#{link_attributes}>#{text}</a>
|
99
|
+
<div#{wrapper_attributes}>
|
97
100
|
#{capture(&block) if block_given?}
|
98
101
|
</div>
|
99
102
|
</li>
|
100
103
|
HTML
|
101
104
|
end
|
102
105
|
|
103
|
-
def navbar_dropdown_item(text, url =
|
106
|
+
def navbar_dropdown_item(text, url = nil, link_options = {}, &block)
|
107
|
+
text, url, link_options = capture(&block), text, (url || {}) if block_given?
|
108
|
+
url ||= '#'
|
104
109
|
link_options = link_options.dup
|
105
110
|
link_options[:class] = [link_options[:class], 'dropdown-item'].compact
|
106
111
|
link_options[:class] << 'active' if current_url_or_sub_url?(url)
|
@@ -144,7 +149,10 @@ module BootstrapNavbar::Helpers::Bootstrap4
|
|
144
149
|
elsif options.key?(:placement)
|
145
150
|
options[:class] << "fixed-#{options.delete(:placement)}"
|
146
151
|
end
|
147
|
-
|
152
|
+
expand_at = options.delete(:expand_at)
|
153
|
+
unless expand_at == true
|
154
|
+
options[:class] << "navbar-expand#{"-#{expand_at}" if expand_at}"
|
155
|
+
end
|
148
156
|
options[:class] = options[:class].join(' ')
|
149
157
|
attributes = attributes_for_tag(options)
|
150
158
|
prepare_html <<~HTML
|
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.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manuel Meurer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|