diff --git a/app/assets/javascripts/datetimepicker.js b/app/assets/javascripts/datetimepicker.js new file mode 100644 index 000000000..4ff5cc6a9 --- /dev/null +++ b/app/assets/javascripts/datetimepicker.js @@ -0,0 +1,12 @@ +// see https://getdatepicker.com +console.log('trying to import datetimepicker'); +$('#assignment-picker').tempusDominus({ + display: { + sideBySide: true + }, + localization: { + startOfTheWeek: 1, + format: 'yyyy-MM-dd HH:mm', + hourCycle: 'h23' + } +}); diff --git a/app/views/assignments/_form.html.erb b/app/views/assignments/_form.html.erb index 8377dc5f0..f8ded9f8f 100644 --- a/app/views/assignments/_form.html.erb +++ b/app/views/assignments/_form.html.erb @@ -1,3 +1,5 @@ +<%= javascript_include_tag 'datetimepicker' %> +
<%= form_with model: assignment do |f| %> @@ -10,15 +12,33 @@ id="assignment-title-error">
+
- <%= f.text_field :deadline, - class: 'form-control', - autocomplete: 'off', - id: "assignment_deadline_#{assignment.id}" %> +
+
+ <%= f.text_field :deadline, + id: 'assignment-picker-input', + class: 'form-control', + 'data-td-target': '#assignment-picker' %> + + + +
+
+
+ +
<%= f.select :medium_id, options_for_select(Medium.where(teachable: assignment.lecture, diff --git a/app/views/layouts/_head.html.erb b/app/views/layouts/_head.html.erb index 64336b5d0..d1147a46d 100644 --- a/app/views/layouts/_head.html.erb +++ b/app/views/layouts/_head.html.erb @@ -34,6 +34,31 @@ integrity="sha256-rADF2WO6GbkNb5O9gqHdjQ/XhrfnXDtPdHdRe5KQmek=" crossorigin="anonymous"> + + + + + + + + + + + + + + +<%# Datetimepicker (Tempus Dominus) %> + +<%# + + + + %> +