effective_bootstrap 1.19.9 → 1.19.11
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/app/helpers/effective_bootstrap_helper.rb +9 -4
- data/lib/effective_bootstrap/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: e4cb4c2ce75f80f7ba3b04734d1bfa31ab410bab84b370f141e547b82aba67a8
|
4
|
+
data.tar.gz: eaff1ef48a5e692d004e5f2c3417dc268fa826b5d074c74d58d515ec781ffd5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76be91962e5003b8f8dc7988e92d778677cf546752c7384a2cd89229ade0233c640efec92e7230b069483c840fdbab522dc46d987bb0eef3af57ce232cb9bf0d
|
7
|
+
data.tar.gz: 6481c5f53c327a6df5e25147606f358be60256e4661c21fc62fcd3b23a164291102854da5c70be3f3a5304eeca2589ed5b5c24ba269ad4ed6b8db2c824a9dfce
|
@@ -340,8 +340,7 @@ module EffectiveBootstrapHelper
|
|
340
340
|
end
|
341
341
|
end
|
342
342
|
|
343
|
-
|
344
|
-
def nav_dropdown(label, right: false, groups: false, link_class: [], list_class: [], &block)
|
343
|
+
def nav_dropdown(label, right: false, groups: false, sort: false, link_class: [], list_class: [], &block)
|
345
344
|
raise 'expected a block' unless block_given?
|
346
345
|
|
347
346
|
id = "dropdown-#{effective_bootstrap_unique_id}"
|
@@ -354,11 +353,16 @@ module EffectiveBootstrapHelper
|
|
354
353
|
|
355
354
|
return ''.html_safe if content.blank?
|
356
355
|
|
356
|
+
if sort && !content.include?('dropdown-divider')
|
357
|
+
lines = content.gsub("\n", '').split("</a>").reject(&:blank?).map { |line| line + "</a>" }
|
358
|
+
content = lines.sort_by { |line| line.match(/<a[^>]*>([^<]*)<\/a>/)[1] || '' }.join("</a>\n")
|
359
|
+
end
|
360
|
+
|
357
361
|
content_tag(:li, class: 'nav-item dropdown') do
|
358
362
|
content_tag(:a, class: 'nav-link dropdown-toggle', href: '#', id: id, role: 'button', 'data-toggle': 'dropdown', 'aria-haspopup': true, 'aria-expanded': false) do
|
359
363
|
label.html_safe
|
360
364
|
end + content_tag(:div, class: div_class, 'aria-labelledby': id) do
|
361
|
-
content
|
365
|
+
content.html_safe
|
362
366
|
end
|
363
367
|
end
|
364
368
|
end
|
@@ -632,7 +636,8 @@ module EffectiveBootstrapHelper
|
|
632
636
|
|
633
637
|
def tab(resource, opts = {}, &block)
|
634
638
|
return if resource.kind_of?(Class) && !EffectiveResources.authorized?(self, :index, resource)
|
635
|
-
|
639
|
+
plural = resource.kind_of?(ActiveRecord::Base) == false
|
640
|
+
label = opts[:label] || effective_bootstrap_human_name(resource, plural: opts.fetch(:plural, plural), prefer_model_name: true)
|
636
641
|
|
637
642
|
(@_tab_labels.push(label) and return) if @_tab_mode == :validate
|
638
643
|
|
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: 1.19.
|
4
|
+
version: 1.19.11
|
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:
|
11
|
+
date: 2025-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|