Fix Datepickers in Call for Content

Datapickers in Call for Events/Booths/Tracks were broken which made impossible
to create them (as the date is required).

Those are not the only Datepickers broken and a similar solution should work
for the rest as well.

Fixes https://github.com/openSUSE/osem/issues/2349
This commit is contained in:
Ana María Martínez Gómez 2019-02-21 11:38:18 +01:00
parent e03f9dc5fe
commit 1a3e3f433d
No known key found for this signature in database
GPG key ID: EACB9B4BC80C0347
2 changed files with 16 additions and 19 deletions

View file

@ -66,22 +66,19 @@ $(function () {
format: "YYYY-MM-DD", format: "YYYY-MM-DD",
}); });
// end_date_conference >= registration-period-Start_date >= Current_date // today <= start_registration <= end_registration <= end_conference
// registration-period-Start_date <= registration-period-End_date <= End_date (of conference) var end_conference = $('form').data('end-conference');
$("#registration-period-start-datepicker").datetimepicker({
pickTime: false, $('#registration-period-start-datapicker').datetimepicker({
useCurrent: false, format: 'YYYY-MM-DD',
format: "YYYY-MM-DD",
minDate : today, minDate : today,
maxDate : $("#registration-period-start-datepicker").attr('end_date'), maxDate : end_conference
}); });
$("#registration-period-end-datepicker").datetimepicker({ $('#registration-period-end-datapicker').datetimepicker({
pickTime: false, format: 'YYYY-MM-DD',
useCurrent: false, minDate : today,
format: "YYYY-MM-DD", maxDate : end_conference
minDate: today,
maxDate : $("#registration-period-start-datepicker").attr('end_date'),
}); });
$("#conference-start-datepicker").on("dp.change",function (e) { $("#conference-start-datepicker").on("dp.change",function (e) {

View file

@ -7,15 +7,15 @@
.row .row
.col-md-8 .col-md-8
= semantic_form_for(cfp, url: cfp_form_url(cfp, conference), = semantic_form_for(cfp, url: cfp_form_url(cfp, conference),
html: { multipart: true }) do |f| html: { multipart: true,
data: { end_conference: conference.end_date.to_s } }) do |f|
= f.input :cfp_type, as: :hidden = f.input :cfp_type, as: :hidden
= f.input :start_date, as: :string, = f.input :start_date, as: :string,
input_html: { id: 'registration-period-start-datepicker', input_html: { class: 'form-control',
start_date: conference.start_date, id: 'registration-period-start-datapicker' }
end_date: conference.end_date, readonly: 'readonly' }
= f.input :end_date, as: :string, = f.input :end_date, as: :string,
input_html: { id: 'registration-period-end-datepicker', input_html: { class: 'form-control',
readonly: 'readonly' } id: 'registration-period-end-datapicker' }
= f.input :description, hint: markdown_hint, = f.input :description, hint: markdown_hint,
input_html: { rows: 2, data: { provide: 'markdown-editable' } } input_html: { rows: 2, data: { provide: 'markdown-editable' } }
- if cfp.cfp_type == 'events' - if cfp.cfp_type == 'events'