effective_bootstrap 0.11.8 → 0.11.9

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: bc5a602d272dab4bd512f869abf586e9d03fc92f81318c0a78de81eeff9e89be
4
- data.tar.gz: da950591d1428bbc17466336bf128c398418587c84e482df57f916967b7c8c1f
3
+ metadata.gz: 6c71ab1abee21be75ec4450b3114102423c80406e6f4044cc2df66701a7cc240
4
+ data.tar.gz: 33d53327b54d4f4ffbf698caea2cea2054af49e00b02a897d68403beffc847b5
5
5
  SHA512:
6
- metadata.gz: e6eedc89dad5f41d15b646f498d87522bcc4585fafed6eab4c5774b77bb7be67571c0fa1c279c0b9cd741e49960d9a64306a2c7b6571b8d2268499b870c3d1cc
7
- data.tar.gz: 2bc439caa18ce63f91fd6836913fa449ee703a776064e4ff5e96391cb4ecb54b20cac9bab21c70047253dba5cc9fb6e599d29a41f2f9cbfb9b15a2cf1aada706
6
+ metadata.gz: fad4fdfca2b4aa40955ed2a0f0a1e568d4df137a6da0286786f7d0ab5bef9a2fd5e71f170535deb388578b0fb3a264baa57e9c27c072d38c578a0c36715b3057
7
+ data.tar.gz: ef4bb529df44b363fac0588b91bdb6787571a2e1908ed58010a4faca953e540fe5dd1f874816bf275185a30eacdae403906b8956d7f4fa3ff9d882b8407ebc8d
@@ -325,20 +325,42 @@ module EffectiveBootstrapHelper
325
325
  end
326
326
  end
327
327
 
328
- def nav_dropdown(label, right: false, link_class: [], list_class: [], &block)
328
+ def nav_dropdown(label, right: false, groups: false, link_class: [], list_class: [], &block)
329
329
  raise 'expected a block' unless block_given?
330
330
 
331
331
  id = "dropdown-#{effective_bootstrap_unique_id}"
332
+ div_class = ['dropdown-menu', *('dropdown-menu-right' if right), *('dropdown-groups' if groups)].join(' ')
332
333
 
333
334
  content_tag(:li, class: 'nav-item dropdown') do
334
335
  content_tag(:a, class: 'nav-link dropdown-toggle', href: '#', id: id, role: 'button', 'data-toggle': 'dropdown', 'aria-haspopup': true, 'aria-expanded': false) do
335
336
  label.html_safe
336
- end + content_tag(:div, class: (right ? 'dropdown-menu dropdown-menu-right' : 'dropdown-menu'), 'aria-labelledby': id) do
337
+ end + content_tag(:div, class: div_class, 'aria-labelledby': id) do
337
338
  @_nav_mode = :dropdown; yield; @_nav_mode = nil
338
339
  end
339
340
  end
340
341
  end
341
342
 
343
+ def nav_dropdown_group(label, unique: false, header: true, header_class: nil, &block)
344
+ raise 'expected a block' unless block_given?
345
+
346
+ div_class = [
347
+ 'dropdown-group',
348
+ ("dropdown-group-#{effective_bootstrap_unique_id}" if unique),
349
+ ("dropdown-group-first" if label.blank?),
350
+ ("dropdown-group-#{label.to_s.parameterize}" if label.present?)
351
+ ].compact.join(' ')
352
+
353
+ header_class ||= 'dropdown-header'
354
+
355
+ content_tag(:div, class: div_class) do
356
+ if label.present? && header
357
+ content_tag(:h6, label, class: header_class) + capture(&block)
358
+ else
359
+ capture(&block)
360
+ end
361
+ end
362
+ end
363
+
342
364
  def nav_divider
343
365
  content_tag(:div, '', class: 'dropdown-divider')
344
366
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '0.11.8'.freeze
2
+ VERSION = '0.11.9'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.8
4
+ version: 0.11.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-28 00:00:00.000000000 Z
11
+ date: 2022-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails