From 20b4cbf1f27d8abbc468d7fba23417c100eaefff Mon Sep 17 00:00:00 2001 From: Shriyansh Date: Sun, 27 Mar 2016 03:30:33 +0530 Subject: [PATCH] prefilled users arrival time with dates of the conference --- app/assets/javascripts/osem-datepickers.js | 13 +++++++++++-- .../_registration_info.html.haml | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/osem-datepickers.js b/app/assets/javascripts/osem-datepickers.js index b7ef12d8..a3e68d36 100644 --- a/app/assets/javascripts/osem-datepickers.js +++ b/app/assets/javascripts/osem-datepickers.js @@ -1,10 +1,19 @@ $(function () { - $("#registration-arrival-datepicker, #registration-departure-datepicker").datetimepicker({ + $("#registration-arrival-datepicker").datetimepicker({ pickTime: true, useCurrent: false, minuteStepping: 15, sideBySide: true, - format: "YYYY-MM-DD HH:mm" + format: "YYYY-MM-DD HH:mm", + defaultDate : $("#registration-arrival-datepicker").attr('start_date') + }); + $("#registration-departure-datepicker").datetimepicker({ + pickTime: true, + useCurrent: false, + minuteStepping: 15, + sideBySide: true, + format: "YYYY-MM-DD HH:mm", + defaultDate : $("#registration-arrival-datepicker").attr('end_date') }); $("#registration-arrival-datepicker").on("dp.change",function (e) { diff --git a/app/views/conference_registrations/_registration_info.html.haml b/app/views/conference_registrations/_registration_info.html.haml index 2a852992..d49d364d 100644 --- a/app/views/conference_registrations/_registration_info.html.haml +++ b/app/views/conference_registrations/_registration_info.html.haml @@ -4,5 +4,5 @@ =f.inputs 'Pre-registration required for the following:' do = f.input :events, as: :check_boxes, label: false, collection: @conference.program.events.workshops = f.inputs 'Your Travel Info' do - = f.input :arrival, as: :string, label: 'Your arrival time', input_html: { value: (f.object.arrival.to_formatted_s(:db_without_seconds) unless f.object.arrival.nil?), id: 'registration-arrival-datepicker', readonly: 'readonly' } + = f.input :arrival, as: :string, label: 'Your arrival time', input_html: { value: (f.object.arrival.to_formatted_s(:db_without_seconds) unless f.object.arrival.nil?), id: 'registration-arrival-datepicker',start_date: @conference.start_date,end_date: @conference.end_date, readonly: 'readonly' } = f.input :departure, as: :string, label: 'Your departure time', input_html: { value: (f.object.departure.to_formatted_s(:db_without_seconds) unless f.object.departure.nil?), id: 'registration-departure-datepicker', readonly: 'readonly' }