effective_bootstrap 0.12.3 → 0.12.4
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 +28 -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: a26936633589ef2e153a0e049c3fa824a1fcc76dcadc9d07e20b1fb8603328c8
|
|
4
|
+
data.tar.gz: 9a6b89211ee2177686cc617b4a283935e6c22130388f342a5207f6e1a7fbac0e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c111066e4ccaa58c9369bc153abd4951aa20cc935f5c7c96f8e5a6888e4492bfaa0d0be182c73820bf7687fa3d20337aa02773ecb07108bcbba47a8bec667d66
|
|
7
|
+
data.tar.gz: 05d73aa6f587cf17970441864442f075e211b53f356a9c8e91bf66bcbc79a6e6c1f34aaa9e183112ada7611962d5e2e8eb027ab79c24465865048d008c19ca51
|
|
@@ -316,7 +316,7 @@ module EffectiveBootstrapHelper
|
|
|
316
316
|
def nav_link_to(resource, path, opts = {})
|
|
317
317
|
return if resource.kind_of?(Class) && !EffectiveResources.authorized?(self, :index, resource)
|
|
318
318
|
|
|
319
|
-
label = effective_bootstrap_human_name(resource, plural: true, prefer_model_name: true)
|
|
319
|
+
label = opts.delete(:label) || effective_bootstrap_human_name(resource, plural: true, prefer_model_name: true)
|
|
320
320
|
|
|
321
321
|
if @_nav_mode == :dropdown # We insert dropdown-items
|
|
322
322
|
return link_to(label, path, merge_class_key(opts, 'dropdown-item'))
|
|
@@ -331,6 +331,7 @@ module EffectiveBootstrapHelper
|
|
|
331
331
|
end
|
|
332
332
|
end
|
|
333
333
|
|
|
334
|
+
|
|
334
335
|
def nav_dropdown(label, right: false, groups: false, link_class: [], list_class: [], &block)
|
|
335
336
|
raise 'expected a block' unless block_given?
|
|
336
337
|
|
|
@@ -371,6 +372,25 @@ module EffectiveBootstrapHelper
|
|
|
371
372
|
content_tag(:div, '', class: 'dropdown-divider')
|
|
372
373
|
end
|
|
373
374
|
|
|
375
|
+
# These two are used for advanced menus. When using content_for to capture inside nav dropdowns
|
|
376
|
+
def nav_content_for(name, &block)
|
|
377
|
+
raise('expected a block') unless block_given?
|
|
378
|
+
content_for(name) { yield }
|
|
379
|
+
end
|
|
380
|
+
|
|
381
|
+
def nav_dropdown_content_for(name, &block)
|
|
382
|
+
raise('expected a block') unless block_given?
|
|
383
|
+
|
|
384
|
+
original = @_nav_mode
|
|
385
|
+
|
|
386
|
+
begin
|
|
387
|
+
@_nav_mode = :dropdown
|
|
388
|
+
content_for(name) { yield }
|
|
389
|
+
ensure
|
|
390
|
+
@_nav_mode = original
|
|
391
|
+
end
|
|
392
|
+
end
|
|
393
|
+
|
|
374
394
|
# Breadcrumb
|
|
375
395
|
#
|
|
376
396
|
# https://getbootstrap.com/docs/4.0/components/breadcrumb/
|
|
@@ -631,9 +651,13 @@ module EffectiveBootstrapHelper
|
|
|
631
651
|
end
|
|
632
652
|
|
|
633
653
|
def effective_bootstrap_human_name(resource, plural: false, prefer_model_name: false)
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
654
|
+
if resource.kind_of?(String)
|
|
655
|
+
resource
|
|
656
|
+
elsif resource.respond_to?(:datatable_name)
|
|
657
|
+
et(resource)
|
|
658
|
+
elsif resource.respond_to?(:model_name) == false
|
|
659
|
+
resource.to_s
|
|
660
|
+
elsif resource.kind_of?(ActiveRecord::Relation) || plural
|
|
637
661
|
ets(resource)
|
|
638
662
|
elsif resource.kind_of?(Class) || prefer_model_name
|
|
639
663
|
et(resource)
|
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.12.
|
|
4
|
+
version: 0.12.4
|
|
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: 2023-03-
|
|
11
|
+
date: 2023-03-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|