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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ebc807c7e59ae5211d7d6a5cc7db028d75598654
4
- data.tar.gz: 970c0697fddd13505941e5903ed3931da0fbb740
3
+ metadata.gz: a836e789cb8b0bee567ef732e5b368ca39f8c9ca
4
+ data.tar.gz: 0f9450c9974758cb363a80324384a870936e5901
5
5
  SHA512:
6
- metadata.gz: e583a91140b0c0988fab00a36a12c4991481045d1662a883c2ff0fdb6c79aba560bc79171607066715592b3e2b8bb04be52e6aa23a6cfc09b2d0f4ec408693b7
7
- data.tar.gz: 43f174be82d4ec975ccaafe6e024c29b9479fdc87e5f15372c776a2e8bd5869313292c901632e1128ddf4bc1d5674e27bef7ddf52eca781de202d8d287c7a76d
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'>&times;</span>
@@ -4,9 +4,11 @@
4
4
  align-items: center;
5
5
  position: relative;
6
6
 
7
- .alert {
7
+ // This is the inline ajax flash next to the save button.
8
+ .effective-form-flash {
8
9
  position: absolute;
9
- top: 4.0em;
10
+ top: 3.0em;
11
+ z-index: 1;
10
12
  }
11
13
  }
12
14
 
@@ -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
@@ -10,6 +10,11 @@ module Effective
10
10
  { class: 'form-control effective_float', autocomplete: 'off', step: '0.01' }
11
11
  end
12
12
 
13
+ # This has gotta be a valid pattern
14
+ def validated?(name)
15
+ true
16
+ end
17
+
13
18
  end
14
19
  end
15
20
  end
@@ -1,6 +1,10 @@
1
1
  module Effective
2
2
  module FormInputs
3
3
  class NumberField < Effective::FormInput
4
+ # This has gotta be a valid pattern
5
+ def validated?(name)
6
+ true
7
+ end
4
8
  end
5
9
  end
6
10
  end
@@ -15,6 +15,11 @@ module Effective
15
15
  { class: 'form-control effective_percent', autocomplete: 'off' }
16
16
  end
17
17
 
18
+ # This has gotta be a valid pattern
19
+ def validated?(name)
20
+ true
21
+ end
22
+
18
23
  private
19
24
 
20
25
  def percent_to_integer
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '0.3.2'.freeze
2
+ VERSION = '0.3.3'.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.3.2
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-19 00:00:00.000000000 Z
11
+ date: 2018-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails