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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 241ea780a6568932a54496fd403ce8f6f82a35b4
4
- data.tar.gz: 110a5a40184312a73a24f62e16209af13c38bad7
3
+ metadata.gz: 9c39a2d1ef431854e72d29af12c1d7b96a48ca04
4
+ data.tar.gz: 771e92ca62a575efc3f3e1a6422bb1b64695b975
5
5
  SHA512:
6
- metadata.gz: 45876febc7abe649b5abd5836bca0e3cf2ca729624ef659c205a4ddf2fe58e8dcc3db4679aab587d07b5259e80b909d468f7d464d26693d97bf552ae6fd2b30f
7
- data.tar.gz: c02d4f28b5dc96d69f47a32ae400c39319ae35da6dda616ae271bc7d658d2ab173d6037546ff08362f8d38c0e0c5035b39c16167ac1841df12fc2631d6ba81d7
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 a full list of options, please refer to:
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
- try $obj.closest('form').find("input[name='#{end_date}'].initialized").data('DateTimePicker').minDate(event.date)
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
@@ -1,3 +1,3 @@
1
1
  module EffectiveFormInputs
2
- VERSION = '1.1.1'.freeze
2
+ VERSION = '1.1.2'.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.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-02 00:00:00.000000000 Z
11
+ date: 2017-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails