effective_bootstrap 0.0.15 → 0.0.16
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7fa96dba4c20705dcf039d7c1eabb04f29f1212
|
4
|
+
data.tar.gz: 53207e5edb6761cc8b989532576b9b630c8a840d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bfe93d73ca753ff390ea0f0d2970de2941130a10226cea030c413169fc174bdd1470ca5368df18cbd70e40c0eaa8cc45540f07e88e499a89332eb6361a393dc
|
7
|
+
data.tar.gz: fbaf93f9765338f90e1d6795d54c3fc9ba9282cb953da2d62b498d765f729f9c9b65e45859c395f4df29b13e3e33b4ff7ae0a02872d9a977de1f1d47dc1c0858
|
@@ -3,15 +3,17 @@ module EffectiveFormBuilderHelper
|
|
3
3
|
options[:class] = [options[:class], 'needs-validation', ('form-inline' if options[:layout] == :inline)].compact.join(' ')
|
4
4
|
options[:html] = (options[:html] || {}).merge(novalidate: true, onsubmit: 'return EffectiveForm.validate(this);')
|
5
5
|
|
6
|
+
remote_index = options.except(:model).hash.abs
|
7
|
+
|
6
8
|
if options.delete(:remote) == true
|
7
9
|
@_effective_remote_index ||= 0
|
8
10
|
|
9
11
|
if options[:html][:data].kind_of?(Hash)
|
10
12
|
options[:html][:data][:remote] = true
|
11
|
-
options[:html][:data]['data-remote-index'] =
|
13
|
+
options[:html][:data]['data-remote-index'] = remote_index
|
12
14
|
else
|
13
15
|
options[:html]['data-remote'] = true
|
14
|
-
options[:html]['data-remote-index'] =
|
16
|
+
options[:html]['data-remote-index'] = remote_index
|
15
17
|
end
|
16
18
|
end
|
17
19
|
|
@@ -126,13 +126,13 @@ module Effective
|
|
126
126
|
return BLANK if options[:label] == false
|
127
127
|
return BLANK if name.kind_of?(NilClass)
|
128
128
|
|
129
|
-
text = (options[:label].delete(:text) || (object.class.human_attribute_name(name) if object) || BLANK)
|
129
|
+
text = (options[:label].delete(:text) || (object.class.human_attribute_name(name) if object) || BLANK)
|
130
130
|
|
131
131
|
if options[:input][:id]
|
132
132
|
options[:label][:for] = options[:input][:id]
|
133
133
|
end
|
134
134
|
|
135
|
-
@builder.label(name, text, options[:label])
|
135
|
+
@builder.label(name, text.html_safe, options[:label])
|
136
136
|
end
|
137
137
|
|
138
138
|
def build_input(&block)
|
@@ -143,9 +143,9 @@ module Effective
|
|
143
143
|
return BLANK unless options[:hint] && options[:hint][:text]
|
144
144
|
|
145
145
|
tag = options[:hint].delete(:tag)
|
146
|
-
text = options[:hint].delete(:text)
|
146
|
+
text = options[:hint].delete(:text)
|
147
147
|
|
148
|
-
content_tag(tag, text, options[:hint])
|
148
|
+
content_tag(tag, text.html_safe, options[:hint])
|
149
149
|
end
|
150
150
|
|
151
151
|
def build_feedback
|
@@ -153,13 +153,13 @@ 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 ||= "can't be blank" if options[:input][:required]
|
157
|
-
invalid ||= "can't be blank or invalid"
|
156
|
+
invalid ||= [("can't be blank" if options[:input][:required]), ('must be valid' if validated?(name))].compact.join(' and ')
|
157
|
+
invalid ||= "can't be blank or is invalid"
|
158
158
|
|
159
159
|
valid = options[:feedback][:valid].delete(:text) || "Look's good!"
|
160
160
|
|
161
|
-
content_tag(:div, invalid, options[:feedback][:invalid]) +
|
162
|
-
content_tag(:div, valid, options[:feedback][:valid])
|
161
|
+
content_tag(:div, invalid.html_safe, options[:feedback][:invalid]) +
|
162
|
+
content_tag(:div, valid.html_safe, options[:feedback][:valid])
|
163
163
|
end
|
164
164
|
|
165
165
|
def has_error?(name = nil)
|
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.16
|
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-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|