add popup banner format
All checks were successful
Website Prod/Test / Produktivumgebung (push) Successful in 16s
Website Prod/Test / Testumgebung (push) Successful in 8s

This commit is contained in:
Denys Konovalov 2025-01-16 12:05:19 +01:00
parent 54d7c00a45
commit edd6b67125
3 changed files with 20 additions and 10 deletions

View File

@ -1,16 +1,14 @@
top_banner: top_banner:
enable: true enable: true
text: >+ text: |
Unser früherer Schüler Dominic Wagner verunglückte mit 17 Jahren schwer. 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 Seitdem braucht er 1:1 Pflege. Bitte unterstützen Sie die Finanzierung
dafür: dafür:
[https://www.gofundme.com/f/eigenanteil-der-pflegekosten](https://www.gofundme.com/f/eigenanteil-der-pflegekosten) [https://www.gofundme.com/f/eigenanteil-der-pflegekosten](https://www.gofundme.com/f/eigenanteil-der-pflegekosten)
color: "#19aa96" color: "#19aa96"
font_color: "#ffffff" font_color: "#ffffff"
icon: plus-box icon: plus-box
large: true
temporarily: temporarily:
enable: false enable: false
start_date: 2024-11-29 start_date: 2024-11-29

View File

@ -85,9 +85,14 @@
</header> </header>
{{ $top_banner := .Site.Data.homepage.top_banner }} {{ $top_banner := .Site.Data.homepage.top_banner }}
{{ if and $top_banner.enable }} {{ 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))) }} {{ 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 }} {{ with $top_banner }}
{{ if .large }}
{{ $title := "Willkommen auf der Website des Georg-Cantor-Gymnasiums!" }}
{{ partial "modal" (dict "title" $title "content" (.text | markdownify)) }}
<script>$(window).on("DOMContentLoaded", () => $('#{{ md5 $title }}').modal('show'));</script>
{{ else }}
<div id="top-banner" class="p-3" style="background: {{ .color }}" data-pagefind-ignore> <div id="top-banner" class="p-3" style="background: {{ .color }}" data-pagefind-ignore>
<div class="container"> <div class="container">
<div class="no-gutters align-items-center"> <div class="no-gutters align-items-center">
@ -95,8 +100,9 @@
</div> </div>
</div> </div>
</div> </div>
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }}
{{ end }} {{ end }}
<div id="pagefind-search" class="modal fade" data-pagefind-ignore> <div id="pagefind-search" class="modal fade" data-pagefind-ignore>
@ -107,4 +113,4 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -57,6 +57,12 @@ const SettingsCollection = {
required: false, required: false,
}, },
IconList, IconList,
{
name: "large",
label: "Popup-Fenster (Vollbild)",
widget: "boolean",
required: false,
},
{ {
name: "temporarily", name: "temporarily",
label: "Zeitschaltung", label: "Zeitschaltung",