diff --git a/app/assets/javascripts/osem-datepickers.js b/app/assets/javascripts/osem-datepickers.js index 5dd2c33c..b907aa0c 100644 --- a/app/assets/javascripts/osem-datepickers.js +++ b/app/assets/javascripts/osem-datepickers.js @@ -4,7 +4,6 @@ $(function () { $("input[id^='datetimepicker']").datetimepicker({ useCurrent: false, sideBySide: true, - autoclose: true, format: 'YYYY-MM-DD HH:mm' }); @@ -16,91 +15,91 @@ $(function () { $("#registration-arrival-datepicker").datetimepicker({ useCurrent: false, - minuteStepping: 15, + stepping: 15, sideBySide: true, format: "YYYY-MM-DD HH:mm", // current_date <= arrival_date <= end_date maxDate : $("#registration-arrival-datepicker").attr('end_date'), - minDate : today, + minDate : today }); $("#registration-departure-datepicker").datetimepicker({ useCurrent: false, - minuteStepping: 15, + stepping: 15, sideBySide: true, format: "YYYY-MM-DD HH:mm", // departure_date > start_date - minDate : $("#registration-arrival-datepicker").attr('start_date'), + minDate : $("#registration-arrival-datepicker").attr('start_date') }); $("#registration-arrival-datepicker").on("dp.change",function (e) { // departure_date > start_date,arrival_date if ((new Date(e.date).getTime()) > (new Date($("#registration-arrival-datepicker").attr('start_date')).getTime())){ - $('#registration-departure-datepicker').data("DateTimePicker").setMinDate(e.date); + $('#registration-departure-datepicker').data("DateTimePicker").minDate(e.date); } else{ - $('#registration-departure-datepicker').data("DateTimePicker").setMinDate($("#registration-arrival-datepicker").attr('start_date')); + $('#registration-departure-datepicker').data("DateTimePicker").minDate($("#registration-arrival-datepicker").attr('start_date')); } }); // departure_date >= arrival_date $("#registration-departure-datepicker").on("dp.change",function (e) { - $('#registration-arrival-datepicker').data("DateTimePicker").setMaxDate(e.date); + $('#registration-arrival-datepicker').data("DateTimePicker").maxDate(e.date); }); $("#conference-start-datepicker").datetimepicker({ useCurrent: false, format: "YYYY-MM-DD", // conference-start-day >= Current_date - minDate : today , + minDate : today }); $("#conference-end-datepicker").datetimepicker({ useCurrent: false, - format: "YYYY-MM-DD", + format: "YYYY-MM-DD" }); // today <= start_registration <= end_registration <= end_conference var end_conference = $('form').data('end-conference'); - $('#registration-period-start-datapicker').datetimepicker({ + $('#registration-period-start-datepicker').datetimepicker({ format: 'YYYY-MM-DD', minDate : today, maxDate : end_conference }); - $('#registration-period-end-datapicker').datetimepicker({ + $('#registration-period-end-datepicker').datetimepicker({ format: 'YYYY-MM-DD', minDate : today, maxDate : end_conference }); $("#conference-start-datepicker").on("dp.change",function (e) { - $('#conference-end-datepicker').data("DateTimePicker").setMinDate(e.date); + $('#conference-end-datepicker').data("DateTimePicker").minDate(e.date); if (!$('#conference-end-datepicker').val()) { - $('#conference-end-datepicker').data("DateTimePicker").setDate(e.date); + $('#conference-end-datepicker').data("DateTimePicker").date(e.date); } }); $("#conference-start-datepicker").change(function (e) { - $('#conference-start-datepicker').val()?$('#conference-end-datepicker').data("DateTimePicker").setMinDate(e.date):$('#conference-end-datepicker').data("DateTimePicker").setMinDate(null); + $('#conference-start-datepicker').val()?$('#conference-end-datepicker').data("DateTimePicker").minDate(e.date):$('#conference-end-datepicker').data("DateTimePicker").minDate(null); }); $("#conference-end-datepicker").on("dp.change",function (e) { - $('#conference-start-datepicker').data("DateTimePicker").setMaxDate(e.date); + $('#conference-start-datepicker').data("DateTimePicker").maxDate(e.date); }); $("#conference-end-datepicker").change(function (e) { - $('#conference-end-datepicker').val()?$('#conference-start-datepicker').data("DateTimePicker").setMaxDate(e.date):$('#conference-start-datepicker').data("DateTimePicker").setMaxDate(null); + $('#conference-end-datepicker').val()?$('#conference-start-datepicker').data("DateTimePicker").maxDate(e.date):$('#conference-start-datepicker').data("DateTimePicker").maxDate(null); }); $("#registration-period-start-datepicker").on("dp.change",function (e) { - $('#registration-period-end-datepicker').data("DateTimePicker").setMinDate(e.date); + $('#registration-period-end-datepicker').data("DateTimePicker").minDate(e.date); if (!$('#registration-period-end-datepicker').val()) { - $('#registration-period-end-datepicker').data("DateTimePicker").setDate(e.date); + $('#registration-period-end-datepicker').data("DateTimePicker").date(e.date); } }); $("#registration-period-end-datepicker").on("dp.change",function (e) { - $('#registration-period-start-datepicker').data("DateTimePicker").setMaxDate(e.date); + $('#registration-period-start-datepicker').data("DateTimePicker").maxDate(e.date); }); } ); diff --git a/app/views/admin/cfps/_form.html.haml b/app/views/admin/cfps/_form.html.haml index dcf2fc66..1cff0645 100644 --- a/app/views/admin/cfps/_form.html.haml +++ b/app/views/admin/cfps/_form.html.haml @@ -12,10 +12,10 @@ = f.input :cfp_type, as: :hidden = f.input :start_date, as: :string, input_html: { class: 'form-control', - id: 'registration-period-start-datapicker' } + id: 'registration-period-start-datepicker' } = f.input :end_date, as: :string, input_html: { class: 'form-control', - id: 'registration-period-end-datapicker' } + id: 'registration-period-end-datepicker' } = f.input :description, hint: markdown_hint, input_html: { rows: 2, data: { provide: 'markdown-editable' } } - if cfp.cfp_type == 'events' diff --git a/app/views/admin/programs/_form.html.haml b/app/views/admin/programs/_form.html.haml index 9b42e2b0..c158453a 100644 --- a/app/views/admin/programs/_form.html.haml +++ b/app/views/admin/programs/_form.html.haml @@ -11,7 +11,7 @@ = f.input :languages, hint: "Enter the languages allowed for events as values of #{link_to('ISO 639-1', 'http://www.loc.gov/standards/iso639-2/php/code_list.php', target: "_blank")} language codes separated with commas. The first language would be the default language. Leave it blank if you do not want to specify languages.".html_safe = f.input :schedule_interval, input_html: { autofocus: true }, hint: "It is the minimal time interval of your schedule. The value should be 5, 6, 10, 12, 15, 20, 30 or 60. Warning! Some events could be unscheduled when changing this value." = f.input :blind_voting, hint: 'Enable this feature if you do not want to show voting results and voters prior to user submitting a vote. For the feature to work you need to set the voting dates below as well' - = f.input :voting_start_date, as: :string, input_html: { id: 'datetimepicker-voting_start_date', readonly: true, value: (f.object.voting_start_date.to_formatted_s(:db_without_seconds) unless f.object.voting_start_date.nil?) } - = f.input :voting_end_date, as: :string, input_html: { id: 'datetimepicker-voting_start_date', readonly: true, value: (f.object.voting_end_date.to_formatted_s(:db_without_seconds) unless f.object.voting_end_date.nil?) } + = f.input :voting_start_date, as: :string, input_html: { id: 'datetimepicker-voting_start_date', value: (f.object.voting_start_date.to_formatted_s(:db_without_seconds) unless f.object.voting_start_date.nil?) } + = f.input :voting_end_date, as: :string, input_html: { id: 'datetimepicker-voting_end_date', value: (f.object.voting_end_date.to_formatted_s(:db_without_seconds) unless f.object.voting_end_date.nil?) } %p.text-right = f.action :submit, as: :button, button_html: {class: 'btn btn-primary'} diff --git a/app/views/admin/registration_periods/_form.html.haml b/app/views/admin/registration_periods/_form.html.haml index 2fe9af8b..c3d3c86c 100644 --- a/app/views/admin/registration_periods/_form.html.haml +++ b/app/views/admin/registration_periods/_form.html.haml @@ -5,7 +5,7 @@ .row .col-md-8 = semantic_form_for(@registration_period, url: admin_conference_registration_period_path(@conference.short_title)) do |f| - = f.input :start_date, as: :string, input_html: { id: 'registration-period-start-datepicker',start_date: @conference.start_date,end_date: @conference.end_date, readonly: 'readonly' } - = f.input :end_date, as: :string, input_html: { id: 'registration-period-end-datepicker', readonly: 'readonly' } + = f.input :start_date, as: :string, input_html: { id: 'registration-period-start-datepicker', start_date: @conference.start_date, end_date: @conference.end_date } + = f.input :end_date, as: :string, input_html: { id: 'registration-period-end-datepicker' } %p.text-right = f.submit 'Save Registration Period', class: 'btn btn-primary' diff --git a/app/views/admin/tracks/_form.html.haml b/app/views/admin/tracks/_form.html.haml index 36ff5734..cfdd9bf3 100644 --- a/app/views/admin/tracks/_form.html.haml +++ b/app/views/admin/tracks/_form.html.haml @@ -12,8 +12,8 @@ = f.input :name, input_html: { autofocus: true } = f.input :short_name, hint: "A short and unique handle for the track, using only letters, numbers, underscores, and dashes. This will be used to identify the track in URLs etc. Example: 'my_awesome_track'", input_html: { required: 'required', pattern: '[a-zA-Z0-9_-]+', title: 'Only letters, numbers, underscores, and dashes.' } = f.input :color, input_html: {size: 6, type: 'color'}, required: true - = f.input :start_date, as: :string, input_html: { id: 'registration-period-start-datepicker', start_date: @conference.start_date, end_date: @conference.end_date, readonly: 'readonly', required: @track.self_organized_and_accepted_or_confirmed? } - = f.input :end_date, as: :string, input_html: { id: 'registration-period-end-datepicker', readonly: 'readonly', required: @track.self_organized_and_accepted_or_confirmed? } + = f.input :start_date, as: :string, input_html: { id: 'registration-period-start-datepicker', start_date: @conference.start_date, end_date: @conference.end_date, required: @track.self_organized_and_accepted_or_confirmed? } + = f.input :end_date, as: :string, input_html: { id: 'registration-period-end-datepicker', required: @track.self_organized_and_accepted_or_confirmed? } - if @conference.venue.try(:rooms).present? = f.input :room, as: :select, collection: (@conference.venue.rooms).map {|room| ["#{room.name}", room.id]}, include_blank: true, label: 'Room', input_html: { class: 'select-help-toggle', required: @track.self_organized_and_accepted_or_confirmed? } - else diff --git a/app/views/conference_registrations/_registration_info.html.haml b/app/views/conference_registrations/_registration_info.html.haml index 2945a16e..a81f385d 100644 --- a/app/views/conference_registrations/_registration_info.html.haml +++ b/app/views/conference_registrations/_registration_info.html.haml @@ -27,7 +27,7 @@ = f.inputs 'Your Travel Info' do - = f.input :arrival, as: :string, label: 'Your arrival time', hint: "Leave blank if not sure", 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} - = f.input :departure, as: :string, label: 'Your departure time', hint: "Leave blank if not sure", input_html: { value: (f.object.departure.to_formatted_s(:db_without_seconds) unless f.object.departure.nil?), id: 'registration-departure-datepicker'} + = f.input :arrival, as: :string, label: 'Your arrival time', hint: "Leave blank if not sure", 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 } + = f.input :departure, as: :string, label: 'Your departure time', hint: "Leave blank if not sure", input_html: { value: (f.object.departure.to_formatted_s(:db_without_seconds) unless f.object.departure.nil?), id: 'registration-departure-datepicker' } = render 'conferences/code_of_conduct', organization: @conference.organization