Skip to content

Commit

Permalink
Merge pull request #10 from hft-app/ljans
Browse files Browse the repository at this point in the history
Add vacation screen
  • Loading branch information
ljans authored Jul 11, 2024
2 parents 5ae1a34 + 475ad23 commit d030a07
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 28 deletions.
7 changes: 7 additions & 0 deletions scripts/module/lectures.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
76 changes: 48 additions & 28 deletions templates/_lectures.html
Original file line number Diff line number Diff line change
@@ -1,34 +1,54 @@
<!--
<div class="wrapper">
<div class="screen">
<div class="container">
<div class="icon fa-solid fa-circle-question"></div>
<div class="title">Nichts gefunden</div>
<div class="line"></div>
<div class="info">
<p>Keine Vorlesungen in nächster Zeit.</p>
{{^hasLectures}}
{{^hasEnrollments}}
<div class="wrapper">
<div class="screen">
<div class="container">
<div class="icon fa-solid fa-circle-question"></div>
<div class="title">Nichts gefunden</div>
<div class="line"></div>
<div class="info">
<p>Noch keine Kurse ausgewählt.</p>
</div>
<a class="button" href="/courses">Zur Kursauswahl</a>
</div>
<a class="button" href="/courses">Zur Kursauswahl</a>
</div>
</div>
</div>
-->
<div class="wrapper">
<div class="timetable">
{{#days}}
<div class="col">
<div class="head" onclick="if(confirm('Farben neu mischen?')) document.location='/lectures/?repaint'">
{{#date}}
<div class="day">[[date.l.{{w}}]]</div>
<div class="date">{{j}}. [[date.F.{{n}}]]</div>
{{/date}}
{{/hasEnrollments}}
{{#hasEnrollments}}
<div class="wrapper">
<div class="screen">
<div class="container">
{{#summer}}<div class="icon fa-solid fa-umbrella-beach"></div>{{/summer}}
{{^summer}}<div class="icon fa-solid fa-person-snowboarding"></div>{{/summer}}
<div class="title">Vorlesungsfrei</div>
<div class="line"></div>
<div class="info">
<p>Keine Vorlesungen in nächster Zeit.</p>
</div>
<a class="button" href="/courses">Zur Kursauswahl</a>
</div>
<table>
<tbody>
{{table}}
</tbody>
</table>
</div>
{{/days}}
</div>
{{/hasEnrollments}}
{{/hasLectures}}
{{#hasLectures}}
<div class="wrapper">
<div class="timetable">
{{#days}}
<div class="col">
<div class="head" onclick="if(confirm('Farben neu mischen?')) document.location='/lectures/?repaint'">
{{#date}}
<div class="day">[[date.l.{{w}}]]</div>
<div class="date">{{j}}. [[date.F.{{n}}]]</div>
{{/date}}
</div>
<table>
<tbody>
{{table}}
</tbody>
</table>
</div>
{{/days}}
</div>
</div>
</div>
{{/hasLectures}}

0 comments on commit d030a07

Please sign in to comment.