From 92f43c0f3a0e0ccc53a6f020af52f3dcf5a92828 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Benjamin=20H=C3=A4ttasch?=
 <benjamin.haettasch@fachschaft.informatik.tu-darmstadt.de>
Date: Sat, 23 May 2020 00:19:43 +0200
Subject: [PATCH] Improve plan (current & wall)

Show full name of AK as tooltip
Scroll to current time
---
 AKPlan/templates/AKPlan/encode_events.html | 1 +
 AKPlan/templates/AKPlan/plan_index.html    | 7 ++++++-
 AKPlan/templates/AKPlan/plan_wall.html     | 7 ++++++-
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/AKPlan/templates/AKPlan/encode_events.html b/AKPlan/templates/AKPlan/encode_events.html
index b53dae01..10db556d 100644
--- a/AKPlan/templates/AKPlan/encode_events.html
+++ b/AKPlan/templates/AKPlan/encode_events.html
@@ -6,6 +6,7 @@
         {% if slot.start %}
             {
                 'title': '{{ slot.ak.short_name }}',
+                'description': '{{ slot.ak.name }}',
                 'start': '{{ slot.start | timezone:event.timezone | date:"Y-m-d H:i:s" }}',
                 'end': '{{ slot.end | timezone:event.timezone | date:"Y-m-d H:i:s" }}',
                 'resourceId': '{{ slot.room.title }}',
diff --git a/AKPlan/templates/AKPlan/plan_index.html b/AKPlan/templates/AKPlan/plan_index.html
index f4fc250a..976ce496 100644
--- a/AKPlan/templates/AKPlan/plan_index.html
+++ b/AKPlan/templates/AKPlan/plan_index.html
@@ -17,7 +17,6 @@
         <script src='{% static 'AKPlan/vendor/fullcalendar/timeline/main.js' %}'></script>
         <script src='{% static 'AKPlan/vendor/fullcalendar/resource-common/main.js' %}'></script>
         <script src='{% static 'AKPlan/vendor/fullcalendar/resource-timeline/main.js' %}'></script>
-
         <script>
             document.addEventListener('DOMContentLoaded', function () {
                 var planEl = document.getElementById('planCalendar');
@@ -51,6 +50,9 @@
                             buttonText: '{% trans "Event" %}',
                         }
                     },
+                    eventRender: function(info) {
+                        $(info.el).tooltip({title: info.event.extendedProps.description});
+                    },
                     editable: false,
                     allDaySlot: false,
                     nowIndicator: true,
@@ -64,6 +66,9 @@
                 });
 
                 plan.render();
+
+                // Scroll to current time
+                $('.fc-scroller').scrollLeft($('.fc-now-indicator').position().left);
             });
         </script>
     {% endif %}
diff --git a/AKPlan/templates/AKPlan/plan_wall.html b/AKPlan/templates/AKPlan/plan_wall.html
index 541bfd6b..c99ff3c8 100644
--- a/AKPlan/templates/AKPlan/plan_wall.html
+++ b/AKPlan/templates/AKPlan/plan_wall.html
@@ -53,7 +53,9 @@
                     start: '{{ start | timezone:event.timezone | date:"Y-m-d H:i:s" }}',
                     end: '{{ end | timezone:event.timezone  | date:"Y-m-d H:i:s"}}',
                 },
-                scrollTime: '{{ start | timezone:event.timezone | date:"H:i:s" }}',
+                eventRender: function(info) {
+                    $(info.el).tooltip({title: info.event.extendedProps.description});
+                },
                 editable: false,
                 allDaySlot: false,
                 nowIndicator: true,
@@ -75,6 +77,9 @@
             });
 
             plan.render();
+
+            // Scroll to current time
+            $('.fc-scroller').scrollLeft($('.fc-now-indicator').position().left);
         });
     </script>
 
-- 
GitLab