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: b03aaedcf0c4922442f4beeaabd3c487efc79c86
4
- data.tar.gz: 0328e687027e6ad11b2d20d2ff94ef0e7044110d
3
+ metadata.gz: 8cb8f161744c909d4981bf76cc5bed478e109274
4
+ data.tar.gz: 86c82908903606957bfaccb8521186b355ef9004
5
5
  SHA512:
6
- metadata.gz: dead58136fd0b16bba56980e43202e581760281632f0bf333571e03e9b182626535748a1427d51afcb6f5e1b729b07ca1e8be935b58a24d93e7ca1116f3bc4eb
7
- data.tar.gz: 71f0110ebeab045f6b7cad48647052b544b3a811c4bb4ebb6bf174ded67dc6ded60f277df5ac28178931c5ab579a761077ea5d5d0880906b5649e18a44650946
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
- end_date = $start_date.attr('name').replace('[start_', '[end_')
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
- start_date = $end_date.attr('name').replace('[end_', '[start_')
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
- element.trigger('dp.end_date_initialized') if (element.attr('name') || '').indexOf('[end_') != -1
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()
@@ -1,3 +1,3 @@
1
1
  module EffectiveFormInputs
2
- VERSION = '1.2.3'.freeze
2
+ VERSION = '1.2.4'.freeze
3
3
  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.2.3
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-06-07 00:00:00.000000000 Z
11
+ date: 2018-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails