From daa823e39575974e8acfd056da17d0138b8c06b9 Mon Sep 17 00:00:00 2001
From: Dorian Lesbre <dorian.lesbre@gmail.com>
Date: Thu, 11 Mar 2021 14:54:08 +0100
Subject: [PATCH] Timeline links+styling

---
 home/templates/activites.html | 43 ++++++++++++++++++++++++++++++-----
 1 file changed, 37 insertions(+), 6 deletions(-)

diff --git a/home/templates/activites.html b/home/templates/activites.html
index db350e2..a5170b6 100644
--- a/home/templates/activites.html
+++ b/home/templates/activites.html
@@ -28,7 +28,8 @@
 				{% for act in planning %}
 				{
 					id: {{ act.id }},
-					content: '<strong>{{ act.title }}</strong><div class="planning_room">{{ act.room }}</div>',
+					content: '<a class="hidden" href="#act-{{act.id}}"><div><strong>{{ act.title }}</strong><br>{{ act.room }}</div></a>',
+					title: '<strong>{{ act.title }}</strong><br>{{ act.room }}',
 					start: '{{ settings.date_start|date:"Y-m-d"}} {{ act.start|date:"H:i:s" }}',
 					align: 'left',
 					group: '{{ act.start|date:"d" }}',
@@ -39,13 +40,18 @@
 			]);
 
 			// Configuration for the Timeline
+			const start = '{{ settings.date_start|date:"Y-m-d"}} 00:00:00';
+			const end = '{{ settings.date_start|date:"Y-m-d"}} 23:59:59';
 			const options = {
 				showMajorLabels: false,
 				showCurrentTime: false,
-				locale: "fr-fr",
+				locale: "fr",
 				groupOrder: "order",
-				start: '{{ settings.date_start|date:"Y-m-d"}} 00:00:00',
-				end:  '{{ settings.date_start|date:"Y-m-d"}} 23:59:59',
+				start: start,
+				min: start,
+				end: end,
+				max: end,
+				selectable: false,
 			};
 
 			// Create a Timeline
@@ -55,6 +61,31 @@
 			// 	alert('selected items: ' + properties.items);
 			// });
 		</script>
+
+		<style>
+			.vis-item {
+				background-color: var(--color_bg_1);
+				color: white;
+			}
+			.vis-item-content {
+				width: 100%;
+			}
+			.vis-item a, .vis-item a:link, .vis-item a:visited {
+				text-decoration: none;
+				color: white;
+				width: 100%
+			}
+			.vis-item a div {
+				width: 100%;
+			}
+			.vis-item:hover {
+				background-color: var(--color_bg_2);
+			}
+			.vis-time-axis .grid.vis-odd {
+    background: #444;
+  }
+
+		</style>
 	{% endif %}
 
 	<h2>Activités</h2>
@@ -66,7 +97,7 @@
 	</p>
 
 	{% for activity in activities %}
-		<h3>{{ activity.title }}</h3>
+		<h3 id="act-{{ activity.id }}"">{{ activity.title }}</h3>
 		<dl>
 			<dt>Durée :</dt><dd>{{ activity.duration }}</dd>
 			<dt>MJ :</dt><dd>{{ activity.host_name }}</dd>
@@ -75,4 +106,4 @@
 			<dt>Description :</dt><dd>{{ activity.description|linebreaksbr }}</dd>
 		</dl>
 	{% endfor %}
-{% endblock %}
\ No newline at end of file
+{% endblock %}
-- 
GitLab