From 475ad23dd91f1d4b41602a788c9100c097077c15 Mon Sep 17 00:00:00 2001 From: Lukas Jans Date: Thu, 11 Jul 2024 22:20:54 +0200 Subject: [PATCH] Add vacation screen --- scripts/module/lectures.js | 7 ++++ templates/_lectures.html | 76 ++++++++++++++++++++++++-------------- 2 files changed, 55 insertions(+), 28 deletions(-) diff --git a/scripts/module/lectures.js b/scripts/module/lectures.js index f7fccb5..e2de28e 100644 --- a/scripts/module/lectures.js +++ b/scripts/module/lectures.js @@ -10,6 +10,13 @@ class Lectures { this.days = []; this.hasLectures = false; + // Check enrollments + const enrollments = await this.handler.controller.idb.state.get('enrollments') || {}; + this.hasEnrollments = Object.keys(enrollments).length > 0; + + // Check semester + this.summer = Math.abs(this.handler.today.getMonth() - 7) < 3; + // Set and get color seed if(request.GET.has('repaint')) await this.handler.controller.idb.state.put(Math.floor(Math.random() * 101), 'seed'); var seed = await this.handler.controller.idb.state.get('seed') || 36; diff --git a/templates/_lectures.html b/templates/_lectures.html index 27787b0..1714798 100644 --- a/templates/_lectures.html +++ b/templates/_lectures.html @@ -1,34 +1,54 @@ - -
-
- {{#days}} -
-
- {{#date}} -
[[date.l.{{w}}]]
-
{{j}}. [[date.F.{{n}}]]
- {{/date}} + {{/hasEnrollments}} + {{#hasEnrollments}} +
+
+
+ {{#summer}}
{{/summer}} + {{^summer}}
{{/summer}} +
Vorlesungsfrei
+
+
+

Keine Vorlesungen in nächster Zeit.

+
+ Zur Kursauswahl
- - - {{table}} - -
- {{/days}} +
+ {{/hasEnrollments}} +{{/hasLectures}} +{{#hasLectures}} +
+
+ {{#days}} +
+
+ {{#date}} +
[[date.l.{{w}}]]
+
{{j}}. [[date.F.{{n}}]]
+ {{/date}} +
+ + + {{table}} + +
+
+ {{/days}} +
-
+{{/hasLectures}}