Umbau Terminliste: Filter anstehend/vergangen (schließt #215)

This commit is contained in:
Denys Konovalov 2023-04-03 15:53:53 +02:00
parent c4308e3734
commit 343f365301
3 changed files with 25 additions and 15 deletions

@ -66,7 +66,7 @@
var containerEl = document.querySelector('.filtr-container'); var containerEl = document.querySelector('.filtr-container');
var filterizd; var filterizd;
if (containerEl) { if (containerEl) {
filterizd = $('.filtr-container').filterizr({}); filterizd = $('.filtr-container').filterizr({layout: 'sameWidth', spinner: {enabled: true}});
} }
//Active changer //Active changer
$('.filter-controls li').on('click', function () { $('.filter-controls li').on('click', function () {

@ -2,7 +2,7 @@
title: Termine title: Termine
draft: false draft: false
bg_image: media/backgrounds/page-title.webp bg_image: media/backgrounds/page-title.webp
description: Hier sind alle Termine für das laufende Schuljahr aufgelistet. description: Hier sind alle Termine für das laufende Schuljahr aufgelistet. Die Liste kann nach anstehenden und vergangenen Terminen gefiltert werden.
events: events:
- date: 2022-08-25T18:29:41.000+02:00 - date: 2022-08-25T18:29:41.000+02:00
enddate: "" enddate: ""

@ -1,29 +1,39 @@
{{ define "main" }} {{ define "main" }}
<section class="section"> <section class="section-sm">
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<ul class="list-unstyled"> <div class="row gta-cat">
<div class="col-12">
<ul class="list-inline text-center filter-controls mb-5">
<li class="list-inline-item m-3 text-uppercase active" data-filter="all">{{ i18n "all" }}</li>
<li class="list-inline-item m-3 text-uppercase" data-filter="upcoming">Anstehend</li>
<li class="list-inline-item m-3 text-uppercase" data-filter="past">Vergangen</li>
</ul>
</div>
</div>
<noscript>
<style>
.gta-cat {
display: none;
}
</style>
</noscript>
<ul class="list-unstyled filtr-container">
{{ range .Params.events }} {{ range .Params.events }}
<li class="d-md-table mb-4 w-100 border-bottom hover-shadow"> <li class="d-md-table mb-4 w-100 hover-shadow filtr-item" data-category="{{ if or (ge (.date | time.AsTime).Unix now.Unix) (and .enddate (ge (.enddate | time.AsTime).Unix now.Unix)) }}upcoming{{else}}past{{end}}" data-time="{{.date}}">
<div class="d-md-table-cell text-center p-4 bg-primary text-white mb-4 mb-md-0 termin-tc"> <div class="d-md-table-cell text-center p-4 bg-primary text-white mb-4 mb-md-0 termin-tc">
<span class="h2 d-block">{{ time.Format "2" .date}}</span> <span class="h2 d-block">{{ time.Format "2" .date}}</span>
<span class="d-block">{{ time.Format "Jan 2006" .date}}</span> <span class="d-block">{{ time.Format "Jan 2006" .date}}</span>
{{ with .enddate }} {{ with .enddate }}<br>bis {{ time.Format "2 Jan 2006" . }}{{ end }}
<br>
bis {{ time.Format "2 Jan 2006" . }}
{{ end }}
</div> </div>
<div class="d-md-table-cell px-4 vertical-align-middle mb-4 mb-md-0 p-2"> <div class="d-md-table-cell px-4 vertical-align-middle mb-4 mb-md-0 p-2 border-bottom">
<p class="h4 mb-0 d-block">{{ .title }}</p> <p class="h4 mb-0 d-block">{{ .title }}</p>
</div> </div>
{{ with .location }} {{ with .location }}
<div class="d-md-table-cell text-right pr-0 pr-md-4 p-2 vertical-align-middle"> <div class="d-md-table-cell text-right pr-0 pr-md-4 p-2 vertical-align-middle border-bottom">
<p> <p><i class="mdi mdi-map-marker-radius-outline icon-s text-primary mr-2"></i>{{ . | markdownify }}</p>
<i class="mdi mdi-map-marker-radius-outline icon-s text-primary mr-2"></i>
{{ . | markdownify }}
</p>
</div> </div>
{{ end }} {{ end }}
</li> </li>