Skip to content
Snippets Groups Projects
Commit 8ec7648c authored by jan.bednarik's avatar jan.bednarik
Browse files

uniweb: Double columns section

parent 62fc7fba
No related branches found
No related tags found
2 merge requests!101Uniweb,!100Uniweb
Pipeline #1199 passed
# Generated by Django 3.1.1 on 2020-09-09 21:54
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.images.blocks
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("uniweb", "0002_auto_20200908_2354"),
]
operations = [
migrations.AlterField(
model_name="uniwebflexiblepage",
name="content",
field=wagtail.core.fields.StreamField(
[
(
"text_section",
wagtail.core.blocks.StructBlock(
[
(
"title",
wagtail.core.blocks.CharBlock(
label="nadpis", required=False
),
),
(
"text",
wagtail.core.blocks.RichTextBlock(
features=[
"h2",
"h3",
"h4",
"h5",
"bold",
"italic",
"ol",
"ul",
"hr",
"link",
"document-link",
"image",
"superscript",
"subscript",
"strikethrough",
"blockquote",
],
label="text",
),
),
]
),
),
(
"columns_section",
wagtail.core.blocks.StructBlock(
[
(
"title",
wagtail.core.blocks.CharBlock(
label="nadpis", required=False
),
),
(
"left_text",
wagtail.core.blocks.RichTextBlock(
features=[
"h2",
"h3",
"h4",
"h5",
"bold",
"italic",
"ol",
"ul",
"hr",
"link",
"document-link",
"image",
"superscript",
"subscript",
"strikethrough",
"blockquote",
],
label="text",
),
),
(
"right_text",
wagtail.core.blocks.RichTextBlock(
features=[
"h2",
"h3",
"h4",
"h5",
"bold",
"italic",
"ol",
"ul",
"hr",
"link",
"document-link",
"image",
"superscript",
"subscript",
"strikethrough",
"blockquote",
],
label="text",
),
),
]
),
),
(
"gallery_section",
wagtail.core.blocks.StructBlock(
[
(
"title",
wagtail.core.blocks.CharBlock(
label="nadpis", required=False
),
),
(
"images",
wagtail.core.blocks.ListBlock(
wagtail.images.blocks.ImageChooserBlock(
label="obrázek"
)
),
),
]
),
),
],
blank=True,
verbose_name="obsah stránky",
),
),
migrations.AlterField(
model_name="uniwebhomepage",
name="content",
field=wagtail.core.fields.StreamField(
[
(
"text_section",
wagtail.core.blocks.StructBlock(
[
(
"title",
wagtail.core.blocks.CharBlock(
label="nadpis", required=False
),
),
(
"text",
wagtail.core.blocks.RichTextBlock(
features=[
"h2",
"h3",
"h4",
"h5",
"bold",
"italic",
"ol",
"ul",
"hr",
"link",
"document-link",
"image",
"superscript",
"subscript",
"strikethrough",
"blockquote",
],
label="text",
),
),
]
),
),
(
"columns_section",
wagtail.core.blocks.StructBlock(
[
(
"title",
wagtail.core.blocks.CharBlock(
label="nadpis", required=False
),
),
(
"left_text",
wagtail.core.blocks.RichTextBlock(
features=[
"h2",
"h3",
"h4",
"h5",
"bold",
"italic",
"ol",
"ul",
"hr",
"link",
"document-link",
"image",
"superscript",
"subscript",
"strikethrough",
"blockquote",
],
label="text",
),
),
(
"right_text",
wagtail.core.blocks.RichTextBlock(
features=[
"h2",
"h3",
"h4",
"h5",
"bold",
"italic",
"ol",
"ul",
"hr",
"link",
"document-link",
"image",
"superscript",
"subscript",
"strikethrough",
"blockquote",
],
label="text",
),
),
]
),
),
(
"gallery_section",
wagtail.core.blocks.StructBlock(
[
(
"title",
wagtail.core.blocks.CharBlock(
label="nadpis", required=False
),
),
(
"images",
wagtail.core.blocks.ListBlock(
wagtail.images.blocks.ImageChooserBlock(
label="obrázek"
)
),
),
]
),
),
],
blank=True,
verbose_name="obsah stránky",
),
),
]
......@@ -43,6 +43,17 @@ class TextSectionBlock(blocks.StructBlock):
label = "textová sekce"
class ColumnsSectionBlock(blocks.StructBlock):
title = blocks.CharBlock(label="nadpis", required=False)
left_text = blocks.RichTextBlock(label="levý sloupec", features=RICH_TEXT_FEATURES)
right_text = blocks.RichTextBlock(
label="pravý sloupec", features=RICH_TEXT_FEATURES
)
class Meta:
label = "dvousloupcová textová sekce"
class GallerySectionBlock(blocks.StructBlock):
title = blocks.CharBlock(label="nadpis", required=False)
images = blocks.ListBlock(ImageChooserBlock(label="obrázek"))
......@@ -81,6 +92,7 @@ class UniwebHomePage(MetadataPageMixin, Page):
content = StreamField(
[
("text_section", TextSectionBlock()),
("columns_section", ColumnsSectionBlock()),
("gallery_section", GallerySectionBlock()),
],
verbose_name="obsah stránky",
......@@ -139,6 +151,7 @@ class UniwebFlexiblePage(Page, SubpageMixin, MetadataPageMixin):
content = StreamField(
[
("text_section", TextSectionBlock()),
("columns_section", ColumnsSectionBlock()),
("gallery_section", GallerySectionBlock()),
],
verbose_name="obsah stránky",
......
......@@ -13,6 +13,17 @@
</div>
{% endif %}
{% if section.block_type == "columns_section" %}
<div class="lg:flex">
<div class="content-block lg:w-1/2 lg:pr-5 my-4">
{{ section.value.left_text|richtext }}
</div>
<div class="content-block lg:w-1/2 lg:pl-5 my-4">
{{ section.value.right_text|richtext }}
</div>
</div>
{% endif %}
{% if section.block_type == "gallery_section" %}
<div class="content-block w-full my-6 grid grid-cols-4 gap-4">
{% for picture in section.value.images %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment