bootstrap-navbar 3.0.7 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31c1c11b16764f02d05e907c90ec1485dc0ca435032b1492d873f3d79c3818c6
4
- data.tar.gz: 1e8dfe8093cc0455703c9ce05eb80590ade4bcb93f8b01fc53d8fd7f3b41595d
3
+ metadata.gz: 1c052de755ae4a79228172a5542806fcbc43b938203d6d9791d210543bb14d72
4
+ data.tar.gz: 46311e56c6a5e5dc824db02ca9377c8c1798d046807103aaf7428960b696b3bf
5
5
  SHA512:
6
- metadata.gz: 1f5b2f052f44d4c98533712ed45e6fe323c1d15a6f041d7e1a67cb8590122bc12cbbc9b4564995da40280c194b58500855609257be197f08928013547b011064
7
- data.tar.gz: 65ceeca8fe2f44d3ca81fecc926876936bf7b1907adbd35061befddea130d7d4593e8a8726b0d3e79701c21c64d8320792c419465e83a5b31013a97c9fca5e9a
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, id = '', list_item_options = {}, link_options = {}, &block)
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" id="##{id}" aria-haspopup="true" aria-expanded="false" role="button" #{link_attributes}>#{text}</a>
96
- <div class="#{wrapper_class}" aria-labelledby="#{id}">
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 = '#', link_options = {}, &block)
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
- options[:class] << "navbar-expand-#{options.delete(:expand_at) || 'sm'}"
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
@@ -1,3 +1,3 @@
1
1
  module BootstrapNavbar
2
- VERSION = '3.0.7'
2
+ VERSION = '3.1.0'
3
3
  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.7
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-08 00:00:00.000000000 Z
11
+ date: 2020-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake