Personnel filtering

This commit is contained in:
Emil Miler 2024-01-11 19:25:02 +01:00
parent b931d375d9
commit de91695b07
40 changed files with 101 additions and 2 deletions

View File

@ -4,4 +4,5 @@ weight = 3
[extra] [extra]
name = "Anežka Kolešová" name = "Anežka Kolešová"
role = "Instruktor" role = "Instruktor"
beh = [3]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 3
[extra] [extra]
name = "Bára Vavřínová" name = "Bára Vavřínová"
role = "Instruktor" role = "Instruktor"
beh = [1]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 3
[extra] [extra]
name = "Dalibor Brabec" name = "Dalibor Brabec"
role = "Instruktor" role = "Instruktor"
beh = [1]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 7
[extra] [extra]
name = "David Malý" name = "David Malý"
role = "Hospodář" role = "Hospodář"
beh = [3]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 2
[extra] [extra]
name = "Emil Miler" name = "Emil Miler"
role = "Oddílák" role = "Oddílák"
beh = [1,3]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 6
[extra] [extra]
name = "Hanka Malá" name = "Hanka Malá"
role = "Kuchař" role = "Kuchař"
beh = [3]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 3
[extra] [extra]
name = "Hanka Vajsejtlová" name = "Hanka Vajsejtlová"
role = "Instruktor" role = "Instruktor"
beh = [1,3]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 99
[extra] [extra]
name = "Honza Kubíček" name = "Honza Kubíček"
role = "Hlavas na dovolené" role = "Hlavas na dovolené"
beh = [3]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 2
[extra] [extra]
name = "Jan Šruc" name = "Jan Šruc"
role = "Oddílák" role = "Oddílák"
beh = [1]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 2
[extra] [extra]
name = "Janča Blahoudková" name = "Janča Blahoudková"
role = "Oddílák" role = "Oddílák"
beh = [3]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 5
[extra] [extra]
name = "Jára Dryml" name = "Jára Dryml"
role = "Technik" role = "Technik"
beh = [3]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 7
[extra] [extra]
name = "Jindra Jobbik" name = "Jindra Jobbik"
role = "Hospodář" role = "Hospodář"
beh = [3]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 3
[extra] [extra]
name = "Kačka Kolářová" name = "Kačka Kolářová"
role = "Instruktor" role = "Instruktor"
beh = [1,3]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 2
[extra] [extra]
name = "Kamil Koza" name = "Kamil Koza"
role = "Oddílák, Hokr" role = "Oddílák, Hokr"
beh = [1,3]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 6
[extra] [extra]
name = "Karel Matoušek" name = "Karel Matoušek"
role = "Kuchař" role = "Kuchař"
beh = [3]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 3
[extra] [extra]
name = "Kristýna Dusová" name = "Kristýna Dusová"
role = "Instruktor" role = "Instruktor"
beh = [3]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 3
[extra] [extra]
name = "Lucka Odradovcová" name = "Lucka Odradovcová"
role = "Instruktor" role = "Instruktor"
beh = [1]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 2
[extra] [extra]
name = "Lukáš Brůžek" name = "Lukáš Brůžek"
role = "Oddílák" role = "Oddílák"
beh = [1]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 5
[extra] [extra]
name = "Martin Kocourek" name = "Martin Kocourek"
role = "Technik" role = "Technik"
beh = [1]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 3
[extra] [extra]
name = "Martina Babáková" name = "Martina Babáková"
role = "Instruktor" role = "Instruktor"
beh = [3]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 2
[extra] [extra]
name = "Míša Michalová" name = "Míša Michalová"
role = "Oddílák" role = "Oddílák"
beh = [3]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 1
[extra] [extra]
name = "Michal Roučka" name = "Michal Roučka"
role = "Hlavní vedoucí" role = "Hlavní vedoucí"
beh = [1]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 4
[extra] [extra]
name = "Mirka Lišková" name = "Mirka Lišková"
role = "Zdravotník" role = "Zdravotník"
beh = [1]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 2
[extra] [extra]
name = "Ondra Slavík" name = "Ondra Slavík"
role = "Oddílák" role = "Oddílák"
beh = [3]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 5
[extra] [extra]
name = "Pavel Kačírek" name = "Pavel Kačírek"
role = "Technik" role = "Technik"
beh = [1]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 5
[extra] [extra]
name = "Pavel Sebera" name = "Pavel Sebera"
role = "Technik" role = "Technik"
beh = [3]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 2
[extra] [extra]
name = "Petra Skotnicová" name = "Petra Skotnicová"
role = "Oddílák" role = "Oddílák"
beh = [1]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 4
[extra] [extra]
name = "Šárka Seberová" name = "Šárka Seberová"
role = "Zdravotník" role = "Zdravotník"
beh = [3]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 7
[extra] [extra]
name = "Standa Skotnica" name = "Standa Skotnica"
role = "Hospodář" role = "Hospodář"
beh = [1]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 3
[extra] [extra]
name = "Terka Jánová" name = "Terka Jánová"
role = "Instruktor" role = "Instruktor"
beh = [1]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 3
[extra] [extra]
name = "Tomáš Brůžek" name = "Tomáš Brůžek"
role = "Instruktor" role = "Instruktor"
beh = [1,3]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 0
[extra] [extra]
name = "Tomáš Zdobnický" name = "Tomáš Zdobnický"
role = "Předseda" role = "Předseda"
beh = [1,3]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 6
[extra] [extra]
name = "Venca Třeštík" name = "Venca Třeštík"
role = "Kuchař" role = "Kuchař"
beh = [1]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 2
[extra] [extra]
name = "Verča Pekařová" name = "Verča Pekařová"
role = "Oddílák" role = "Oddílák"
beh = [3]
+++ +++

View File

@ -4,4 +4,5 @@ weight = 1
[extra] [extra]
name = "Verča Roučková" name = "Verča Roučková"
role = "Hlavní vedoucí" role = "Hlavní vedoucí"
beh = [1,3]
+++ +++

View File

@ -1,17 +1,43 @@
.personnel { .personnel {
.filters {
display: flex;
justify-content: center;
gap: 1em;
margin-bottom: 5em;
.button {
padding: .5em 1.5em;
font-weight: bold;
border: 2px solid #ccc;
border-radius: .5em;
cursor: pointer;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
transition: border-color .2s ease-out;
&:hover, &.active {
border-color: #333;
}
}
}
.person { .person {
text-align: center; text-align: center;
transition: opacity .5s ease-out;
img { img {
border-radius: 1em; border-radius: 1em;
margin-bottom: 1em; margin-bottom: 1em;
filter: drop-shadow(0 0 10px rgba(0,0,0,0.3)); box-shadow: 0 0 15px rgba(0,0,0,0.3);
} }
.name { .name {
font-weight: bold; font-weight: bold;
} }
&.hidden {
opacity: .3;
}
} }
} }

17
static/js/personnel.js Normal file
View File

@ -0,0 +1,17 @@
let people = Array.from(document.getElementsByClassName("person"));
let buttons = Array.from(document.getElementsByClassName("button"));
buttons.forEach(button => {
button.addEventListener("click", function() {
buttons.forEach(button => {
button.classList.remove("active");
});
button.classList.add("active");
people.forEach(person => {
person.classList.remove("hidden");
if (button.dataset.value != 0 && !person.dataset.beh.includes(button.dataset.value)) {
person.classList.add("hidden");
}
});
});
});

View File

@ -25,6 +25,8 @@
<p>&copy; {{ now() | date(format="%Y") }} {{ config.title }}</p> <p>&copy; {{ now() | date(format="%Y") }} {{ config.title }}</p>
</footer> </footer>
{% block script %}
{% endblock %}
</body> </body>
</html> </html>

View File

@ -10,6 +10,7 @@
{% macro personnel() %} {% macro personnel() %}
{% for person in section.pages %} {% for person in section.pages %}
{%- set_global image = "/static/img/placeholder.jpg" %} {%- set_global image = "/static/img/placeholder.jpg" %}
{%- for asset in person.assets %} {%- for asset in person.assets %}
{%- if asset is matching(person.slug~"[.](jpg|png)$") %} {%- if asset is matching(person.slug~"[.](jpg|png)$") %}
@ -18,10 +19,19 @@
{% endif %} {% endif %}
{%- endfor %} {%- endfor %}
{%- set image = resize_image(path=image, width=300, height=300, op="fill") %} {%- set image = resize_image(path=image, width=300, height=300, op="fill") %}
<div class="person">
{% set_global dataset = "" %}
{% if person.extra.beh %}
{% for beh in person.extra.beh %}
{% set_global dataset = dataset ~ beh %}
{% endfor %}
{% endif %}
<div class="person" data-beh="{{ dataset }}">
<img src="{{ image.url }}" alt={{ person.extra.name }}> <img src="{{ image.url }}" alt={{ person.extra.name }}>
<div class="name">{{ person.extra.name }}</div> <div class="name">{{ person.extra.name }}</div>
<div class="role">{{ person.extra.role }}</div> <div class="role">{{ person.extra.role }}</div>
</div> </div>
{% endfor %} {% endfor %}
{% endmacro %} {% endmacro %}

View File

@ -5,8 +5,17 @@
{{ section.content | safe }} {{ section.content | safe }}
</section> </section>
<section class="wrap personnel"> <section class="wrap personnel">
<div class="filters">
<div id="all" class="button active" data-value="0">Všichni</div>
<div id="1" class="button" data-value="1">1. Běh</div>
<div id="3" class="button" data-value="3">3. Běh</div>
</div>
<div class="grid grid-5 gap-3"> <div class="grid grid-5 gap-3">
{{ macros::personnel() }} {{ macros::personnel() }}
</div> </div>
</section> </section>
{% endblock %} {% endblock %}
{% block script %}
<script src="{{ get_url(path="/js/personnel.js") }}"></script>
{% endblock %}