Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • to/majak
  • b1242/majak
2 results
Show changes
Commits on Source (6)
from django.db import models
from django.forms.utils import ErrorList
from wagtail import blocks
from wagtail.blocks import (
......@@ -16,10 +15,8 @@ from wagtail.blocks.struct_block import StructBlockValidationError
from wagtail.images.blocks import ImageChooserBlock
from shared.blocks import (
ButtonBlock,
CardLinkBlockMixin,
CardLinkWithHeadlineBlockMixin,
ChartBlock,
ProgramItemBlock,
)
......@@ -296,3 +293,49 @@ class RedmineProgramBlock(StructBlock):
template = "district/blocks/program_block.html"
icon = "site"
label = "Blok programu stahovaný z Redmine"
class HeroBannerBlock(StructBlock):
sm_banner = ImageChooserBlock(
label="Obrázek pro zobrazení menší než 640px", required=True
)
md_banner = ImageChooserBlock(
label="Obrázek pro zobrazení větší než 768px", required=True
)
lg_banner = ImageChooserBlock(
label="Obrázek pro zobrazení větší než 1024px", required=True
)
xl_banner = ImageChooserBlock(
label="Obrázek pro zobrazení větší než 1280px", required=True
)
xxl_banner = ImageChooserBlock(
label="Obrázek pro zobrazení větší než 1536px", required=True
)
title = CharBlock(label="Titulek bloku", required=False)
subtitle = CharBlock(label="Podtitulek", required=False)
button_text = CharBlock(label="Text tlačítka", required=False)
button_link = URLBlock(label="Odkaz tlačítka", required=False)
def clean(self, value):
errors = {}
if value["button_link"] and not value["button_text"]:
errors["button_text"] = ErrorList(
["Zadejte prosím text tlačítka, nebo smažte odkaz v tlačítku"]
)
if not value["button_link"] and value["button_text"]:
errors["button_link"] = ErrorList(
["Zadejte prosím odkaz tlačítka, nebo smažte text v tlačítku"]
)
if errors:
raise StructBlockValidationError(errors)
return super().clean(value)
class Meta:
template = "district/blocks/hero_banner_block.html"
icon = "image"
label = "Hero banner"
# Generated by Django 4.1.8 on 2023-04-24 22:33
import wagtail.blocks
import wagtail.fields
import wagtail.images.blocks
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("district", "0108_alter_districtcenterpage_content_and_more"),
]
operations = [
migrations.AlterField(
model_name="districthomepage",
name="subheader",
field=wagtail.fields.StreamField(
[
(
"header_full_size",
wagtail.blocks.StructBlock(
[
(
"title",
wagtail.blocks.CharBlock(
label="Titulek", required=True
),
),
(
"image_background",
wagtail.images.blocks.ImageChooserBlock(
label="Obrázek v pozadí", required=True
),
),
(
"image_foreground",
wagtail.images.blocks.ImageChooserBlock(
label="Obrázek v popředí", required=False
),
),
(
"button_group",
wagtail.blocks.ListBlock(
wagtail.blocks.StructBlock(
[
(
"title",
wagtail.blocks.CharBlock(
label="Titulek",
max_length=128,
required=True,
),
),
(
"icon",
wagtail.blocks.CharBlock(
help_text="Identifikátor ikonky ze styleguide (https://styleguide.pirati.cz/latest/?p=viewall-atoms-icons), např. ico--key.",
label="Ikonka",
max_length=128,
required=False,
),
),
(
"size",
wagtail.blocks.ChoiceBlock(
choices=[
("sm", "Malá"),
("base", "Střední"),
("lg", "Velká"),
],
label="Velikost",
),
),
(
"color",
wagtail.blocks.ChoiceBlock(
choices=[
("black", "Černá"),
("white", "Bílá"),
("grey-125", "Světle šedá"),
("blue-300", "Modrá"),
("cyan-200", "Tyrkysová"),
("green-400", "Zelené"),
("violet-400", "Vínová"),
("red-600", "Červená"),
],
label="Barva",
),
),
(
"hoveractive",
wagtail.blocks.BooleanBlock(
default=True,
help_text="Pokud je zapnuto, tlačítko mění barvu, když na něj uživatel najede myší.",
label="Animovat na hover",
required=False,
),
),
(
"mobile_fullwidth",
wagtail.blocks.BooleanBlock(
default=True,
help_text="Pokud je zapnuto, tlačítko se na mobilních zařízeních roztáhne na plnou šířku.",
label="Plná šířka na mobilních zařízeních",
required=False,
),
),
(
"page",
wagtail.blocks.PageChooserBlock(
label="Stránka", required=False
),
),
(
"link",
wagtail.blocks.URLBlock(
label="Odkaz", required=False
),
),
(
"align",
wagtail.blocks.ChoiceBlock(
choices=[
("auto", "Automaticky"),
("center", "Na střed"),
],
label="Zarovnání",
),
),
]
),
label="Tlačítka",
),
),
]
),
),
(
"header_simple",
wagtail.blocks.StructBlock(
[
(
"title",
wagtail.blocks.CharBlock(
label="Titulek", required=False
),
),
(
"subtitle",
wagtail.blocks.CharBlock(
label="Podtitulek", required=False
),
),
("image", wagtail.images.blocks.ImageChooserBlock()),
]
),
),
(
"header",
wagtail.blocks.StructBlock(
[
(
"title",
wagtail.blocks.CharBlock(
help_text="Nap", label="Titulek", required=False
),
),
("image", wagtail.images.blocks.ImageChooserBlock()),
(
"button_text",
wagtail.blocks.CharBlock(
label="Text tlačítka", required=False
),
),
(
"button_link",
wagtail.blocks.URLBlock(
label="Odkaz tlačítka", required=False
),
),
]
),
),
(
"hero_banner",
wagtail.blocks.StructBlock(
[
(
"sm_banner",
wagtail.images.blocks.ImageChooserBlock(
label="Obrázek pro zobrazení menší než 640px",
required=True,
),
),
(
"md_banner",
wagtail.images.blocks.ImageChooserBlock(
label="Obrázek pro zobrazení větší než 768px",
required=True,
),
),
(
"lg_banner",
wagtail.images.blocks.ImageChooserBlock(
label="Obrázek pro zobrazení větší než 1024px",
required=True,
),
),
(
"xl_banner",
wagtail.images.blocks.ImageChooserBlock(
label="Obrázek pro zobrazení větší než 1280px",
required=True,
),
),
(
"xxl_banner",
wagtail.images.blocks.ImageChooserBlock(
label="Obrázek pro zobrazení větší než 1536px",
required=True,
),
),
(
"title",
wagtail.blocks.CharBlock(
label="Titulek bloku", required=False
),
),
(
"subtitle",
wagtail.blocks.CharBlock(
label="Podtitulek", required=False
),
),
(
"button_text",
wagtail.blocks.CharBlock(
label="Text tlačítka", required=False
),
),
(
"button_link",
wagtail.blocks.URLBlock(
label="Odkaz tlačítka", required=False
),
),
]
),
),
],
blank=True,
use_json_field=True,
verbose_name="Blok pod headerem",
),
),
]
......@@ -59,7 +59,7 @@ from . import blocks
from .forms import JekyllImportForm
CONTENT_BLOCKS = DEFAULT_CONTENT_BLOCKS + [
("chart", ChartBlock(template="district/blocks/chart.html")),
("chart", ChartBlock(template="district/blocks/chart.html"))
]
......@@ -73,6 +73,7 @@ class DistrictHomePage(
("header_full_size", FullSizeHeaderBlock()),
("header_simple", blocks.HomepageSimpleHeaderBlock()),
("header", blocks.HomepageHeaderBlock()),
("hero_banner", blocks.HeroBannerBlock()),
],
verbose_name="Blok pod headerem",
blank=True,
......@@ -411,6 +412,10 @@ class DistrictArticlePage(
)
return context
@property
def articles_page(self):
return self.get_parent()
class DistrictArticlesPage(
RoutablePageMixin, ExtendedMetadataPageMixin, SubpageMixin, MetadataPageMixin, Page
......@@ -1071,7 +1076,11 @@ class DistrictElectionRootPage(RoutablePageMixin, Page):
### RELATIONS
parent_page_types = ["district.DistrictHomePage"]
parent_page_types = [
"district.DistrictHomePage",
"district.DistrictCustomPage",
"district.DistrictCrossroadPage",
]
subpage_types = [
"district.DistrictElectionCampaignPage",
"district.DistrictGeoFeatureCollectionPage",
......@@ -1383,7 +1392,7 @@ class DistrictCustomPage(
### RELATIONS
parent_page_types = ["district.DistrictHomePage", "district.DistrictCrossroadPage"]
subpage_types = []
subpage_types = ["district.DistrictElectionRootPage"]
### OTHERS
......
{% load wagtailimages_tags %}
<div class="relative hero hero--image p-0 text-center md:text-left">
<picture aria-hidden="true">
{% image self.xxl_banner min-1280x1 as xxl_image %}
{% image self.xl_banner max-1280x2000 as xl_image %}
{% image self.lg_banner max-1024x2000 as lg_image %}
{% image self.md_banner max-768x2000 as md_image %}
{% image self.sm_banner max-640x2000 as sm_image %}
<source media="(min-width:1536px)" srcset="{{ xxl_image.full_url }}">
<source media="(min-width:1280px)" srcset="{{ xl_image.full_url }}">
<source media="(min-width:1024px)" srcset="{{ lg_image.full_url }}">
<source media="(min-width:768px)" srcset="{{ md_image.full_url }}">
<img src="{{ sm_image.full_url }}" width="auto" class="w-full">
</picture>
<div class="absolute h-full w-full md:w-1/2" style="bottom: 0">{# TODO: Update style guide #}
<div class="flex h-full items-end md:items-center justify-center text-center lg:text-left">
<div class="mx-2 mb-10">
<h1 class="head-alt-lg md:head-alt-xl text-shadow-lg max-w-2xl mx-auto lg:mx-0">
{% firstof self.title page.title %}
</h1>
{% if self.subtitle %}
<h2 class="head-xs mt-2 text-shadow-lg">
{{ self.subtitle }}
</h2>
{% endif %}
{% if self.button_link and self.button_text %}
<div class="mt-4 md:mt-8 space-y-4">
<div class="w-100">
<a href="{{ self.button_link }}" class="btn btn--white btn--hoveractive text-base btn--fullwidth md:btn--autowidth">
<div class="btn__body ">{{ self.button_text }}</div>
</a>
</div>
</div>
{% endif %}
</div>
</div>
</div>
</div>
......@@ -63,7 +63,8 @@
{% endif %}
<div class="max-w-xs">
<span class="text-xs text-grey-350 ">
<span class="-scale-x-100 inline-block">©</span> Piráti, 2022. Všechna práva vyhlazena. Sdílejte a nechte ostatní sdílet za stejných podmínek.<br><br>
<span class="-scale-x-100 inline-block">©</span> Piráti, {% now 'Y' %}.
Všechna práva vyhlazena. Sdílejte a nechte ostatní sdílet za stejných podmínek.<br><br>
<a href="{{ page.root_page.gdpr_and_cookies_url }}">Zásady ochrany osobních údajů</a>
</span>
</div>
......
......@@ -19,8 +19,14 @@
</div>
<div class="col-span-8 grid grid-cols-3 col-gap-4 calendar-table-row__col calendar-table-row__col--norborder">
<div class="col-span-3 md:col-span-1">
<strong class="block">{{ event.start|date:"l j. E"|capfirst }}</strong>
<p class="font-light text-sm mt-1">{{ event.duration }}</p></div>
<strong class="block">
<time datetime="{{ event.start|date:"Y-m-d H:m"|capfirst }}">
{{ event.start|date:"l j. E"|capfirst }}
</time>
</strong>
<p class="font-light text-sm mt-1" aria-hidden="true">{{ event.start|date:"G:i" }}</p>
<p class="font-light text-sm mt-1">{{ event.duration }}</p>
</div>
<div class="col-span-3 md:col-span-2 mt-4 md:mt-0 overflow-hidden">
<span class="font-bold block">
{{ event.summary }}
......
<nav class="text-center mb-3">
<a href="{{ page.root_page.articles_page.url }}" class="btn btn--icon text-xl pt-8" rel="next" >
<a href="{{ page.articles_page.url }}" class="btn btn--icon text-xl pt-8" rel="next" >
<div class="btn__body-wrap">
<div class="btn__body ">Další články</div>
<div class="btn__icon ">
......