effective_form_inputs 1.1.11 → 1.1.12

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: 49d3e07769895f8fe1d25f353f7cca1b796aa8c4
4
- data.tar.gz: af46d954e2c058fab64aa2188efa4b8808cf6ede
3
+ metadata.gz: 82987aa71a7ea0640039fdac3962555a982810d6
4
+ data.tar.gz: d3784ba5af000a1e585e013ff83720d0d6e672e0
5
5
  SHA512:
6
- metadata.gz: 12d3ccf450c2e837c8f75af3056ffbae1eb1ca4edd8966a6747b65099d18419978aa649a5cd9d6c24842ff0bbb1c55acc5c0b128850974db27278a8827bfade0
7
- data.tar.gz: b4ea5cef5220ecc5fd2f7d34a0f52dfe3191c2f1b436229a02db49d43cf46eee7fc813ea25507de3b2f5469568f3c73b8fcc9dd24cb05e39203799770995f935
6
+ metadata.gz: f9f416cf372c13830b9f1d4d1ca8b417de19bcc801432f2a66f9e80469c6ff4b061817344ff0a0a2fc6ef8a9ff183394a385cd7c54d142ac661b01f380f0c4f2
7
+ data.tar.gz: d1dd15c4e4d29e5f4a3b3b9bb82a52b7da4d3ef62c1de666938a6d7de6de3bf7dd8bcaf4cbd3facff74282060a51957d56050c311c11a1c7fcad791519736979
@@ -6,6 +6,7 @@ initialize = ->
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
 
10
11
  $ -> initialize()
11
12
  $(document).on 'page:change', -> initialize()
@@ -6,6 +6,7 @@ initialize = ->
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
 
10
11
  $ -> initialize()
11
12
  $(document).on 'page:change', -> initialize()
@@ -2,12 +2,32 @@ $(document).on 'dp.hide', (event) -> $(event.target).trigger('keyup')
2
2
 
3
3
  # When an input with field named "start_*" is changed, set it's corresponding "end_*" minDate
4
4
  $(document).on 'dp.change', (event) ->
5
- $obj = $(event.target)
5
+ $start_date = $(event.target)
6
6
 
7
- return if $obj.hasClass('not-date-linked')
8
- return if $obj.attr('name').indexOf('[start_') == -1
7
+ return if $start_date.hasClass('not-date-linked')
8
+ return if ($start_date.attr('name') || '').indexOf('[start_') == -1
9
9
 
10
- end_date = $obj.attr('name').replace('[start_', '[end_')
11
- $end_date = $obj.closest('form').find("input[name='#{end_date}'].initialized:not(.not-date-linked)")
10
+ end_date = $start_date.attr('name').replace('[start_', '[end_')
11
+ $end_date = $start_date.closest('form').find("input[name='#{end_date}'].initialized")
12
+
13
+ return if $end_date.length == 0
14
+ return if $end_date.hasClass('not-date-linked')
12
15
 
13
16
  try $end_date.data('DateTimePicker').minDate(event.date)
17
+
18
+ # When an input with field named "end_*" is initialized, set it's corresponding "start_*" minDate
19
+ $(document).on 'dp.end_date_initialized', (event) ->
20
+ $end_date = $(event.target)
21
+
22
+ return if $end_date.hasClass('not-date-linked')
23
+ return if ($end_date.attr('name') || '').indexOf('[end_') == -1
24
+
25
+ start_date = $end_date.attr('name').replace('[end_', '[start_')
26
+ $start_date = $end_date.closest('form').find("input[name='#{start_date}'].initialized")
27
+
28
+ return if $start_date.length == 0
29
+ return if $start_date.hasClass('not-date-linked')
30
+
31
+ try
32
+ date = $start_date.data('DateTimePicker').date()
33
+ $end_date.data('DateTimePicker').minDate(date) if date
@@ -6,6 +6,7 @@ initialize = ->
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
 
10
11
  $ -> initialize()
11
12
  $(document).on 'page:change', -> initialize()
@@ -151,7 +151,7 @@ module Inputs
151
151
  def js_options
152
152
  @effective_select_js_options ||= super().tap do |js_options|
153
153
  js_options[:allowClear] = (options[:multiple] != true)
154
- js_options[:tags] = (options[:tags] == true)
154
+ js_options[:tags] = (options[:tags] == true) unless js_options.key?(:tags)
155
155
  js_options[:tokenSeparators] = nil if options[:tags] != true
156
156
  js_options[:template] = options[:template] if options[:template].present?
157
157
 
@@ -35,6 +35,10 @@ module Inputs
35
35
  html_options[:pattern] = '\d{2}:\d{2}' # Match default pattern defined above
36
36
  end
37
37
 
38
+ if options[:date_linked] == false
39
+ html_options[:class] << 'not-date-linked'
40
+ end
41
+
38
42
  end
39
43
  end
40
44
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveFormInputs
2
- VERSION = '1.1.11'.freeze
2
+ VERSION = '1.1.12'.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.1.11
4
+ version: 1.1.12
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-10-24 00:00:00.000000000 Z
11
+ date: 2017-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails