effective_bootstrap 0.6.24 → 0.6.29

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: 890a186876e731a63911b2315397482879db023570b38177f849ddfe3d262c63
4
- data.tar.gz: b3fef68f79fa022df72c873fa219ddafa7ffd7d3688cdcf32889c58cc6836817
3
+ metadata.gz: c26dafae8b20f6de729f010e19ba6690ccc45257fd7151fea3d7175715ae7a7d
4
+ data.tar.gz: 218ed4f9c1c4a0e8727bdd9af016829cfcb18f310004f3b3307a23b90d9e91ba
5
5
  SHA512:
6
- metadata.gz: 526a608720159a66c91c9a58db1cd30bbdd61a4584155572582f54b864b2882c11a0bec0df629c4c037e417cc743e2b7aabcc513d3b963744cfbc717fddb7f88
7
- data.tar.gz: 3c6a4025acab54296be4d4aae3466c082aee32a6ee8ac69000fe3716a1d79dbce81e905e2d28c29a717094e66a9ab3da58abbaaeba3b96ff4d23210b97d546b8
6
+ metadata.gz: 0416207fe706d79b6cdecb1bc7d424f33786ec91ca26e887c93d8036339060854ca9d23d3e76072939b37ecddda44c6a1e19c380207b81c4e3c6571ed909539b
7
+ data.tar.gz: 45aa015d4e1648f49c7bad6909bc5ce1e6ee61d92fb93f9613253d719f1b8e38cc474578283ffc7e7a68d9dcfde02eabe4134c5853daf0beace9e88170bcecd0
@@ -2,7 +2,14 @@
2
2
  $affects = $element.closest('form').find("input[name='#{options.name}'],select[name='#{options.name}']")
3
3
 
4
4
  $affects.on 'change', (event) ->
5
- if $(event.target).val() == options.value
5
+ $target = $(event.target)
6
+ matches = ($target.val() == options.value)
7
+
8
+ if $target.is("[type='checkbox']")
9
+ matches = matches || ($target.is(':checked') && "#{options.value}" == 'true')
10
+ matches = matches || (!$target.is(':checked') && ("#{options.value}" == 'false' || "#{options.value}" == ''))
11
+
12
+ if matches
6
13
  $element.hide()
7
14
  $element.find('input,textarea,select').prop('disabled', true)
8
15
  else
@@ -18,7 +25,14 @@
18
25
  $affects = $element.closest('form').find("input[name='#{options.name}'],select[name='#{options.name}']")
19
26
 
20
27
  $affects.on 'change', (event) ->
21
- if $(event.target).val() == options.value
28
+ $target = $(event.target)
29
+ matches = ($target.val() == options.value)
30
+
31
+ if $target.is("[type='checkbox']")
32
+ matches = matches || ($target.is(':checked') && "#{options.value}" == 'true')
33
+ matches = matches || (!$target.is(':checked') && ("#{options.value}" == 'false' || "#{options.value}" == ''))
34
+
35
+ if matches
22
36
  $element.fadeIn()
23
37
  $element.find('input,textarea,select').removeAttr('disabled')
24
38
  else
@@ -1,16 +1,14 @@
1
- let initTabs = function() {
2
- let $tab_with_error = $(".form-control.is-invalid").first().closest('.tab-pane');
1
+ $(document).ready(function() {
2
+ var $tab_with_error = $(".form-control.is-invalid").first().closest('.tab-pane');
3
3
 
4
4
  if ($tab_with_error.length > 0) {
5
5
  $(".nav.nav-tabs").find("a[href^='#" + $tab_with_error.attr('id') + "']").tab('show');
6
6
  } else if (document.location.hash.length > 0) {
7
- let $tab_from_url = $(".nav.nav-tabs").find("a[href^='" + document.location.hash + "']");
7
+ var $tab_from_url = $(".nav.nav-tabs").find("a[href^='" + document.location.hash + "']");
8
8
 
9
9
  if ($tab_from_url.length > 0) {
10
10
  document.location.hash = ""; // This prevents scrolling to the wrong place in the page
11
11
  $tab_from_url.tab("show");
12
12
  }
13
13
  }
14
- }
15
-
16
- $(document).ready(initTabs);
14
+ });
@@ -3,13 +3,6 @@
3
3
  display: flex;
4
4
  align-items: center;
5
5
  position: relative;
6
-
7
- // This is the inline ajax flash next to the save button.
8
- .effective-form-flash {
9
- position: absolute;
10
- top: 3.0em;
11
- z-index: 1;
12
- }
13
6
  }
14
7
 
15
8
  form[data-remote="true"]:not(.show-flash-success) {
@@ -37,7 +37,7 @@ module EffectiveBootstrapHelper
37
37
 
38
38
  link_opts[:class] = opts.delete(:link_class) || 'btn btn-link'
39
39
  div_class = opts.delete(:div_class)
40
- card_class = opts.delete(:card_class) || 'my-2'
40
+ card_class = opts.delete(:card_class) || 'card card-body my-2'
41
41
 
42
42
  if @_accordion_active
43
43
  # Accordion collapse
@@ -55,7 +55,7 @@ module EffectiveBootstrapHelper
55
55
  # Normal collapse
56
56
  content_tag(:a, label, link_opts) +
57
57
  content_tag(:div, id: id, class: ['collapse', div_class, ('show' if show)].compact.join(' ')) do
58
- content_tag(:div, capture(&block), class: ['card', 'card-body', card_class].compact.join(' '))
58
+ content_tag(:div, capture(&block), class: card_class)
59
59
  end
60
60
  end
61
61
  end
@@ -77,7 +77,7 @@ module Effective
77
77
  end
78
78
 
79
79
  if options_collection.kind_of?(Hash)
80
- options_collection[include_null] = [[include_null, 'nil']]
80
+ options_collection[include_null] = [Struct.new(:to_s, :id).new(include_null, 'nil')]
81
81
  end
82
82
 
83
83
  options_collection
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '0.6.24'.freeze
2
+ VERSION = '0.6.29'.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.6.24
4
+ version: 0.6.29
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: 2020-04-28 00:00:00.000000000 Z
11
+ date: 2020-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails