effective_bootstrap 1.19.9 → 1.19.11

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: 8692390c09e3355687ccd1c09125b803b44314fad79874fbaeeb0b0001035810
4
- data.tar.gz: 267e98689b2c21549b4710f8e5fbbd3d56291055bab497399a99ce258427f97d
3
+ metadata.gz: e4cb4c2ce75f80f7ba3b04734d1bfa31ab410bab84b370f141e547b82aba67a8
4
+ data.tar.gz: eaff1ef48a5e692d004e5f2c3417dc268fa826b5d074c74d58d515ec781ffd5b
5
5
  SHA512:
6
- metadata.gz: a2942153086a3e8489bd8f6bf0264927e918ace32a9b80950224e0ff9592fbac8b2781985e9facc9da659c4dd75db27fa1d42b49f4f1add1563a2192e918c8ac
7
- data.tar.gz: 682082c51cd0606ee83c4840a55247fa40db8914e1ead288498e2338ce93cf49054363bdb7ca0b3a3939515bce3678c24d8c87ebb3ff78b0dacd250bce5928cd
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
- label = opts[:label] || effective_bootstrap_human_name(resource, plural: opts.fetch(:plural, true), prefer_model_name: true)
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
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '1.19.9'.freeze
2
+ VERSION = '1.19.11'.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: 1.19.9
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: 2024-11-16 00:00:00.000000000 Z
11
+ date: 2025-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails