effective_form_inputs 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -3
- data/app/assets/javascripts/effective_date_time_picker/overrides.js.coffee +4 -1
- data/app/models/inputs/effective_date_picker/input.rb +5 -0
- data/app/models/inputs/effective_date_time_picker/input.rb +4 -0
- data/lib/effective_form_inputs/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: 9c39a2d1ef431854e72d29af12c1d7b96a48ca04
|
4
|
+
data.tar.gz: 771e92ca62a575efc3f3e1a6422bb1b64695b975
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecac4020c4a2add9d5074315b749730f1559eb25e8bf3a3f056c07034af159d109fc691934599ac060274a75f67bf93d7e4212ee22613a18faf0ad14ce5ff5c3
|
7
|
+
data.tar.gz: 36c837a673953b136df75cf88edbfb305ae6caac06b2210b24641434f0cb133ffbc8c134722306ba46af8aa7fac7562590bdf5734f8155a959ad22de28e6921e
|
data/README.md
CHANGED
@@ -242,6 +242,18 @@ Provide a String, Date, or Range to set the disabled dates.
|
|
242
242
|
:input_js => { disabledDates: [Time.zone.now, Time.zone.now + 1.day] }
|
243
243
|
```
|
244
244
|
|
245
|
+
### Linked Dates
|
246
|
+
|
247
|
+
By default, when two matching effective date time picker inputs named `start_*` and `end_*` are present on the same form, they will become linked.
|
248
|
+
|
249
|
+
The end date selector will have its date <= start_date disabled.
|
250
|
+
|
251
|
+
To disable this behaviour, call with `date_linked: false`.
|
252
|
+
|
253
|
+
```ruby
|
254
|
+
= f.input :end_at, :as => :effective_date_time_picker, :date_linked => false
|
255
|
+
```
|
256
|
+
|
245
257
|
## Effective Date Picker
|
246
258
|
|
247
259
|
This custom form input is based on the following awesome project:
|
@@ -296,9 +308,7 @@ The default `:input_js => options` used to initialize this form input are as fol
|
|
296
308
|
:input_js => {:format => 'YYYY-MM-DD'}
|
297
309
|
```
|
298
310
|
|
299
|
-
For
|
300
|
-
|
301
|
-
http://eonasdan.github.io/bootstrap-datetimepicker/Options/
|
311
|
+
For more options, please see Effective Date Time Picker above
|
302
312
|
|
303
313
|
|
304
314
|
## Effective Email
|
@@ -4,7 +4,10 @@ $(document).on 'dp.hide', (event) -> $(event.target).trigger('keyup')
|
|
4
4
|
$(document).on 'dp.change', (event) ->
|
5
5
|
$obj = $(event.target)
|
6
6
|
|
7
|
+
return if $obj.hasClass('not-date-linked')
|
7
8
|
return if $obj.attr('name').indexOf('[start_') == -1
|
8
9
|
|
9
10
|
end_date = $obj.attr('name').replace('[start_', '[end_')
|
10
|
-
|
11
|
+
$end_date = $obj.closest('form').find("input[name='#{end_date}'].initialized:not(.not-date-linked)")
|
12
|
+
|
13
|
+
try $end_date.data('DateTimePicker').minDate(event.date)
|
@@ -55,6 +55,11 @@ module Inputs
|
|
55
55
|
if js_options[:format] == default_input_js[:format] # Unless someone changed from the default
|
56
56
|
html_options[:pattern] = '\d{4}(-\d{2})?(-\d{2})?' # Match default pattern defined above
|
57
57
|
end
|
58
|
+
|
59
|
+
if options[:date_linked] == false
|
60
|
+
html_options[:class] << 'not-date-linked'
|
61
|
+
end
|
62
|
+
|
58
63
|
end
|
59
64
|
end
|
60
65
|
end
|
@@ -50,6 +50,10 @@ module Inputs
|
|
50
50
|
if js_options[:format] == default_input_js[:format] # Unless someone changed from the default
|
51
51
|
html_options[:pattern] = '\d{4}(-\d{2})?-(\d{2})?( \d+)?(:\d{2})?' # Match default pattern defined above
|
52
52
|
end
|
53
|
+
|
54
|
+
if options[:date_linked] == false
|
55
|
+
html_options[:class] << 'not-date-linked'
|
56
|
+
end
|
53
57
|
end
|
54
58
|
end
|
55
59
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_form_inputs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
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: 2017-06-
|
11
|
+
date: 2017-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|