From edd6b671251541749d67bd0b3cbf9dbaf6e68d3d Mon Sep 17 00:00:00 2001 From: Denys Konovalov Date: Thu, 16 Jan 2025 12:05:19 +0100 Subject: [PATCH] add popup banner format --- data/homepage.yml | 6 ++---- layouts/partials/header.html | 18 ++++++++++++------ .../config/collections/settings-collection.js | 6 ++++++ 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/data/homepage.yml b/data/homepage.yml index 2ad2daed..f1ce86ba 100644 --- a/data/homepage.yml +++ b/data/homepage.yml @@ -1,16 +1,14 @@ top_banner: enable: true - text: >+ + text: | Unser früherer Schüler Dominic Wagner verunglückte mit 17 Jahren schwer. Seitdem braucht er 1:1 Pflege. Bitte unterstützen Sie die Finanzierung dafür: [https://www.gofundme.com/f/eigenanteil-der-pflegekosten](https://www.gofundme.com/f/eigenanteil-der-pflegekosten) - - - color: "#19aa96" font_color: "#ffffff" icon: plus-box + large: true temporarily: enable: false start_date: 2024-11-29 diff --git a/layouts/partials/header.html b/layouts/partials/header.html index c72db478..9129681f 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -85,9 +85,14 @@ {{ $top_banner := .Site.Data.homepage.top_banner }} - {{ if and $top_banner.enable }} - {{ if or (not $top_banner.temporarily.enable) (and $top_banner.temporarily.enable (and (le ($top_banner.temporarily.start_date | time.AsTime) now) (ge ($top_banner.temporarily.end_date | time.AsTime) now))) }} - {{ with $top_banner }} +{{ if and $top_banner.enable }} +{{ if or (not $top_banner.temporarily.enable) (and $top_banner.temporarily.enable (and (le ($top_banner.temporarily.start_date | time.AsTime) now) (ge ($top_banner.temporarily.end_date | time.AsTime) now))) }} +{{ with $top_banner }} +{{ if .large }} + {{ $title := "Willkommen auf der Website des Georg-Cantor-Gymnasiums!" }} + {{ partial "modal" (dict "title" $title "content" (.text | markdownify)) }} + +{{ else }}
@@ -95,8 +100,9 @@
- {{ end }} - {{ end }} +{{ end }} +{{ end }} +{{ end }} {{ end }} - \ No newline at end of file + diff --git a/static/admin/config/collections/settings-collection.js b/static/admin/config/collections/settings-collection.js index 1bfe7d81..1740d01c 100644 --- a/static/admin/config/collections/settings-collection.js +++ b/static/admin/config/collections/settings-collection.js @@ -57,6 +57,12 @@ const SettingsCollection = { required: false, }, IconList, + { + name: "large", + label: "Popup-Fenster (Vollbild)", + widget: "boolean", + required: false, + }, { name: "temporarily", label: "Zeitschaltung",