Skip to content
Snippets Groups Projects
Commit a559b5fe authored by Ondrej Rehounek's avatar Ondrej Rehounek
Browse files

district and region:More custom settings for candidate list

parent a70f39a7
No related branches found
No related tags found
2 merge requests!418Release,!414district and region modules
Pipeline #6246 passed
...@@ -45,6 +45,14 @@ class CandidateListBlock(StructBlock): ...@@ -45,6 +45,14 @@ class CandidateListBlock(StructBlock):
call_to_action_button_text = CharBlock( call_to_action_button_text = CharBlock(
label="Text tlačítka 'call-to-action' baneru", max_length=24, required=False label="Text tlačítka 'call-to-action' baneru", max_length=24, required=False
) )
candidate_list_big_count = IntegerBlock(
label="Počet kanditátů s velkým náhledem", default=7
)
candidate_list_shown_count = IntegerBlock(
label="Počet zobrazených kandidátů při načtení stránky (včetně velkých náhledů)",
default=16,
)
candidate_list = ListBlock( candidate_list = ListBlock(
PageChooserBlock(label="Osoba", page_type=["district.DistrictPersonPage"]), PageChooserBlock(label="Osoba", page_type=["district.DistrictPersonPage"]),
label="Kandidáti", label="Kandidáti",
......
# Generated by Django 3.2.8 on 2021-11-28 16:13
import wagtail.core.blocks
import wagtail.core.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("district", "0029_alter_districtcenterpage_sidebar_content"),
]
operations = [
migrations.AlterField(
model_name="districtelectionpage",
name="content",
field=wagtail.core.fields.StreamField(
[
(
"candidate_list",
wagtail.core.blocks.StructBlock(
[
(
"title",
wagtail.core.blocks.CharBlock(
label="Titulek", required=True
),
),
(
"call_to_action_text",
wagtail.core.blocks.CharBlock(
label="Text 'call-to-action' baneru"
),
),
(
"call_to_action_link",
wagtail.core.blocks.URLBlock(
label="Odkaz 'call-to-action' baneru",
required=False,
),
),
(
"call_to_action_button_text",
wagtail.core.blocks.CharBlock(
label="Text tlačítka 'call-to-action' baneru",
max_length=24,
required=False,
),
),
(
"candidate_list_big_count",
wagtail.core.blocks.IntegerBlock(
default=7,
label="Počet kanditátů s velkým náhledem",
),
),
(
"candidate_list_shown_count",
wagtail.core.blocks.IntegerBlock(
default=16,
label="Počet zobrazených kandidátů při načtení stránky (včetně velkých náhledů)",
),
),
(
"candidate_list",
wagtail.core.blocks.ListBlock(
wagtail.core.blocks.PageChooserBlock(
label="Osoba",
page_type=["district.DistrictPersonPage"],
),
label="Kandidáti",
),
),
]
),
)
],
blank=True,
verbose_name="Obsah stránky",
),
),
]
<h1 class="head-alt-md text-center py-8 lg:pt-24 lg:pb-8"> <h1 class="head-alt-md text-center py-8 lg:pt-24 lg:pb-8">
Kandidáti do zastupitelstva Pardubického kraje {{ self.title }}
</h1> </h1>
<div class="candidate-card-list grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4"> <div class="candidate-card-list grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4">
{% for person_page in self.candidate_list %} {% for person_page in self.candidate_list %}
{% if forloop.counter < 8 %} {% if forloop.counter <= self.candidate_list_big_count %}
{% include "shared/full_candidate_snippet.html" %} {% include "shared/full_candidate_snippet.html" %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
...@@ -29,15 +29,15 @@ ...@@ -29,15 +29,15 @@
<div class="candidate-table pt-8 container-padding--zero lg:container-padding--auto" <div class="candidate-table pt-8 container-padding--zero lg:container-padding--auto"
:class="{'candidate-table--fadeout': !isCurrentView('fullCandidateTable')}"> :class="{'candidate-table--fadeout': !isCurrentView('fullCandidateTable')}">
{% for person_page in self.candidate_list %} {% for person_page in self.candidate_list %}
{# Záměrně neomezuju list přes indexy, abych si držel counter pro snippet #} {# Záměrně neomezuju list přes indexy, ale ifuju, abych si držel counter pro snippet #}
{% if forloop.counter >= 8 and forloop.counter < 16 %} {% if forloop.counter > self.candidate_list_big_count and forloop.counter <= self.candidate_list_shown_count %}
{% include "shared/compact_candidate_snippet.html" %} {% include "shared/compact_candidate_snippet.html" %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
<template v-if="isCurrentView('fullCandidateTable')"> <template v-if="isCurrentView('fullCandidateTable')">
{% for person_page in self.candidate_list %} {% for person_page in self.candidate_list %}
{# Záměrně neomezuju list přes indexy, abych si držel counter pro snippet #} {# Záměrně neomezuju list přes indexy, ale ifuju, abych si držel counter pro snippet #}
{% if forloop.counter >= 16 %} {% if forloop.counter > self.candidate_list_shown_count %}
{% include "shared/compact_candidate_snippet.html" %} {% include "shared/compact_candidate_snippet.html" %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
......
...@@ -45,6 +45,14 @@ class CandidateListBlock(StructBlock): ...@@ -45,6 +45,14 @@ class CandidateListBlock(StructBlock):
call_to_action_button_text = CharBlock( call_to_action_button_text = CharBlock(
label="Text tlačítka 'call-to-action' baneru", max_length=24, required=False label="Text tlačítka 'call-to-action' baneru", max_length=24, required=False
) )
candidate_list_big_count = IntegerBlock(
label="Počet kanditátů s velkým náhledem", default=7
)
candidate_list_shown_count = IntegerBlock(
label="Počet zobrazených kandidátů při načtení stránky (včetně velkých náhledů)",
default=16,
)
candidate_list = ListBlock( candidate_list = ListBlock(
PageChooserBlock(label="Osoba", page_type=["region.RegionPersonPage"]), PageChooserBlock(label="Osoba", page_type=["region.RegionPersonPage"]),
label="Kandidáti", label="Kandidáti",
......
# Generated by Django 3.2.8 on 2021-11-28 16:13
import wagtail.core.blocks
import wagtail.core.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("region", "0006_alter_regioncenterpage_sidebar_content"),
]
operations = [
migrations.AlterField(
model_name="regionelectionpage",
name="content",
field=wagtail.core.fields.StreamField(
[
(
"candidate_list",
wagtail.core.blocks.StructBlock(
[
(
"title",
wagtail.core.blocks.CharBlock(
label="Titulek", required=True
),
),
(
"call_to_action_text",
wagtail.core.blocks.CharBlock(
label="Text 'call-to-action' baneru"
),
),
(
"call_to_action_link",
wagtail.core.blocks.URLBlock(
label="Odkaz 'call-to-action' baneru",
required=False,
),
),
(
"call_to_action_button_text",
wagtail.core.blocks.CharBlock(
label="Text tlačítka 'call-to-action' baneru",
max_length=24,
required=False,
),
),
(
"candidate_list_big_count",
wagtail.core.blocks.IntegerBlock(
default=7,
label="Počet kanditátů s velkým náhledem",
),
),
(
"candidate_list_shown_count",
wagtail.core.blocks.IntegerBlock(
default=16,
label="Počet zobrazených kandidátů při načtení stránky (včetně velkých náhledů)",
),
),
(
"candidate_list",
wagtail.core.blocks.ListBlock(
wagtail.core.blocks.PageChooserBlock(
label="Osoba",
page_type=["region.RegionPersonPage"],
),
label="Kandidáti",
),
),
]
),
)
],
blank=True,
verbose_name="Obsah stránky",
),
),
]
<h1 class="head-alt-md text-center py-8 lg:pt-24 lg:pb-8"> <h1 class="head-alt-md text-center py-8 lg:pt-24 lg:pb-8">
Kandidáti do zastupitelstva Pardubického kraje {{ self.title }}
</h1> </h1>
<div class="candidate-card-list grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4"> <div class="candidate-card-list grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4">
{% for person_page in self.candidate_list %} {% for person_page in self.candidate_list %}
{% if forloop.counter < 8 %} {% if forloop.counter <= self.candidate_list_big_count %}
{% include "shared/full_candidate_snippet.html" %} {% include "shared/full_candidate_snippet.html" %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
<aside class="banner bg-black text-white container-padding--zero sm:container-padding--auto"> <aside class="banner bg-black text-white container-padding--zero sm:container-padding--auto">
<i class="ico--pirati banner__icon"></i> <i class="ico--pirati banner__icon"></i>k
<div class="banner__body"> <div class="banner__body">
<h1 class="head-alt-lg banner__cta"> <h1 class="head-alt-lg banner__cta">
{{ self.call_to_action_text }} {{ self.call_to_action_text }}
...@@ -29,15 +29,15 @@ ...@@ -29,15 +29,15 @@
<div class="candidate-table pt-8 container-padding--zero lg:container-padding--auto" <div class="candidate-table pt-8 container-padding--zero lg:container-padding--auto"
:class="{'candidate-table--fadeout': !isCurrentView('fullCandidateTable')}"> :class="{'candidate-table--fadeout': !isCurrentView('fullCandidateTable')}">
{% for person_page in self.candidate_list %} {% for person_page in self.candidate_list %}
{# Záměrně neomezuju list přes indexy, abych si držel counter pro snippet #} {# Záměrně neomezuju list přes indexy, ale ifuju, abych si držel counter pro snippet #}
{% if forloop.counter >= 8 and forloop.counter < 16 %} {% if forloop.counter > self.candidate_list_big_count and forloop.counter <= self.candidate_list_shown_count %}
{% include "shared/compact_candidate_snippet.html" %} {% include "shared/compact_candidate_snippet.html" %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
<template v-if="isCurrentView('fullCandidateTable')"> <template v-if="isCurrentView('fullCandidateTable')">
{% for person_page in self.candidate_list %} {% for person_page in self.candidate_list %}
{# Záměrně neomezuju list přes indexy, abych si držel counter pro snippet #} {# Záměrně neomezuju list přes indexy, ale ifuju, abych si držel counter pro snippet #}
{% if forloop.counter >= 16 %} {% if forloop.counter > self.candidate_list_shown_count %}
{% include "shared/compact_candidate_snippet.html" %} {% include "shared/compact_candidate_snippet.html" %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment