effective_bootstrap 0.3.2 → 0.3.3
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/form.js.coffee +1 -1
- data/app/assets/stylesheets/effective_bootstrap/forms.scss +4 -2
- data/app/models/effective/form_input.rb +10 -2
- data/app/models/effective/form_inputs/float_field.rb +5 -0
- data/app/models/effective/form_inputs/number_field.rb +4 -0
- data/app/models/effective/form_inputs/percent_field.rb +5 -0
- 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: a836e789cb8b0bee567ef732e5b368ca39f8c9ca
|
|
4
|
+
data.tar.gz: 0f9450c9974758cb363a80324384a870936e5901
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2106312ad8bb61dd044bd50c63a72db6d7a6c1f05830e2610e3875d21f8de969467d6ca32dae6f5767d2dd3d7a5ef3fcded9f5892195d5070486c6091fd86db3
|
|
7
|
+
data.tar.gz: f239fc4e6d5afcc5cb75bdf0470f6dfb1f9653b0b5ba6441afaef80bf45b7632ad69c2d3353a9775c36bfb63a50de50064cdaff8dbee234ad4fd99fb95c42a15
|
|
@@ -107,7 +107,7 @@ this.EffectiveForm ||= new class
|
|
|
107
107
|
|
|
108
108
|
buildFlash: (status, message) ->
|
|
109
109
|
$("
|
|
110
|
-
<div class='alert alert-dismissable alert-#{status} fade show' role='alert'>
|
|
110
|
+
<div class='effective-form-flash alert alert-dismissable alert-#{status} fade show' role='alert'>
|
|
111
111
|
#{message}
|
|
112
112
|
<button class='close' type='button' aria-label='Close' data-dismiss='alert'>
|
|
113
113
|
<span aria-hidden='true'>×</span>
|
|
@@ -165,8 +165,8 @@ module Effective
|
|
|
165
165
|
return BLANK if options[:feedback] == false
|
|
166
166
|
|
|
167
167
|
invalid = object.errors[name].to_sentence.presence if object.respond_to?(:errors)
|
|
168
|
-
invalid ||= options[:feedback][:invalid].delete(:text)
|
|
169
|
-
invalid ||= [("can't be blank" if options[:input][:required]), ('must be valid' if validated?(name))].compact.join(' and ')
|
|
168
|
+
invalid ||= options[:feedback][:invalid].delete(:text).presence
|
|
169
|
+
invalid ||= [("can't be blank" if options[:input][:required]), ('must be valid' if validated?(name))].compact.join(' and ').presence
|
|
170
170
|
invalid ||= "can't be blank or is invalid"
|
|
171
171
|
|
|
172
172
|
valid = options[:feedback][:valid].delete(:text) || "Look's good!"
|
|
@@ -191,6 +191,14 @@ module Effective
|
|
|
191
191
|
obj = (object.class == Class) ? object : object.class
|
|
192
192
|
return false unless obj.respond_to?(:validators_on)
|
|
193
193
|
|
|
194
|
+
if name.to_s.ends_with?('_id')
|
|
195
|
+
return required_presence?(obj, name) || required_presence?(obj, name[0...-3])
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
required_presence?(obj, name)
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
def required_presence?(obj, name)
|
|
194
202
|
obj.validators_on(name).any? do |v|
|
|
195
203
|
v.kind_of?(ActiveRecord::Validations::PresenceValidator) && required_options?(v.options)
|
|
196
204
|
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.3
|
|
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-
|
|
11
|
+
date: 2018-12-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|