effective_bootstrap 0.3.4 → 0.3.5
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c145752a85ba61c3a79bb1de549542107bc82609
|
4
|
+
data.tar.gz: 3bb0a9a81e6e30636b8ade5eea61db4f7ce65aae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d13825f792cb0308c4f8ce96085979c5d263dd52ae68b9af96900aec046eefe1487af2d2b5dbbec9b5a1683770876c6a76a5a9ca0e57f53eb821da81c2ce2e72
|
7
|
+
data.tar.gz: a20546e182ae29c15d16bdabbcbeb0a27edcab1a332c01ae8f1b3c9a97ebde3b6dbd2802d011413f3d597309a02154afc827923f0e26362f5e21567bd1ea5052
|
data/README.md
CHANGED
@@ -295,7 +295,7 @@ As a Rails Form Helper input:
|
|
295
295
|
= f.select :category, 10.times.map { |x| "Category #{x}"}
|
296
296
|
= f.select :categories, 10.times.map { |x| "Category #{x}"}, multiple: true
|
297
297
|
= f.select :categories, 10.times.map { |x| "Category #{x}"}, tags: true
|
298
|
-
= f.select :categories, {'Active': [['Post A', 1], ['Post B', 2]], 'Past': ['Post C', 3], ['Post D', 4]}, grouped: true
|
298
|
+
= f.select :categories, {'Active': [['Post A', 1], ['Post B', 2]], 'Past': [['Post C', 3], ['Post D', 4]]}, grouped: true
|
299
299
|
```
|
300
300
|
|
301
301
|
### Modes
|
@@ -1,20 +1,24 @@
|
|
1
1
|
(this.EffectiveBootstrap || {}).effective_hide_if = ($element, options) ->
|
2
2
|
|
3
|
-
$affects = $element.closest('form').find("input[name='#{options.name}']")
|
3
|
+
$affects = $element.closest('form').find("input[name='#{options.name}'],select[name='#{options.name}']")
|
4
4
|
|
5
5
|
$affects.on 'change', (event) ->
|
6
6
|
if $(event.target).val() == options.value
|
7
7
|
$element.hide()
|
8
|
+
element.find('input,textarea,select').prop('disabled', true)
|
8
9
|
else
|
9
10
|
$element.fadeIn()
|
11
|
+
$element.find('input,textarea,select').removeAttr('disabled')
|
10
12
|
|
11
13
|
(this.EffectiveBootstrap || {}).effective_show_if = ($element, options) ->
|
12
14
|
|
13
|
-
$affects = $element.closest('form').find("input[name='#{options.name}']")
|
15
|
+
$affects = $element.closest('form').find("input[name='#{options.name}'],select[name='#{options.name}']")
|
14
16
|
|
15
17
|
$affects.on 'change', (event) ->
|
16
18
|
if $(event.target).val() == options.value
|
17
19
|
$element.fadeIn()
|
20
|
+
$element.find('input,textarea,select').removeAttr('disabled')
|
18
21
|
else
|
19
22
|
$element.hide()
|
23
|
+
$element.find('input,textarea,select').prop('disabled', true)
|
20
24
|
|
@@ -3,7 +3,15 @@ module Effective
|
|
3
3
|
class HideIf < Effective::FormLogic
|
4
4
|
|
5
5
|
def to_html(&block)
|
6
|
-
|
6
|
+
disabled_was = @builder.disabled
|
7
|
+
|
8
|
+
@builder.disabled = true if hide?
|
9
|
+
|
10
|
+
content = content_tag(:div, options.merge(input_js_options), &block)
|
11
|
+
|
12
|
+
@builder.disabled = disabled_was
|
13
|
+
|
14
|
+
content
|
7
15
|
end
|
8
16
|
|
9
17
|
def options
|
@@ -20,7 +28,7 @@ module Effective
|
|
20
28
|
end
|
21
29
|
|
22
30
|
def hide?
|
23
|
-
object.send(args.first) == args.second
|
31
|
+
(object.send(args.first) == args.second) || (object.send(args.first).to_s == args.second.to_s)
|
24
32
|
end
|
25
33
|
|
26
34
|
end
|
@@ -3,7 +3,15 @@ module Effective
|
|
3
3
|
class ShowIf < Effective::FormLogic
|
4
4
|
|
5
5
|
def to_html(&block)
|
6
|
-
|
6
|
+
disabled_was = @builder.disabled
|
7
|
+
|
8
|
+
@builder.disabled = true unless show?
|
9
|
+
|
10
|
+
content = content_tag(:div, options.merge(input_js_options), &block)
|
11
|
+
|
12
|
+
@builder.disabled = disabled_was
|
13
|
+
|
14
|
+
content
|
7
15
|
end
|
8
16
|
|
9
17
|
def options
|
@@ -20,7 +28,7 @@ module Effective
|
|
20
28
|
end
|
21
29
|
|
22
30
|
def show?
|
23
|
-
object.send(args.first) == args.second
|
31
|
+
(object.send(args.first) == args.second) || (object.send(args.first).to_s == args.second.to_s)
|
24
32
|
end
|
25
33
|
|
26
34
|
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.3.
|
4
|
+
version: 0.3.5
|
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: 2018-12-
|
11
|
+
date: 2018-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|