Replace all datepickers with date input

Nowadays all browsers have reasonable date input support...
This commit is contained in:
Henne Vogelsang 2024-06-06 22:11:59 +02:00
parent 07bfff8fa1
commit 30fdc2d796
No known key found for this signature in database
GPG key ID: 97DDB66BDAF8D4D6
6 changed files with 26 additions and 39 deletions

View file

@ -49,11 +49,11 @@
.form-group
= f.label :start_date, "Start Date"
%abbr{title: 'This field is required'} *
= f.text_field :start_date, id: 'conference-start-datepicker', required: true, class: 'form-control'
= f.date_field :start_date, required: true, class: 'form-control'
.form-group
= f.label :end_date, "End Date"
%abbr{title: 'This field is required'} *
= f.text_field :end_date, id: 'conference-end-datepicker', required: true, class: 'form-control'
= f.date_field :end_date, required: true, class: 'form-control'
- unless f.object.new_record? # We are showing more fields on the edit form
.form-group
= f.number_field :start_hour, size: 2, min: 0, max: 23, class: 'form-control'

View file

@ -25,9 +25,9 @@
For the feature to work you need to set the voting dates below as well
.form-group
= f.label :voting_start_date
= f.text_field :voting_start_date, id: 'datetimepicker-voting_start_date', value: (f.object.voting_start_date.to_formatted_s(:db_without_seconds) unless f.object.voting_start_date.nil?), class: 'form-control'
= f.datetime_field :voting_start_date, value: (f.object.voting_start_date.to_formatted_s(:db_without_seconds) unless f.object.voting_start_date.nil?), class: 'form-control'
= f.label :voting_end_date
= f.text_field :voting_end_date, id: 'datetimepicker-voting_end_date', value: (f.object.voting_end_date.to_formatted_s(:db_without_seconds) unless f.object.voting_end_date.nil?), class: 'form-control'
= f.datetime_field :voting_end_date, value: (f.object.voting_end_date.to_formatted_s(:db_without_seconds) unless f.object.voting_end_date.nil?), class: 'form-control'
%h4
Languages
%hr

View file

@ -86,10 +86,10 @@
.kinds.text{ class: @survey_question.text? ? '' : 'hidden' }
%textarea.form-control{ rows: 4 }
.kinds.datetime{ class: @survey_question.datetime? ? '' : 'hidden' }
.form-group{ class: 'datetimepicker' }
.form-group
.input-group
.input-group-addon
%span.fa-solid.fa-calendar
%input.form-control{ readonly: 'readonly' }
%input.form-control{ type: 'datetime-local', readonly: 'readonly' }
.kinds.numeric{ class: @survey_question.numeric? ? '' : 'hidden' }
%input.form-control{ type: 'number' }

View file

@ -22,7 +22,7 @@
= f.select :target, Survey.targets.keys, class: 'form-control'
.form-group
= f.label :start_date
= f.text_field :start_date, class: 'datetimepicker form-control'
= f.datetime_field :start_date, class: 'form-control'
= f.label :end_date
= f.text_field :end_date, class: 'datetimepicker form-control'
= f.datetime_field :end_date, class: 'form-control'
= f.submit nil, class: 'btn btn-primary'

View file

@ -32,10 +32,10 @@
- elsif survey_question.text?
= text_area_tag "survey_submission[#{survey_question.id}][]", survey_reply.text, rows: 4, class: 'form-control', required: survey_question.mandatory
- elsif survey_question.datetime?
.form-group{ class: 'datetimepicker' }
.form-group
.input-group
.input-group-addon
%span.fa-solid.fa-calendar
%input.form-control{ readonly: 'readonly', name: "survey_submission[#{survey_question.id}][]", value: survey_reply.text, required: survey_question.mandatory }
%input.form-control{ type: 'datetime-local', readonly: 'readonly', name: "survey_submission[#{survey_question.id}][]", value: survey_reply.text, required: survey_question.mandatory }
- elsif survey_question.numeric?
%input.form-control{ type: 'number', name: "survey_submission[#{survey_question.id}][]", value: survey_reply.text, required: survey_question.mandatory }