From 22abf4ffe87e7bffe679036abbc6466296bafc89 Mon Sep 17 00:00:00 2001 From: Splines Date: Tue, 11 Jul 2023 19:20:13 +0200 Subject: [PATCH] Show datetimepicker when clicking in text field Note that the datetimepicker is not really accessible right now. Hopefully, there will be some improvement related to this soon. See here: https://github.com/Eonasdan/tempus-dominus/issues/2390 --- app/assets/javascripts/datetimepicker.js | 5 ++++- app/views/assignments/_form.html.erb | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/datetimepicker.js b/app/assets/javascripts/datetimepicker.js index 4ff5cc6a9..8726e2842 100644 --- a/app/assets/javascripts/datetimepicker.js +++ b/app/assets/javascripts/datetimepicker.js @@ -1,5 +1,4 @@ // see https://getdatepicker.com -console.log('trying to import datetimepicker'); $('#assignment-picker').tempusDominus({ display: { sideBySide: true @@ -10,3 +9,7 @@ $('#assignment-picker').tempusDominus({ hourCycle: 'h23' } }); + +$('#assignment-picker-input').on('click', () => { + $('#assignment-picker-button').click(); +}); diff --git a/app/views/assignments/_form.html.erb b/app/views/assignments/_form.html.erb index f8ded9f8f..51c2b216a 100644 --- a/app/views/assignments/_form.html.erb +++ b/app/views/assignments/_form.html.erb @@ -26,9 +26,11 @@ 'data-td-target': '#assignment-picker' %> - +