Skip to content
Snippets Groups Projects
Commit ed4ee222 authored by Alexa Valentová's avatar Alexa Valentová
Browse files

add calendar & clocks

parent d2cf86c6
Branches
No related tags found
2 merge requests!1047Uniweb redesign,!1045Uniweb redesign, minor district redesign fixes
Showing
with 296 additions and 76 deletions
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -1118,6 +1118,72 @@ class PictureHeadlineBlock(ColorBlock):
template = "styleguide2/includes/atoms/text/heading_with_image.html"
class ColumnsTextBlock(blocks.StructBlock):
left_text = blocks.RichTextBlock(
label="levý sloupec", features=RICH_TEXT_DEFAULT_FEATURES
)
right_text = blocks.RichTextBlock(
label="pravý sloupec", features=RICH_TEXT_DEFAULT_FEATURES
)
class Meta:
label = "Text dva sloupce"
icon = "doc-full"
template = "styleguide2/includes/atoms/text/two_columns_richtext.html"
class AdvancedColumnsTextBlock(ColorBlock, AlignBlock):
left_text = blocks.RichTextBlock(
label="levý sloupec", features=RICH_TEXT_DEFAULT_FEATURES
)
right_text = blocks.RichTextBlock(
label="pravý sloupec", features=RICH_TEXT_DEFAULT_FEATURES
)
class Meta:
label = "Text dva sloupce (pokročilý)"
icon = "doc-full"
template = "styleguide2/includes/atoms/text/advanced_two_columns_richtext.html"
class PictureListBlock(ColorBlock):
items = blocks.ListBlock(
blocks.RichTextBlock(label="Odstavec", features=RICH_TEXT_DEFAULT_FEATURES),
label="Odstavce",
)
picture = ImageChooserBlock(
label="Obrázek",
help_text="Rozměr 30x30px nebo více (obrázek bude zmenšen na 30x30px)",
)
class Meta:
label = "Seznam z obrázkovými odrážkami"
icon = "list-ul"
template = "styleguide2/includes/molecules/lists/image_list.html"
class ButtonBlock(blocks.StructBlock):
text = blocks.CharBlock(label="Nadpis")
url = blocks.URLBlock(
label="Odkaz",
help_text="Pokud je odkaz vyplněný, není nutno vyplňovat stránku.",
required=False,
)
page = blocks.PageChooserBlock(
label="Stránka",
help_text="Pokud je stránka vyplněná, není nutno vyplňovat odkaz.",
required=False,
)
class Meta:
label = "Tlačítko"
icon = "link-external"
group = "ostatní"
template = "uniweb/blocks/button.html"
DEFAULT_CONTENT_BLOCKS = [
(
"text",
......@@ -1128,6 +1194,7 @@ DEFAULT_CONTENT_BLOCKS = [
),
),
("advanced_text", AdvancedTextBlock()),
("two_columns_text", ColumnsTextBlock()),
("headline", HeadlineBlock()),
("headline_with_picture", PictureHeadlineBlock()),
(
......
Source diff could not be displayed: it is too large. Options to address this: view the blob.
{% load wagtailimages_tags %}
<li class="flex gap-2 items-center">
{% image image max-60x60 width="30" height="30" %}
<div>
{{ text }}
</div>
</li>
\ No newline at end of file
<div
class="
flex gap-4 w-full flex-col
lg:flex-row
"
>
<div
class="
w-full max-w-[unset] shrink-0 grow-1
lg:w-1/2
"
>
{% include "styleguide2/includes/atoms/text/prose_advanced_richtext.html" with text=self.left_text css_class=css_class %}
</div>
<div
class="
w-full max-w-[unset] shrink-0 grow-1
lg:w-1/2
"
>
{% include "styleguide2/includes/atoms/text/prose_advanced_richtext.html" with text=self.right_text css_class=css_class %}
</div>
</div>
\ No newline at end of file
{% load wagtailcore_tags %}
<div class="{{ css_class|join:" " }}">
{% include "styleguide2/includes/atoms/text/prose_richtext.html" with text=self.text %}
{% firstof text self.text as text %}
{% include "styleguide2/includes/atoms/text/prose_richtext.html" with text=text %}
</div>
......@@ -7,9 +7,7 @@
>
{% endif %}
{% if not text %}
{{ self }}
{% else %}
{% firstof text self as text %}
{{ text }}
{% endif %}
</div>
<div
class="
flex gap-4 w-full flex-col
lg:flex-row
"
>
<div
class="
w-full max-w-[unset] shrink-0 grow-1
lg:w-1/2
"
>
{% include "styleguide2/includes/atoms/text/prose_richtext.html" with text=self.left_text %}
</div>
<div
class="
w-full max-w-[unset] shrink-0 grow-1
lg:w-1/2
"
>
{% include "styleguide2/includes/atoms/text/prose_richtext.html" with text=self.right_text %}
</div>
</div>
\ No newline at end of file
<ul class="flex flex-col gap-2">
{% for item in self.items %}
{% include "styleguide2/includes/atoms/lists/image_list_item.html" with text=item image=self.picture %}
{% endfor %}
</ul>
\ No newline at end of file
This diff is collapsed.
# Generated by Django 5.0.6 on 2024-06-26 10:35
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('uniweb', '0070_alter_uniwebarticlepage_content'),
]
operations = [
]
......@@ -33,7 +33,11 @@ from shared.blocks import (
HeadlineBlock,
NewsletterSubscriptionBlock,
PictureHeadlineBlock,
ColumnsTextBlock,
AdvancedColumnsTextBlock,
PictureListBlock,
)
from shared.blocks import ButtonBlock as SharedButtonBlock
from shared.const import RICH_TEXT_DEFAULT_FEATURES
from shared.models import (
ArticleMixin,
......@@ -98,36 +102,6 @@ class AlignBlock(blocks.StructBlock):
return context
class ColumnsTextBlock(blocks.StructBlock):
left_text = blocks.RichTextBlock(
label="levý sloupec", features=RICH_TEXT_DEFAULT_FEATURES
)
right_text = blocks.RichTextBlock(
label="pravý sloupec", features=RICH_TEXT_DEFAULT_FEATURES
)
class Meta:
label = "text dva sloupce"
icon = "doc-full"
group = "texty"
template = "uniweb/blocks/text_columns.html"
class AdvancedColumnsTextBlock(ColorBlock, AlignBlock):
left_text = blocks.RichTextBlock(
label="levý sloupec", features=RICH_TEXT_DEFAULT_FEATURES
)
right_text = blocks.RichTextBlock(
label="pravý sloupec", features=RICH_TEXT_DEFAULT_FEATURES
)
class Meta:
label = "text dva sloupce (pokročilý)"
icon = "doc-full"
group = "texty"
template = "uniweb/blocks/advanced_text_columns.html"
class AdvancedTitleBlock(ColorBlock, AlignBlock):
title = blocks.CharBlock(label="nadpis")
......@@ -138,42 +112,24 @@ class AdvancedTitleBlock(ColorBlock, AlignBlock):
template = "uniweb/blocks/advanced_title.html"
class PictureListBlock(ColorBlock):
items = blocks.ListBlock(
blocks.RichTextBlock(label="odstavec", features=RICH_TEXT_DEFAULT_FEATURES),
label="odstavce",
)
picture = ImageChooserBlock(
label="obrázek",
# TODO rozměry v helpu
help_text="rozměr 25x25px nebo více (obrázek bude zmenšen na 25x25px)",
)
class Meta:
label = "seznam z obrázkovými odrážkami"
icon = "list-ul"
group = "texty"
template = "uniweb/blocks/picture_list.html"
class ArticlesBlock(blocks.StructBlock):
page = blocks.PageChooserBlock(
label="sekce článků", page_type=["uniweb.UniwebArticlesIndexPage"]
label="Sekce článků", page_type=["uniweb.UniwebArticlesIndexPage"]
)
lines = blocks.IntegerBlock(
label="počet řádků",
label="Počet řádků",
default=1,
help_text="zobrazí se tři články na řádek",
help_text="Zobrazí se tři články na řádek",
)
class Meta:
label = "články"
label = "Články"
icon = "folder-open-1"
group = "ostatní"
template = "uniweb/blocks/articles.html"
def get_context(self, value, parent_context=None):
context = super().get_context(value, parent_context=parent_context)
count = value["lines"] * ARTICLES_PER_LINE
articles_page = value["page"]
context["articles"] = articles_page.materialize_shared_articles_query(
......@@ -181,6 +137,7 @@ class ArticlesBlock(blocks.StructBlock):
UniwebArticlePage.objects.child_of(articles_page)
)[:count]
)
return context
......@@ -282,9 +239,11 @@ CONTENT_STREAM_BLOCKS = [
# text_columns
("text_columns", ColumnsTextBlock()),
# advanced_text_columns
("advanced_text_columns", AdvancedColumnsTextBlock()),
# gallery
("new_gallery", GalleryBlock()),
# picture_list
("picture_list", PictureListBlock()),
# aligned_table
(
"aligned_table",
......@@ -303,11 +262,20 @@ CONTENT_STREAM_BLOCKS = [
),
),
# articles
("articles", ArticlesBlock()),
# calendar_agenda
("calendar_agenda", CalendarAgendaBlock()), # Unfinished
# button
("new_button", SharedButtonBlock()),
# chart
("chart", ChartBlock()),
# cards
("cards", FlipCardsBlock(template="uniweb/blocks/flip_cards.html")), # Unfinished
# TO BE MIGRATED
("button", ButtonBlock()),
(
"title",
blocks.CharBlock(
......@@ -318,15 +286,6 @@ CONTENT_STREAM_BLOCKS = [
),
),
("advanced_title", AdvancedTitleBlock()),
# (
# "text",
# blocks.RichTextBlock(
# label="Textový editor",
# features=RICH_TEXT_DEFAULT_FEATURES,
# template="styleguide2/includes/atoms/text/prose_richtext.html",
# ),
# ),
("advanced_text_columns", AdvancedColumnsTextBlock()),
(
"gallery",
blocks.ListBlock(
......@@ -337,11 +296,6 @@ CONTENT_STREAM_BLOCKS = [
template="uniweb/blocks/gallery.html",
),
),
("picture_list", PictureListBlock()),
("articles", ArticlesBlock()),
("calendar_agenda", CalendarAgendaBlock()),
("button", ButtonBlock()),
("cards", FlipCardsBlock(template="uniweb/blocks/flip_cards.html")),
]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment