From 46e5cee5addc6ddb1e692fdfc70bac0cd82a87ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Benjamin=20H=C3=A4ttasch?=
 <benjamin.haettasch@fachschaft.informatik.tu-darmstadt.de>
Date: Wed, 4 Jan 2023 21:50:53 +0100
Subject: [PATCH] Fix fullcalendar theming issues

Add bootstrap plugin (not included in fc by default anymore)
Activate compression
Make sure font awesome icons are used instead of loading bootstrap icons fc defaults to only for two buttons in fc
Remove copy-paste-error text in scheduler
---
 .../templates/AKModel/load_fullcalendar.html  | 20 +++++++++++------
 .../load_fullcalendar_availabilities.html     | 22 +++++++++++--------
 AKPlan/templates/AKPlan/plan_akslot.html      |  4 ++++
 AKPlan/templates/AKPlan/plan_detail.html      |  4 ++++
 AKPlan/templates/AKPlan/plan_index.html       |  4 ++++
 AKPlan/templates/AKPlan/plan_wall.html        |  4 ++++
 .../admin/AKScheduling/scheduling.html        |  5 ++++-
 static_common/common/js/availabilities.js     |  4 ++++
 .../fullcalendar.bootstrap5-5.0.2.min.js      |  6 +++++
 9 files changed, 56 insertions(+), 17 deletions(-)
 create mode 100644 static_common/common/vendor/fullcalendar-scheduler/fullcalendar.bootstrap5-5.0.2.min.js

diff --git a/AKModel/templates/AKModel/load_fullcalendar.html b/AKModel/templates/AKModel/load_fullcalendar.html
index e00f5038..08199aaa 100644
--- a/AKModel/templates/AKModel/load_fullcalendar.html
+++ b/AKModel/templates/AKModel/load_fullcalendar.html
@@ -1,12 +1,18 @@
+{% load compress %}
 {% load static %}
 {% load i18n %}
 {% get_current_language as LANGUAGE_CODE %}
 
-<script src='{% static 'common/vendor/fullcalendar-scheduler/fullcalendar-6.0.2.js' %}'></script>
+{% compress js %}
+    <script src='{% static 'common/vendor/fullcalendar-scheduler/fullcalendar-6.0.2.js' %}'></script>
+    <script src='{% static 'common/vendor/fullcalendar-scheduler/fullcalendar.bootstrap5-5.0.2.min.js' %}'></script>
+
+    {% with 'common/vendor/fullcalendar-scheduler/locales/'|add:LANGUAGE_CODE|add:'.js' as locale_file %}
+        {% if LANGUAGE_CODE != "en" %}
+            {# Locale 'en' is included in main.js and does not exist separately #}
+            <script src="{% static locale_file %}"></script>
+        {% endif %}
+    {% endwith %}
+{% endcompress %}
+
 
-{% with 'common/vendor/fullcalendar-scheduler/locales/'|add:LANGUAGE_CODE|add:'.js' as locale_file %}
-    {% if LANGUAGE_CODE != "en" %}
-        {# Locale 'en' is included in main.js and does not exist separately #}
-        <script src="{% static locale_file %}"></script>
-    {% endif %}
-{% endwith %}
diff --git a/AKModel/templates/AKModel/load_fullcalendar_availabilities.html b/AKModel/templates/AKModel/load_fullcalendar_availabilities.html
index 74c34f72..71344f21 100644
--- a/AKModel/templates/AKModel/load_fullcalendar_availabilities.html
+++ b/AKModel/templates/AKModel/load_fullcalendar_availabilities.html
@@ -1,14 +1,18 @@
+{% load compress %}
 {% load static %}
 {% load i18n %}
 {% get_current_language as LANGUAGE_CODE %}
 
-<script src='{% static 'common/vendor/fullcalendar-scheduler/fullcalendar-6.0.2.js' %}'></script>
-<script src="{% static "common/vendor/moment/moment-with-locales.js" %}"></script>
-<script src="{% static "common/js/availabilities.js" %}"></script>
+{% compress js %}
+    <script src='{% static 'common/vendor/fullcalendar-scheduler/fullcalendar-6.0.2.js' %}'></script>
+    <script src='{% static 'common/vendor/fullcalendar-scheduler/fullcalendar.bootstrap5-5.0.2.min.js' %}'></script>
+    <script src="{% static "common/vendor/moment/moment-with-locales.js" %}"></script>
+    <script src="{% static "common/js/availabilities.js" %}"></script>
 
-{% with 'common/vendor/fullcalendar-scheduler/locales/'|add:LANGUAGE_CODE|add:'.js' as locale_file %}
-    {% if LANGUAGE_CODE != "en" %}
-        {# Locale 'en' is included in main.js and does not exist separately #}
-        <script src="{% static locale_file %}"></script>
-    {% endif %}
-{% endwith %}
+    {% with 'common/vendor/fullcalendar-scheduler/locales/'|add:LANGUAGE_CODE|add:'.js' as locale_file %}
+        {% if LANGUAGE_CODE != "en" %}
+            {# Locale 'en' is included in main.js and does not exist separately #}
+            <script src="{% static locale_file %}"></script>
+        {% endif %}
+    {% endwith %}
+{% endcompress %}
diff --git a/AKPlan/templates/AKPlan/plan_akslot.html b/AKPlan/templates/AKPlan/plan_akslot.html
index f10b87bc..46b3e8e2 100644
--- a/AKPlan/templates/AKPlan/plan_akslot.html
+++ b/AKPlan/templates/AKPlan/plan_akslot.html
@@ -21,6 +21,10 @@
             headerToolbar: false,
             aspectRatio: 2.5,
             themeSystem: 'bootstrap5',
+            buttonIcons: {
+              prev: 'ignore fa-solid fa-angle-left',
+              next: 'ignore fa-solid fa-angle-right',
+            },
             // Only show calendar view for the dates of the connected event
             visibleRange: {
                 start: '{{ ak.event.start | timezone:ak.event.timezone | date:"Y-m-d H:i:s" }}',
diff --git a/AKPlan/templates/AKPlan/plan_detail.html b/AKPlan/templates/AKPlan/plan_detail.html
index 11d97817..6670f661 100644
--- a/AKPlan/templates/AKPlan/plan_detail.html
+++ b/AKPlan/templates/AKPlan/plan_detail.html
@@ -29,6 +29,10 @@
                     },
                     aspectRatio: 2,
                     themeSystem: 'bootstrap5',
+                    buttonIcons: {
+                      prev: 'ignore fa-solid fa-angle-left',
+                      next: 'ignore fa-solid fa-angle-right',
+                    },
                     // Only show calendar view for the dates of the connected event
                     visibleRange: {
                         start: '{{ event.start | timezone:event.timezone | date:"Y-m-d H:i:s" }}',
diff --git a/AKPlan/templates/AKPlan/plan_index.html b/AKPlan/templates/AKPlan/plan_index.html
index 633428cf..ffda1d96 100644
--- a/AKPlan/templates/AKPlan/plan_index.html
+++ b/AKPlan/templates/AKPlan/plan_index.html
@@ -23,6 +23,10 @@
                         right: 'resourceTimelineDay,resourceTimelineEvent'
                     },
                     themeSystem: 'bootstrap5',
+                    buttonIcons: {
+                      prev: 'ignore fa-solid fa-angle-left',
+                      next: 'ignore fa-solid fa-angle-right',
+                    },
                     // Adapt to user selected locale
 	                locale: '{{ LANGUAGE_CODE }}',
                     initialView: 'resourceTimelineEvent',
diff --git a/AKPlan/templates/AKPlan/plan_wall.html b/AKPlan/templates/AKPlan/plan_wall.html
index 0e20819d..3e0b36d9 100644
--- a/AKPlan/templates/AKPlan/plan_wall.html
+++ b/AKPlan/templates/AKPlan/plan_wall.html
@@ -39,6 +39,10 @@
                 timeZone: '{{ event.timezone }}',
                 headerToolbar: false,
                 themeSystem: 'bootstrap5',
+                buttonIcons: {
+                  prev: 'ignore fa-solid fa-angle-left',
+                  next: 'ignore fa-solid fa-angle-right',
+                },
                 // Adapt to user selected locale
                 locale: '{{ LANGUAGE_CODE }}',
                 slotDuration: '01:00',
diff --git a/AKScheduling/templates/admin/AKScheduling/scheduling.html b/AKScheduling/templates/admin/AKScheduling/scheduling.html
index b9bbad4c..62dd21a5 100644
--- a/AKScheduling/templates/admin/AKScheduling/scheduling.html
+++ b/AKScheduling/templates/admin/AKScheduling/scheduling.html
@@ -84,6 +84,10 @@
                 //aspectRatio: 2,
                 height: '100%',
                 themeSystem: 'bootstrap5',
+                buttonIcons: {
+                  prev: 'ignore fa-solid fa-angle-left',
+                  next: 'ignore fa-solid fa-angle-right',
+                },
                 // Adapt to user selected locale
                 locale: '{{ LANGUAGE_CODE }}',
                 initialView: 'resourceTimelineEventVert',
@@ -288,7 +292,6 @@
             <div class="modal-content">
                 <div class="modal-header">
                     <h5 class="modal-title">{% trans "Add slot" %}</h5>
-                    text-decoration: none;
                 </div>
                 <div class="modal-body">
                     <form>
diff --git a/static_common/common/js/availabilities.js b/static_common/common/js/availabilities.js
index 54c11501..28ad46be 100644
--- a/static_common/common/js/availabilities.js
+++ b/static_common/common/js/availabilities.js
@@ -53,6 +53,10 @@ function createAvailabilityEditors(timezone, language, startDate, endDate, slotR
         let plan = new FullCalendar.Calendar(editor[0], {
             timeZone: timezone,
             themeSystem: 'bootstrap5',
+            buttonIcons: {
+                prev: 'ignore fa-solid fa-angle-left',
+                next: 'ignore fa-solid fa-angle-right',
+            },
             locale: language,
             schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source',
             editable: editable,
diff --git a/static_common/common/vendor/fullcalendar-scheduler/fullcalendar.bootstrap5-5.0.2.min.js b/static_common/common/vendor/fullcalendar-scheduler/fullcalendar.bootstrap5-5.0.2.min.js
new file mode 100644
index 00000000..b6e1d892
--- /dev/null
+++ b/static_common/common/vendor/fullcalendar-scheduler/fullcalendar.bootstrap5-5.0.2.min.js
@@ -0,0 +1,6 @@
+/*!
+FullCalendar Bootstrap 5 Plugin v6.0.2
+Docs & License: https://fullcalendar.io/docs/bootstrap5
+(c) 2022 Adam Shaw
+*/
+FullCalendar.Bootstrap5=function(e,t,o){"use strict";class r extends o.Theme{}r.prototype.classes={root:"fc-theme-bootstrap5",tableCellShaded:"fc-theme-bootstrap5-shaded",buttonGroup:"btn-group",button:"btn btn-primary",buttonActive:"active",popover:"popover",popoverHeader:"popover-header",popoverContent:"popover-body"},r.prototype.baseIconClass="bi",r.prototype.iconClasses={close:"bi-x-lg",prev:"bi-chevron-left",next:"bi-chevron-right",prevYear:"bi-chevron-double-left",nextYear:"bi-chevron-double-right"},r.prototype.rtlIconClasses={prev:"bi-chevron-right",next:"bi-chevron-left",prevYear:"bi-chevron-double-right",nextYear:"bi-chevron-double-left"},r.prototype.iconOverrideOption="buttonIcons",r.prototype.iconOverrideCustomButtonOption="icon",r.prototype.iconOverridePrefix="bi-";o.injectStyles(".fc-theme-bootstrap5 a:not([href]){color:inherit;text-decoration:inherit}.fc-theme-bootstrap5 .fc-list,.fc-theme-bootstrap5 .fc-scrollgrid,.fc-theme-bootstrap5 td,.fc-theme-bootstrap5 th{border:1px solid var(--bs-gray-400)}.fc-theme-bootstrap5 .fc-scrollgrid{border-bottom-width:0;border-right-width:0}.fc-theme-bootstrap5-shaded{background-color:var(--bs-gray-200)}");var a=t.createPlugin({name:"@fullcalendar/bootstrap5",themeClasses:{bootstrap5:r}}),n={__proto__:null,BootstrapTheme:r};return t.globalPlugins.push(a),e.Internal=n,e.default=a,Object.defineProperty(e,"__esModule",{value:!0}),e}({},FullCalendar,FullCalendar.Internal);
\ No newline at end of file
-- 
GitLab