effective_bootstrap 0.12.2 → 0.12.4

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: 5296ba7292f9b780d79685a52f5c53de73f7fb80de3a099115c7abe559c1d18a
4
- data.tar.gz: 292220fbef842eac68437b113a3500d56e543aa63ee544b72adae14516eef0a5
3
+ metadata.gz: a26936633589ef2e153a0e049c3fa824a1fcc76dcadc9d07e20b1fb8603328c8
4
+ data.tar.gz: 9a6b89211ee2177686cc617b4a283935e6c22130388f342a5207f6e1a7fbac0e
5
5
  SHA512:
6
- metadata.gz: 60dabb6bded71c7ef63cf2db2da7a26c49d87ea8f718b4ef22a2f3ce7bdbf06eec816fa3ec1eae2975c0520e88ac1d88ca6f2cef10061b7ba1bb4eb6a76cd284
7
- data.tar.gz: d24add4acadda8aa959bbd93efbcdacfc687220106377dc6ec79061bdc0dd7c8e7d87ad6f3ce320ba711cfe48f61379a6b37fd1fd2a4260badcca5a7d7235c14
6
+ metadata.gz: c111066e4ccaa58c9369bc153abd4951aa20cc935f5c7c96f8e5a6888e4492bfaa0d0be182c73820bf7687fa3d20337aa02773ecb07108bcbba47a8bec667d66
7
+ data.tar.gz: 05d73aa6f587cf17970441864442f075e211b53f356a9c8e91bf66bcbc79a6e6c1f34aaa9e183112ada7611962d5e2e8eb027ab79c24465865048d008c19ca51
@@ -1,5 +1,5 @@
1
1
  (this.EffectiveBootstrap || {}).effective_hide_if = ($element, options) ->
2
- $affects = $element.closest('form').find("input[name='#{options.name}'],select[name='#{options.name}']")
2
+ $affects = $element.closest('form,div.effective-datatables-filters').find("input[name='#{options.name}'],select[name='#{options.name}']")
3
3
 
4
4
  $affects.on 'change', (event) ->
5
5
  $target = $(event.target)
@@ -23,7 +23,7 @@
23
23
 
24
24
 
25
25
  (this.EffectiveBootstrap || {}).effective_show_if = ($element, options) ->
26
- $affects = $element.closest('form').find("input[name='#{options.name}'],select[name='#{options.name}']")
26
+ $affects = $element.closest('form,div.effective-datatables-filters').find("input[name='#{options.name}'],select[name='#{options.name}']")
27
27
 
28
28
  $affects.on 'change', (event) ->
29
29
  $target = $(event.target)
@@ -46,7 +46,7 @@
46
46
  $element.find('input,textarea,select,button').prop('disabled', true)
47
47
 
48
48
  (this.EffectiveBootstrap || {}).effective_show_if_any = ($element, options) ->
49
- $affects = $element.closest('form').find("input[name='#{options.name}'],select[name='#{options.name}']")
49
+ $affects = $element.closest('form,div.effective-datatables-filters').find("input[name='#{options.name}'],select[name='#{options.name}']")
50
50
  values = JSON.parse(options.value)
51
51
 
52
52
  $affects.on 'change', (event) ->
@@ -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
- return resource.to_s unless resource.respond_to?(:model_name)
635
-
636
- if resource.kind_of?(ActiveRecord::Relation) || plural
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)
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '0.12.2'.freeze
2
+ VERSION = '0.12.4'.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.12.2
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-02-15 00:00:00.000000000 Z
11
+ date: 2023-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails