Skip to content
Snippets Groups Projects
Commit 7d82314d authored by Štěpán Farka's avatar Štěpán Farka Committed by jan.bednarik
Browse files

[ADD] content to district HP

parent 99108319
No related branches found
No related tags found
2 merge requests!554[ADD] content to district HP,!551[ADD] content to district HP
Pipeline #8536 passed
# Generated by Django 4.0.4 on 2022-06-09 12:45
import wagtail.core.blocks
import wagtail.core.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("district", "0088_delete_districttagspage"),
]
operations = [
migrations.AddField(
model_name="districthomepage",
name="content",
field=wagtail.core.fields.StreamField(
[
(
"text",
wagtail.core.blocks.RichTextBlock(
features=[
"h2",
"h3",
"h4",
"h5",
"bold",
"italic",
"ol",
"ul",
"hr",
"link",
"document-link",
"image",
"superscript",
"subscript",
"strikethrough",
"blockquote",
],
label="Textový editor",
),
),
(
"headline",
wagtail.core.blocks.StructBlock(
[
(
"headline",
wagtail.core.blocks.CharBlock(
label="Headline", max_length=300, required=True
),
),
(
"style",
wagtail.core.blocks.ChoiceBlock(
choices=[
("head-alt-xl", "Bebas XL"),
("head-alt-lg", "Bebas L"),
("head-alt-md", "Bebas M"),
("head-alt-base", "Bebas base"),
("head-alt-sm", "Bebas SM"),
("head-alt-xs", "Bebas XS"),
("head-alt-2xs", "Bebas 2XS"),
("head-heavy-base", "Roboto base"),
("head-heavy-sm", "Roboto SM"),
("head-heavy-xs", "Roboto XS"),
("head-heavy-2xs", "Roboto 2XS"),
("head-allcaps-2xs", "Allcaps 2XS"),
("head-allcaps-3xs", "Allcaps 3XS"),
("head-allcaps-4xs", "Allcaps 4XS"),
(
"head-heavy-allcaps-2xs",
"Allcaps heavy 2XS",
),
(
"head-heavy-allcaps-3xs",
"Allcaps heavy 3XS",
),
(
"head-heavy-allcaps-4xs",
"Allcaps heavy 4XS",
),
],
help_text="Náhled si prohlédněte na https://styleguide.pir-test.eu/latest/?p=viewall-atoms-text.",
label="Styl",
),
),
(
"tag",
wagtail.core.blocks.ChoiceBlock(
choices=[
("h1", "H1"),
("h2", "H2"),
("h3", "H3"),
("h4", "H4"),
("h5", "H5"),
("h6", "H6"),
],
help_text="Čím nižší číslo, tím vyšší úroveň.",
label="Úroveň nadpisu",
),
),
(
"align",
wagtail.core.blocks.ChoiceBlock(
choices=[
("auto", "Automaticky"),
("center", "Na střed"),
],
label="Zarovnání",
),
),
]
),
),
],
blank=True,
verbose_name="Obsah stránky",
),
),
]
...@@ -42,6 +42,7 @@ from shared.blocks import ( ...@@ -42,6 +42,7 @@ from shared.blocks import (
DEFAULT_CONTENT_BLOCKS, DEFAULT_CONTENT_BLOCKS,
ButtonGroupBlock, ButtonGroupBlock,
FigureBlock, FigureBlock,
HeadlineBlock,
YouTubeVideoBlock, YouTubeVideoBlock,
) )
from shared.const import RICH_TEXT_DEFAULT_FEATURES from shared.const import RICH_TEXT_DEFAULT_FEATURES
...@@ -72,6 +73,21 @@ class DistrictHomePage( ...@@ -72,6 +73,21 @@ class DistrictHomePage(
verbose_name="Blok pod headerem", verbose_name="Blok pod headerem",
blank=True, blank=True,
) )
content = StreamField(
[
(
"text",
blocks.RichTextBlock(
label="Textový editor", features=RICH_TEXT_DEFAULT_FEATURES
),
),
("headline", HeadlineBlock()),
],
verbose_name="Obsah stránky",
blank=True,
)
articles_title = models.CharField("Nadpis článků", max_length=256) articles_title = models.CharField("Nadpis článků", max_length=256)
election_countdown_datetime = models.DateTimeField( election_countdown_datetime = models.DateTimeField(
"Datum a čas pro odpočet do voleb", "Datum a čas pro odpočet do voleb",
...@@ -179,6 +195,7 @@ class DistrictHomePage( ...@@ -179,6 +195,7 @@ class DistrictHomePage(
content_panels = Page.content_panels + [ content_panels = Page.content_panels + [
StreamFieldPanel("subheader"), StreamFieldPanel("subheader"),
StreamFieldPanel("content"),
FieldPanel("articles_title"), FieldPanel("articles_title"),
FieldPanel("election_countdown_datetime"), FieldPanel("election_countdown_datetime"),
FieldPanel("show_calendar_on_hp"), FieldPanel("show_calendar_on_hp"),
......
...@@ -10,7 +10,17 @@ ...@@ -10,7 +10,17 @@
{% block container_spacing %}pt-8 lg:py-16{% endblock %} {% block container_spacing %}pt-8 lg:py-16{% endblock %}
{% block content %} {% block content %}
<h2 class="head-alt-md md:head-alt-lg pb-4 lg:pb-8">
{% if page.content %}
<div class="mb-8">
{% for block in page.content %}
{% include_block block %}
{% endfor %}
</div>
{% endif %}
{% if page.articles %}
<div class="content-block">
<h2 class="clear-both head-alt-md md:head-alt-lg pb-4 lg:pb-8">
{{ page.articles_title }} {{ page.articles_title }}
</h2> </h2>
<!-- list of articles --> <!-- list of articles -->
...@@ -23,6 +33,8 @@ ...@@ -23,6 +33,8 @@
<div class="mb-8 lg:mb-16"> <div class="mb-8 lg:mb-16">
{% include "shared/more_articles_snippet.html" %} {% include "shared/more_articles_snippet.html" %}
</div> </div>
</div>
{% endif %}
{% if page.election_countdown_datetime %} {% if page.election_countdown_datetime %}
<section class="my-8 lg:my-16 container-padding--zero lg:container-padding--auto"> <section class="my-8 lg:my-16 container-padding--zero lg:container-padding--auto">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment