diff options
| author | Valentin <valentin@fricklerhandwerk.de> | 2026-01-18 21:50:03 +0100 |
|---|---|---|
| committer | Valentin <valentin@fricklerhandwerk.de> | 2026-01-18 21:50:03 +0100 |
| commit | 2727f29bb2e74ed3a622c76a8e0b9f806db6e551 (patch) | |
| tree | 01bda190cd5df266499a23b02649b8899eadbe0d /www | |
| parent | 37329e2006a97339bb781083f533ee19501823c9 (diff) | |
Zukünftige und vergangene Termine getrennt
Es wird nun auch die letzte Änderung angezeigt.
Das Datum der Veröffentlichung ist manuell zu setzen.
Das ist etwas umständlich, aber für den Moment die einfachste Lösung.
Diffstat (limited to 'www')
| -rw-r--r-- | www/framework/default.nix | 9 | ||||
| -rw-r--r-- | www/html/index.html | 3 | ||||
| -rw-r--r-- | www/index.nix | 68 |
3 files changed, 55 insertions, 25 deletions
diff --git a/www/framework/default.nix b/www/framework/default.nix index e202361..71d3c98 100644 --- a/www/framework/default.nix +++ b/www/framework/default.nix @@ -32,6 +32,15 @@ in type = with types; attrsOf (either path (submodule config.types.file)); }; + published = mkOption { + description = '' + Datum der Veröffentlichung + + Wird benutzt, um Termine in zukünftig und vergangen zu trennen. + ''; + type = types.str; + }; + events = mkOption { description = '' Termine diff --git a/www/html/index.html b/www/html/index.html index 885ae0f..b05d1ef 100644 --- a/www/html/index.html +++ b/www/html/index.html @@ -69,12 +69,13 @@ </div> <div class="row"> <img src="img/construct.gif" alt="Bald geht es weiter" width="150" height="150"> + <p>Letzte Änderung: @published@</p> </div> </div> </div> <section> <h1 id="termine">Termine</h1> - <p class="row">Neue Termine werden demnächst veröffentlicht!</p> + @future-events@ <p class="row"><a href="vergangene-termine.html">Vergangene Termine…</a></p> </section> <footer> diff --git a/www/index.nix b/www/index.nix index e60325f..d4b1fcc 100644 --- a/www/index.nix +++ b/www/index.nix @@ -11,37 +11,57 @@ files = with lib.fileset; toList (difference (fileFilter (file: file.hasExt "html") root) ./html/Kalender); - replacements = { - "@title@" = config.title; - "@stylesheet@" = ''<link rel="stylesheet" type="text/css" href="style.css">''; - "@head@" = '' - <meta charset="utf-8" /> - <meta http-equiv="X-UA-Compatible" content="IE=edge" /> - <meta name="viewport" content="width=device-width"> - <meta name="description" content="Informationen zum Stadtteil Heimfeld und seinem Stadtteilbeirat"> - <meta name="keywords" content="Heimfeld, Stadtteil, Hamburg, Stadtteilbeirat, Beirat, Stadtteilfest, Treffpunkthaus"> - <link rel="shortcut icon" type="image/x-icon" href="/img/Kraniche-dreh-klein.gif"> - <script async src="redirects.js"></script> - ''; - "@past-events@" = - with lib; - let - as-list = mapAttrsToList (name: value: { - start = value.date.start + value.time.start; - value = toString value; - }) config.events; - sorted = sortOn (event: event.start) as-list; - in - '' + replacements = + let + events = + with lib; + let + as-list = mapAttrsToList (name: value: { + start = value.date.start + value.time.start; + value = toString value; + }) config.events; + in + sortOn (event: event.start) as-list; + in + { + "@title@" = config.title; + "@published@" = config.published; + "@stylesheet@" = ''<link rel="stylesheet" type="text/css" href="style.css">''; + "@head@" = '' + <meta charset="utf-8" /> + <meta http-equiv="X-UA-Compatible" content="IE=edge" /> + <meta name="viewport" content="width=device-width"> + <meta name="description" content="Informationen zum Stadtteil Heimfeld und seinem Stadtteilbeirat"> + <meta name="keywords" content="Heimfeld, Stadtteil, Hamburg, Stadtteilbeirat, Beirat, Stadtteilfest, Treffpunkthaus"> + <link rel="shortcut icon" type="image/x-icon" href="/img/Kraniche-dreh-klein.gif"> + <script async src="redirects.js"></script> + ''; + "@past-events@" = '' + <dl> + ${ + with lib; + concatMapStringsSep "\n" (event: event.value) ( + filter (event: event.start < config.published) (reverseList events) + ) + } + </dl> + ''; + "@future-events@" = '' <dl> - ${concatMapStringsSep "\n" (event: event.value) sorted} + ${ + with lib; + concatMapStringsSep "\n" (event: event.value) ( + filter (event: event.start >= config.published) events + ) + } </dl> ''; - }; + }; replace = file: with lib; replaceStrings (attrNames replacements) (attrValues replacements) file; in { title = "Stadtteilbeirat Heimfeld"; + published = "2026-01-18"; events = with lib; listToAttrs ( |
