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: 78fbc7d3d44502df4a631325adacdaee57d369a6
4
- data.tar.gz: 5f3833d0c601d317f36e4877e56febee50cc6c05
3
+ metadata.gz: b7fa96dba4c20705dcf039d7c1eabb04f29f1212
4
+ data.tar.gz: 53207e5edb6761cc8b989532576b9b630c8a840d
5
5
  SHA512:
6
- metadata.gz: 34f01b7ad8447dd72045ece989299c770dd1fae83a64de3e8c72b9c1c1abcaa9d8a2e7b05f8c02562ceedbcdbe95b59f1def19df3c959ebef37d5b81f8ea8be2
7
- data.tar.gz: f053fe30ec3aed91587a81ba3793c913cb1f9f6ad2d42ca4a1de2896d14cd3bac3fcec8bb33b91cbdfddb07e321d617ef5aeadcbe6b5b5b6bf9e411f75a6ac26
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'] = (@_effective_remote_index += 1)
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'] = (@_effective_remote_index += 1)
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).html_safe
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).html_safe
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)
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '0.0.15'.freeze
2
+ VERSION = '0.0.16'.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.0.15
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-08 00:00:00.000000000 Z
11
+ date: 2018-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails