From 5ea35b16d8aeacc7b0b04ee1442c5b6ee5170750 Mon Sep 17 00:00:00 2001 From: Splines Date: Thu, 20 Jul 2023 19:08:35 +0200 Subject: [PATCH] Get rid of breaking FontAwesome6 icons We will stay at v5 for the moment. --- app/assets/javascripts/datetimepicker.js | 19 +++++++++++++++++++ app/views/layouts/_head.html.erb | 5 ++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/datetimepicker.js b/app/assets/javascripts/datetimepicker.js index 07aaf97a6..7730f99a1 100644 --- a/app/assets/javascripts/datetimepicker.js +++ b/app/assets/javascripts/datetimepicker.js @@ -22,6 +22,24 @@ function startInitialization() { }); } +function getDateTimePickerIcons() { + // At the moment: continue to use FontAwesome 5 icons + // see https://getdatepicker.com/6/plugins/fa5.html + // see https://github.com/Eonasdan/tempus-dominus/blob/master/dist/plugins/fa-five.js + return { + type: 'icons', + time: 'fas fa-clock', + date: 'fas fa-calendar', + up: 'fas fa-arrow-up', + down: 'fas fa-arrow-down', + previous: 'fas fa-chevron-left', + next: 'fas fa-chevron-right', + today: 'fas fa-calendar-check', + clear: 'fas fa-trash', + close: 'fas fa-times', + } +} + function initDatetimePicker(element) { // see https://getdatepicker.com return new tempusDominus.TempusDominus( @@ -29,6 +47,7 @@ function initDatetimePicker(element) { { display: { sideBySide: true, // clock to the right of the calendar + icons: getDateTimePickerIcons(), }, localization: { startOfTheWeek: 1, diff --git a/app/views/layouts/_head.html.erb b/app/views/layouts/_head.html.erb index 884f3f77c..a40692503 100644 --- a/app/views/layouts/_head.html.erb +++ b/app/views/layouts/_head.html.erb @@ -9,6 +9,7 @@ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> + - - - +