effective_form_inputs 1.2.3 → 1.2.4
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: 8cb8f161744c909d4981bf76cc5bed478e109274
|
4
|
+
data.tar.gz: 86c82908903606957bfaccb8521186b355ef9004
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acd2fdf963de5704989de965cb3e8df6ade509017b88986441dc8c7ba306400368c57fd4ade3c386180401bbc86e013350499e407f55dc02a1a32dfe658b8ca3
|
7
|
+
data.tar.gz: f285a61d2decb2b94121482421f7d45fc0d1c1e743b38cc67fe78515925461e274ece5913d18436f1935bbb18813c5b8c245779e19bfcdd7d92ea4cbb8aa29b0
|
@@ -5,9 +5,11 @@ $(document).on 'dp.change', (event) ->
|
|
5
5
|
$start_date = $(event.target)
|
6
6
|
|
7
7
|
return if $start_date.hasClass('not-date-linked')
|
8
|
-
return if ($start_date.attr('name') || '').indexOf('[start_') == -1
|
9
8
|
|
10
|
-
|
9
|
+
name = $start_date.attr('name') || ''
|
10
|
+
return if name.indexOf('start_') == -1 && name.indexOf('_start') == -1
|
11
|
+
|
12
|
+
end_date = name.replace('start_', 'end_').replace('_start', '_end')
|
11
13
|
$end_date = $start_date.closest('form').find("input[name='#{end_date}'].initialized")
|
12
14
|
|
13
15
|
return if $end_date.length == 0
|
@@ -15,14 +17,20 @@ $(document).on 'dp.change', (event) ->
|
|
15
17
|
|
16
18
|
try $end_date.data('DateTimePicker').minDate(event.date)
|
17
19
|
|
20
|
+
try
|
21
|
+
if $end_date.data('DateTimePicker').date() <= event.date
|
22
|
+
$end_date.data('DateTimePicker').date(moment(event.date.format()).add(1, 'hour'))
|
23
|
+
|
18
24
|
# When an input with field named "end_*" is initialized, set it's corresponding "start_*" minDate
|
19
25
|
$(document).on 'dp.end_date_initialized', (event) ->
|
20
26
|
$end_date = $(event.target)
|
21
27
|
|
22
28
|
return if $end_date.hasClass('not-date-linked')
|
23
|
-
return if ($end_date.attr('name') || '').indexOf('[end_') == -1
|
24
29
|
|
25
|
-
|
30
|
+
name = $end_date.attr('name') || ''
|
31
|
+
return if name.indexOf('end_') == -1 && name.indexOf('_start') == -1
|
32
|
+
|
33
|
+
start_date = name.replace('end_', 'start_').replace('_end', '_start')
|
26
34
|
$start_date = $end_date.closest('form').find("input[name='#{start_date}'].initialized")
|
27
35
|
|
28
36
|
return if $start_date.length == 0
|
@@ -6,7 +6,10 @@ initialize = (target) ->
|
|
6
6
|
options = element.data('input-js-options') || {}
|
7
7
|
|
8
8
|
element.addClass('initialized').datetimepicker(options)
|
9
|
-
|
9
|
+
|
10
|
+
name = element.attr('name') || ''
|
11
|
+
if name.indexOf('end_') != -1 || name.indexOf('_end') != -1
|
12
|
+
element.trigger('dp.end_date_initialized')
|
10
13
|
|
11
14
|
$ -> initialize()
|
12
15
|
$(document).on 'page:change', -> initialize()
|
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.2.
|
4
|
+
version: 1.2.4
|
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-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|