effective_bootstrap 0.0.14 → 0.0.15
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/assets/javascripts/effective_bootstrap/base.js.coffee +5 -0
- data/app/assets/stylesheets/effective_radio/input.scss +14 -7
- data/app/models/effective/form_input.rb +32 -3
- data/app/models/effective/form_inputs/radios.rb +5 -1
- data/lib/effective_bootstrap/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78fbc7d3d44502df4a631325adacdaee57d369a6
|
4
|
+
data.tar.gz: 5f3833d0c601d317f36e4877e56febee50cc6c05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34f01b7ad8447dd72045ece989299c770dd1fae83a64de3e8c72b9c1c1abcaa9d8a2e7b05f8c02562ceedbcdbe95b59f1def19df3c959ebef37d5b81f8ea8be2
|
7
|
+
data.tar.gz: f053fe30ec3aed91587a81ba3793c913cb1f9f6ad2d42ca4a1de2896d14cd3bac3fcec8bb33b91cbdfddb07e321d617ef5aeadcbe6b5b5b6bf9e411f75a6ac26
|
@@ -38,3 +38,8 @@ $(document).on 'confirm', (event) ->
|
|
38
38
|
|
39
39
|
$.rails.confirm = (message) -> true
|
40
40
|
$(document).on 'confirm:complete', (event) -> $(event.target).data('confirmed')
|
41
|
+
|
42
|
+
# Fade out cocoon remove.
|
43
|
+
$(document).on 'cocoon:before-remove', (event, $obj) ->
|
44
|
+
$(event.target).data('remove-timeout', 1000)
|
45
|
+
$obj.fadeOut('slow')
|
@@ -3,6 +3,20 @@ div.btn-group > .btn.first-button {
|
|
3
3
|
border-bottom-left-radius: 0.25rem;
|
4
4
|
}
|
5
5
|
|
6
|
+
.effective-radios {
|
7
|
+
white-space: nowrap;
|
8
|
+
}
|
9
|
+
|
10
|
+
.effective-radios.is-valid {
|
11
|
+
label { border-color: #28a745; }
|
12
|
+
.valid-feedback { display: block; }
|
13
|
+
}
|
14
|
+
|
15
|
+
.effective-radios.is-invalid {
|
16
|
+
label { border-color: #dc3545; }
|
17
|
+
.invalid-feedback { display: block; }
|
18
|
+
}
|
19
|
+
|
6
20
|
.effective-radios.card-deck {
|
7
21
|
.card-header { cursor: pointer; }
|
8
22
|
|
@@ -17,10 +31,3 @@ div.btn-group > .btn.first-button {
|
|
17
31
|
}
|
18
32
|
}
|
19
33
|
|
20
|
-
.effective-radios.is-valid {
|
21
|
-
label { border-color: #28a745; }
|
22
|
-
}
|
23
|
-
|
24
|
-
.effective-radios.is-invalid {
|
25
|
-
label { border-color: #dc3545; }
|
26
|
-
}
|
@@ -153,8 +153,8 @@ module Effective
|
|
153
153
|
|
154
154
|
invalid = object.errors[name].to_sentence.presence if object.respond_to?(:errors)
|
155
155
|
invalid ||= options[:feedback][:invalid].delete(:text)
|
156
|
-
invalid ||=
|
157
|
-
invalid ||= '
|
156
|
+
invalid ||= "can't be blank" if options[:input][:required]
|
157
|
+
invalid ||= "can't be blank or invalid"
|
158
158
|
|
159
159
|
valid = options[:feedback][:valid].delete(:text) || "Look's good!"
|
160
160
|
|
@@ -179,9 +179,38 @@ module Effective
|
|
179
179
|
return false unless obj.respond_to?(:validators_on)
|
180
180
|
|
181
181
|
obj.validators_on(name).any? do |v|
|
182
|
-
v.kind_of?(ActiveRecord::Validations::PresenceValidator) &&
|
182
|
+
v.kind_of?(ActiveRecord::Validations::PresenceValidator) && required_options?(v.options)
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
def required_options?(opts)
|
187
|
+
return true unless (opts.key?(:if) || opts.key?(:unless))
|
188
|
+
|
189
|
+
if opts[:if].respond_to?(:call)
|
190
|
+
return object.instance_exec(&opts[:if])
|
191
|
+
end
|
192
|
+
|
193
|
+
if opts[:if].kind_of?(Symbol)
|
194
|
+
return object.send(opts[:if])
|
195
|
+
end
|
196
|
+
|
197
|
+
if opts.key?(:if)
|
198
|
+
return opts[:if]
|
199
|
+
end
|
200
|
+
|
201
|
+
if opts[:unless].respond_to?(:call)
|
202
|
+
return !object.instance_exec(&opts[:unless])
|
203
|
+
end
|
204
|
+
|
205
|
+
if opts[:unless].kind_of?(Symbol)
|
206
|
+
return !object.send(opts[:unless])
|
207
|
+
end
|
208
|
+
|
209
|
+
if opts.key?(:unless)
|
210
|
+
return !opts[:unless]
|
183
211
|
end
|
184
212
|
|
213
|
+
false
|
185
214
|
end
|
186
215
|
|
187
216
|
def validated?(name)
|
@@ -35,7 +35,11 @@ module Effective
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def wrapper_options
|
38
|
-
|
38
|
+
if buttons? || cards?
|
39
|
+
{ class: "form-group #{tag_id}" }
|
40
|
+
else
|
41
|
+
{ class: "form-group effective-radios #{tag_id}" }
|
42
|
+
end
|
39
43
|
end
|
40
44
|
|
41
45
|
def button_group_class
|
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.0.
|
4
|
+
version: 0.0.15
|
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-05-
|
11
|
+
date: 2018-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|