Skip to content
Snippets Groups Projects
Commit 33f1071a authored by Dan Nepejchal's avatar Dan Nepejchal Committed by nepoveda
Browse files

Fix:

- update news block
- code style
- add text 1 cloumn block
parent 860b0a82
No related branches found
No related tags found
2 merge requests!155Sync test,!154Fix green deal
Pipeline #1734 passed
# Generated by Django 3.1.1 on 2020-12-08 13:35
import datetime
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.images.blocks
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
("green_deal", "0001_initial"),
]
operations = [
migrations.AlterModelOptions(
name="greendealsubpage",
options={"verbose_name": "Zelená dohoda pro regiony"},
),
migrations.AddField(
model_name="greendealsubpage",
name="matomo_id",
field=models.IntegerField(
blank=True,
null=True,
verbose_name="Matomo ID pro sledování návštěvnosti",
),
),
migrations.AddField(
model_name="greendealsubpage",
name="top_menu",
field=wagtail.core.fields.StreamField(
[
(
"item",
wagtail.core.blocks.StructBlock(
[
("name", wagtail.core.blocks.CharBlock(label="název")),
(
"page",
wagtail.core.blocks.PageChooserBlock(
label="stránka",
page_type=[
"green_deal.GreenDealHomePage",
"green_deal.GreenDealSubPage",
],
),
),
]
),
)
],
blank=True,
verbose_name="horní menu",
),
),
migrations.AlterField(
model_name="greendealhomepage",
name="content",
field=wagtail.core.fields.StreamField(
[
(
"text_2_columns",
wagtail.core.blocks.StructBlock(
[
(
"left_text",
wagtail.core.blocks.RichTextBlock(
features=[
"h2",
"h3",
"h4",
"h5",
"bold",
"italic",
"ol",
"ul",
"hr",
"link",
"document-link",
"image",
],
label="levý sloupec",
),
),
(
"right_text",
wagtail.core.blocks.RichTextBlock(
features=[
"h2",
"h3",
"h4",
"h5",
"bold",
"italic",
"ol",
"ul",
"hr",
"link",
"document-link",
"image",
],
label="pravý sloupec",
),
),
]
),
),
(
"text_1_column",
wagtail.core.blocks.StructBlock(
[
("header", wagtail.core.blocks.CharBlock()),
(
"text",
wagtail.core.blocks.RichTextBlock(
features=[
"h2",
"h3",
"h4",
"h5",
"bold",
"italic",
"ol",
"ul",
"hr",
"link",
"document-link",
"image",
]
),
),
]
),
),
(
"FAQ_columns",
wagtail.core.blocks.StructBlock(
[
(
"left_text",
wagtail.core.blocks.RichTextBlock(
features=[
"h2",
"h3",
"h4",
"h5",
"bold",
"italic",
"ol",
"ul",
"hr",
"link",
"document-link",
"image",
],
label="levý sloupec",
),
),
(
"faqs",
wagtail.core.blocks.ListBlock(
wagtail.core.blocks.StructBlock(
[
(
"question",
wagtail.core.blocks.TextBlock(),
),
(
"answer",
wagtail.core.blocks.RichTextBlock(),
),
]
),
label="faq",
),
),
]
),
),
(
"news",
wagtail.core.blocks.ListBlock(
wagtail.core.blocks.StructBlock(
[
("header", wagtail.core.blocks.CharBlock()),
(
"perex",
wagtail.core.blocks.RichTextBlock(
features=[
"h2",
"h3",
"h4",
"h5",
"bold",
"italic",
"ol",
"ul",
"hr",
"link",
"document-link",
"image",
]
),
),
("img", wagtail.images.blocks.ImageChooserBlock()),
("link", wagtail.core.blocks.URLBlock()),
(
"date",
wagtail.core.blocks.DateBlock(
default=datetime.datetime(
2020,
12,
8,
13,
35,
3,
209883,
tzinfo=utc,
)
),
),
]
),
label="aktuality",
),
),
],
blank=True,
verbose_name="obsah stránky",
),
),
migrations.AlterField(
model_name="greendealsubpage",
name="content",
field=wagtail.core.fields.StreamField(
[
(
"text_2_columns",
wagtail.core.blocks.StructBlock(
[
(
"left_text",
wagtail.core.blocks.RichTextBlock(
features=[
"h2",
"h3",
"h4",
"h5",
"bold",
"italic",
"ol",
"ul",
"hr",
"link",
"document-link",
"image",
],
label="levý sloupec",
),
),
(
"right_text",
wagtail.core.blocks.RichTextBlock(
features=[
"h2",
"h3",
"h4",
"h5",
"bold",
"italic",
"ol",
"ul",
"hr",
"link",
"document-link",
"image",
],
label="pravý sloupec",
),
),
]
),
),
(
"text_1_column",
wagtail.core.blocks.StructBlock(
[
("header", wagtail.core.blocks.CharBlock()),
(
"text",
wagtail.core.blocks.RichTextBlock(
features=[
"h2",
"h3",
"h4",
"h5",
"bold",
"italic",
"ol",
"ul",
"hr",
"link",
"document-link",
"image",
]
),
),
]
),
),
(
"FAQ_columns",
wagtail.core.blocks.StructBlock(
[
(
"left_text",
wagtail.core.blocks.RichTextBlock(
features=[
"h2",
"h3",
"h4",
"h5",
"bold",
"italic",
"ol",
"ul",
"hr",
"link",
"document-link",
"image",
],
label="levý sloupec",
),
),
(
"faqs",
wagtail.core.blocks.ListBlock(
wagtail.core.blocks.StructBlock(
[
(
"question",
wagtail.core.blocks.TextBlock(),
),
(
"answer",
wagtail.core.blocks.RichTextBlock(),
),
]
),
label="faq",
),
),
]
),
),
(
"news",
wagtail.core.blocks.ListBlock(
wagtail.core.blocks.StructBlock(
[
("header", wagtail.core.blocks.CharBlock()),
(
"perex",
wagtail.core.blocks.RichTextBlock(
features=[
"h2",
"h3",
"h4",
"h5",
"bold",
"italic",
"ol",
"ul",
"hr",
"link",
"document-link",
"image",
]
),
),
("img", wagtail.images.blocks.ImageChooserBlock()),
("link", wagtail.core.blocks.URLBlock()),
(
"date",
wagtail.core.blocks.DateBlock(
default=datetime.datetime(
2020,
12,
8,
13,
35,
3,
209883,
tzinfo=utc,
)
),
),
]
),
label="aktuality",
),
),
],
blank=True,
verbose_name="obsah stránky",
),
),
]
from django.db import models
from django.utils import timezone
from django.utils.translation import gettext_lazy
from wagtail.admin.edit_handlers import (
FieldPanel,
......@@ -9,6 +10,7 @@ from wagtail.admin.edit_handlers import (
from wagtail.core import blocks
from wagtail.core.fields import StreamField
from wagtail.core.models import Page
from wagtail.images.blocks import ImageChooserBlock
from wagtail.images.edit_handlers import ImageChooserPanel
from wagtailmetadata.models import MetadataPageMixin
......@@ -63,15 +65,28 @@ class ColumnsFaqBlock(blocks.StructBlock):
class NewsBlock(blocks.StructBlock):
header = blocks.CharBlock()
perex = blocks.RichTextBlock(features=RICH_TEXT_FEATURES)
img = ImageChooserBlock()
link = blocks.URLBlock()
date = blocks.DateBlock(default=timezone.now())
class StudiesBlock(blocks.StructBlock):
header = blocks.CharBlock()
text = blocks.RichTextBlock(features=RICH_TEXT_FEATURES)
class Meta:
label = "Text 1 sloupec"
icon = "doc-full"
class GreenDealHomePage(MetadataPageMixin, Page):
### FIELDS
content = StreamField(
[
("text_2_columns", ColumnsTextBlock()),
("text_1_column", StudiesBlock()),
("FAQ_columns", ColumnsFaqBlock()),
("news", blocks.ListBlock(NewsBlock(), label="aktuality")),
],
......@@ -132,12 +147,22 @@ class GreenDealSubPage(Page, MetadataPageMixin):
content = StreamField(
[
("text_2_columns", ColumnsTextBlock()),
("text_1_column", StudiesBlock()),
("FAQ_columns", ColumnsFaqBlock()),
("news", blocks.ListBlock(NewsBlock(), label="aktuality")),
],
verbose_name="obsah stránky",
blank=True,
)
# settings
matomo_id = models.IntegerField(
"Matomo ID pro sledování návštěvnosti", blank=True, null=True
)
top_menu = StreamField(
[("item", MenuItemBlock())],
verbose_name="horní menu",
blank=True,
)
### PANELS
......@@ -148,35 +173,31 @@ class GreenDealSubPage(Page, MetadataPageMixin):
promote_panels = [
MultiFieldPanel(
[
FieldPanel("slug"),
FieldPanel("seo_title"),
FieldPanel("search_description"),
ImageChooserPanel("search_image"),
HelpPanel(help.build(help.NO_SEO_TITLE, help.NO_SEARCH_IMAGE)),
HelpPanel(help.build(help.IMPORTANT_TITLE)),
],
gettext_lazy("Common page configuration"),
),
]
settings_panels = []
settings_panels = [
FieldPanel("matomo_id"),
StreamFieldPanel("top_menu"),
]
### RELATIONS
parent_page_types = ["green_deal.GreenDealHomePage"]
subpage_types = []
subpage_types = [
"green_deal.GreenDealSubPage",
]
### OTHERS
class Meta:
verbose_name = "Podstránka"
verbose_name = "Zelená dohoda pro regiony"
@property
def root_page(self):
if not hasattr(self, "_root_page"):
self._root_page = (
self.get_ancestors().type(GreenDealHomePage).specific().last()
)
return self._root_page
def get_meta_image(self):
return self.search_image or self.root_page.get_meta_image()
return self
......@@ -496,6 +496,7 @@ a.home img {
.content > .inner > .text {
font-size: 110%;
line-height: 1.5em;
text-align: justify;
margin: auto;
}
.content h2 {
......@@ -505,6 +506,7 @@ a.home img {
}
.content .inner p {
padding-bottom: 20px;
text-align: justify;
}
.content .inner ul li p {
padding-bottom: 0;
......@@ -1754,10 +1756,25 @@ h3.white {
/* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, #f6f6f6 1%, #ffffff 100%);
/* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr="#f6f6f6", endColorstr="#ffffff",GradientType=0 );
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#f6f6f6", endColorstr="#ffffff", GradientType=0);
/* IE6-9 */
}
.akt {
width: 100%;
display: flex;
}
.akt .imagebox {
width: 30%;
float: left;
margin-right: 1em;
}
.akt .text {
width: 70%;
text-align: justify;
float: right;
}
.fxbottom {
position: absolute;
bottom: -35px;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{% load wagtailimages_tags %}
{% load static %}
{% load wagtailcore_tags %}
......@@ -15,6 +16,14 @@
<hr class="cleaner">
{% endif %}
{% if block.block_type == "text_1_column" %}
<div class="text">
<h2>{{ block.value.header }}</h2>
{{ block.value.text|richtext }}
</div>
<hr class="cleaner">
{% endif %}
{% if block.block_type == "FAQ_columns" %}
<div class="text">
<div class="harmonogram">
......@@ -40,9 +49,16 @@
{% if block.block_type == "news" %}
{% for new in block.value %}
<div class="akt">
<div class="inner">
{% image new.img width-800 as image_web %}
<div class="imagebox">
<a href="{{ new.link }}"><img class="thumbnail blog-posting__media" src="{{ image_web.url }}"
alt="{{ new.header }}"></a>
</div>
<div class="text">
<h3>{{ new.header }}</h3>
{{ new.text|richtext }}
<span>{{ new.date|date:"Y-m-m" }}</span>
{{ new.perex|richtext }}
<span><a href="{{ new.link }}">číst dále</a></span>
</div>
</div>
{% endfor %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment