Skip to content
Snippets Groups Projects
Commit 6092cb8a authored by Daniel Kriz's avatar Daniel Kriz
Browse files

Merge remote-tracking branch 'origin/feature/pirati-cz' into feature/pirati-cz-dan

parents 161dfd55 ee20cfba
Branches
No related tags found
3 merge requests!607Pirati.cz,!585[FIX]Footer/twitter section/ contact,!575Feature/pirati cz
# Generated by Django 4.0.7 on 2022-08-23 10:07
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("main", "0006_mainpersonpage_after_name_mainpersonpage_before_name_and_more"),
]
operations = [
migrations.AddField(
model_name="mainarticlepage",
name="region",
field=models.IntegerField(
blank=True,
choices=[
("PHA", "Hlavní město Praha"),
("JHC", "Jihočeský kraj"),
("JHM", "Jihomoravský kraj"),
("KVK", "Karlovarský kraj"),
("VYS", "Kraj Vysočina"),
("KHK", "Královéhradecký kraj"),
("LBK", "Liberecký kraj"),
("MSK", "Moravskoslezský kraj"),
("OLK", "Olomoucký kraj"),
("PAK", "Pardubický kraj"),
("PLK", "Plzeňský kraj"),
("STC", "Středočeský kraj"),
("ULK", "Ústecký kraj"),
("ZLK", "Zlínský kraj"),
],
help_text="Kraj, ke kterému se článek vztahuje",
null=True,
verbose_name="Kraj",
),
),
migrations.AlterField(
model_name="mainarticlepage",
name="author_page",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="main.mainpersonpage",
verbose_name="Stránka autora (osoby)",
),
),
]
from datetime import timedelta
from functools import cached_property from functools import cached_property
from django.conf import settings from django.conf import settings
...@@ -5,6 +6,7 @@ from django.core.paginator import Paginator ...@@ -5,6 +6,7 @@ from django.core.paginator import Paginator
from django.db import models from django.db import models
from django.http import HttpResponseRedirect from django.http import HttpResponseRedirect
from django.shortcuts import render from django.shortcuts import render
from django.utils import timezone
from modelcluster.contrib.taggit import ClusterTaggableManager from modelcluster.contrib.taggit import ClusterTaggableManager
from modelcluster.fields import ParentalKey from modelcluster.fields import ParentalKey
from taggit.models import TaggedItemBase from taggit.models import TaggedItemBase
...@@ -15,6 +17,7 @@ from wagtail.core.fields import RichTextField, StreamField ...@@ -15,6 +17,7 @@ from wagtail.core.fields import RichTextField, StreamField
from wagtail.core.models import Page from wagtail.core.models import Page
from wagtailmetadata.models import MetadataPageMixin from wagtailmetadata.models import MetadataPageMixin
from elections2021.constants import REGION_CHOICES # pozor, import ze sousedního modulu
from shared.const import RICH_TEXT_DEFAULT_FEATURES from shared.const import RICH_TEXT_DEFAULT_FEATURES
from shared.forms import SubscribeForm from shared.forms import SubscribeForm
from shared.models import ( from shared.models import (
...@@ -26,9 +29,9 @@ from shared.models import ( ...@@ -26,9 +29,9 @@ from shared.models import (
) )
from shared.utils import make_promote_panels, subscribe_to_newsletter from shared.utils import make_promote_panels, subscribe_to_newsletter
from tuning import admin_help from tuning import admin_help
from twitter_utils.models import Tweet
from . import blocks from . import blocks
from twitter_utils.models import Tweet
class MainHomePage(MenuMixin, ExtendedMetadataHomePageMixin, MetadataPageMixin, Page): class MainHomePage(MenuMixin, ExtendedMetadataHomePageMixin, MetadataPageMixin, Page):
...@@ -171,8 +174,15 @@ class MainHomePage(MenuMixin, ExtendedMetadataHomePageMixin, MetadataPageMixin, ...@@ -171,8 +174,15 @@ class MainHomePage(MenuMixin, ExtendedMetadataHomePageMixin, MetadataPageMixin,
class MainWorkPage(ExtendedMetadataPageMixin, SubpageMixin, MetadataPageMixin, Page): class MainWorkPage(ExtendedMetadataPageMixin, SubpageMixin, MetadataPageMixin, Page):
perex = models.TextField() perex = models.TextField()
timeline = StreamField( timeline = StreamField( # TODO delete
[("article_list", PageChooserBlock(page_type="main.MainArticlePage", label="Vybrat aktualitu"))], [
(
"article_list",
PageChooserBlock(
page_type="main.MainArticlePage", label="Vybrat aktualitu"
),
)
],
verbose_name="Timeline", verbose_name="Timeline",
blank=True, blank=True,
) )
...@@ -183,16 +193,21 @@ class MainWorkPage(ExtendedMetadataPageMixin, SubpageMixin, MetadataPageMixin, P ...@@ -183,16 +193,21 @@ class MainWorkPage(ExtendedMetadataPageMixin, SubpageMixin, MetadataPageMixin, P
subpage_types = [] subpage_types = []
### PANELS ### PANELS
content_panels = Page.content_panels + [ content_panels = Page.content_panels + [FieldPanel("perex"), FieldPanel("timeline")]
FieldPanel('perex'),
FieldPanel('timeline')
]
### OTHERS ### OTHERS
class Meta: class Meta:
verbose_name = "Piráti pracují" verbose_name = "Piráti pracují"
def get_context(self, request, *args, **kwargs):
ctx = super().get_context(request, args, kwargs)
last_month = timezone.now().today().replace(day=1) - timedelta(days=1)
first_day_of_last_month = last_month.replace(day=1)
article_qs = MainArticlePage.objects.filter(date__gt=first_day_of_last_month)
# article_data_list =
return ctx
class MainArticleTag(TaggedItemBase): class MainArticleTag(TaggedItemBase):
content_object = ParentalKey("main.MainArticlePage", on_delete=models.CASCADE) content_object = ParentalKey("main.MainArticlePage", on_delete=models.CASCADE)
...@@ -205,7 +220,18 @@ class MainArticlePage( ...@@ -205,7 +220,18 @@ class MainArticlePage(
### FIELDS ### FIELDS
author_page = models.ForeignKey( author_page = models.ForeignKey(
"main.MainPersonPage", on_delete=models.SET_NULL, null=True, blank=True "main.MainPersonPage",
on_delete=models.SET_NULL,
null=True,
blank=True,
verbose_name="Stránka autora (osoby)",
)
region = models.IntegerField(
choices=REGION_CHOICES,
null=True,
blank=True,
verbose_name="Kraj",
help_text="Kraj, ke kterému se článek vztahuje",
) )
tags = ClusterTaggableManager(through=MainArticleTag, blank=True) tags = ClusterTaggableManager(through=MainArticleTag, blank=True)
...@@ -213,6 +239,7 @@ class MainArticlePage( ...@@ -213,6 +239,7 @@ class MainArticlePage(
content_panels = ArticleMixin.content_panels + [ content_panels = ArticleMixin.content_panels + [
FieldPanel("author_page"), FieldPanel("author_page"),
FieldPanel("region"),
FieldPanel("tags"), FieldPanel("tags"),
] ]
...@@ -335,13 +362,24 @@ class MainPeoplePage(ExtendedMetadataPageMixin, SubpageMixin, MetadataPageMixin, ...@@ -335,13 +362,24 @@ class MainPeoplePage(ExtendedMetadataPageMixin, SubpageMixin, MetadataPageMixin,
class MainPersonPage(ExtendedMetadataPageMixin, SubpageMixin, MetadataPageMixin, Page): class MainPersonPage(ExtendedMetadataPageMixin, SubpageMixin, MetadataPageMixin, Page):
### FIELDS ### FIELDS
before_name = models.CharField("Tituly před jménem", max_length=16, blank=True, null=True) before_name = models.CharField(
after_name = models.CharField("Tituly za jménem", max_length=16, blank=True, null=True) "Tituly před jménem", max_length=16, blank=True, null=True
position = models.CharField("Pozice/povolání", max_length=128, blank=True, null=True) )
after_name = models.CharField(
"Tituly za jménem", max_length=16, blank=True, null=True
)
position = models.CharField(
"Pozice/povolání", max_length=128, blank=True, null=True
)
perex = models.TextField() perex = models.TextField()
text = RichTextField() text = RichTextField()
twitter_username = models.CharField("Uživatelské jméno twitter pro získání příspěvků", blank=True, null=True, max_length=32) twitter_username = models.CharField(
"Uživatelské jméno twitter pro získání příspěvků",
blank=True,
null=True,
max_length=32,
)
email = models.CharField("E-mail", max_length=128, blank=True, null=True) email = models.CharField("E-mail", max_length=128, blank=True, null=True)
phone = models.CharField("Telefonní kontakt", max_length=16, blank=True, null=True) phone = models.CharField("Telefonní kontakt", max_length=16, blank=True, null=True)
...@@ -359,23 +397,27 @@ class MainPersonPage(ExtendedMetadataPageMixin, SubpageMixin, MetadataPageMixin, ...@@ -359,23 +397,27 @@ class MainPersonPage(ExtendedMetadataPageMixin, SubpageMixin, MetadataPageMixin,
### PANELS ### PANELS
content_panels = Page.content_panels + [ content_panels = Page.content_panels + [
FieldPanel('before_name'), FieldPanel("before_name"),
FieldPanel('after_name'), FieldPanel("after_name"),
FieldPanel('position'), FieldPanel("position"),
FieldPanel('perex'), FieldPanel("perex"),
FieldPanel('twitter_username'), FieldPanel("twitter_username"),
FieldPanel('text'), FieldPanel("text"),
FieldPanel('email'), FieldPanel("email"),
FieldPanel('phone'), FieldPanel("phone"),
FieldPanel('facebook'), FieldPanel("facebook"),
FieldPanel('twitter'), FieldPanel("twitter"),
FieldPanel('instagram'), FieldPanel("instagram"),
] ]
def get_context(self, request): def get_context(self, request):
context = super(MainPersonPage, self).get_context(request) context = super(MainPersonPage, self).get_context(request)
context['article_page_list'] = MainArticlePage.objects.filter(author_page=self.id) context["article_page_list"] = MainArticlePage.objects.filter(
context['tweet_list'] = Tweet.objects.filter(author_username=self.twitter_username) author_page=self.id
)
context["tweet_list"] = Tweet.objects.filter(
author_username=self.twitter_username
)
return context return context
### OTHERS ### OTHERS
......
...@@ -3,52 +3,64 @@ ...@@ -3,52 +3,64 @@
{{> molecules-simple_header(title: "Jak piráti pracují") }} {{> molecules-simple_header(title: "Jak piráti pracují") }}
<main role="main"> <main role="main">
<div class="grid-container mx-auto mb-12"> <div class="grid-container mb-2 xl:mb-12">
<div class="col-start-1 col-end-2 left-tab"> <div class="grid-left-side">
{{> molecules-sidebar-menu }} {{> molecules-sidebar-menu }}
</div> </div>
<div class="col-start-2 col-end-4 leading-6"> <div class="grid-content leading-6">
<h2 class="head-xl mb-6"> <h2 class="head-xl mb-2">
Piráti pracují pro občany ČR na všech úrovních. V zastupitelstev obcí působí 400 zastupitelů, dalších 100 v krajích. Piráti pracují pro občany ČR na všech úrovních. V zastupitelstev obcí působí 400 zastupitelů, dalších 100 v krajích.
Piráti prosazují svůj program i na celostátní úrovni prostřednictvím 4 poslanců, 3 senátorů, 3 ministrů a v EU díky 3 europoslancům. Piráti prosazují svůj program i na celostátní úrovni prostřednictvím 4 poslanců, 3 senátorů, 3 ministrů a v EU díky 3 europoslancům.
</h2> </h2>
<h2 class="head-xl"> <h2 class="head-xl mb-2">
Projděte si archiv tiskových zpráv a souhrn našich nejvýraznějších aktivit Projděte si archiv tiskových zpráv a souhrn našich nejvýraznějších aktivit
</h2> </h2>
</div> </div>
</div> </div>
<div class="grid-container mx-auto mb-4"> <div class="grid-container article-section">
<div class="col-start-1 col-end-4 flex justify-between"> <div class="grid-full mb-8">
<div class="pt-8"> <div class="mb-4">
<h3 class="head-7xl mb-4 xl:hidden">Červenec</h3>
<div class="flex flex-col justify-between xl:flex-row">
<div class="xl:pt-8">
{{> molecules-work-article-preview }} {{> molecules-work-article-preview }}
{{> molecules-work-article-preview }} {{> molecules-work-article-preview }}
</div> </div>
<div class="relative border border-violet-400 mx-8"> <div class="relative border border-violet-400 mx-8 hidden xl:block">
<div class="absolute bg-violet-400 p-1 text-white font-bold" style="transform: translateX(-50%); top: -1rem">Červenec</div> <div class="absolute bg-violet-400 p-1 text-white font-bold" style="transform: translateX(-50%); top: -1rem">
Červenec
</div> </div>
<div class="pt-14"> </div>
<div class="xl:pt-14">
{{> molecules-work-article-preview }} {{> molecules-work-article-preview }}
{{> molecules-work-article-preview }} {{> molecules-work-article-preview }}
</div> </div>
</div> </div>
<div class="col-start-1 col-end-4 flex justify-between"> </div>
<div class="pt-8"> <div class="mb-4">
<h3 class="head-7xl mb-4 xl:hidden">Srpen</h3>
<div class="flex flex-col justify-between xl:flex-row">
<div class="xl:pt-8">
{{> molecules-work-article-preview }}
{{> molecules-work-article-preview }} {{> molecules-work-article-preview }}
</div> </div>
<div class="relative border border-violet-400 mx-8 pt-8"> <div class="relative border border-violet-400 mx-8 hidden xl:block">
<div class="absolute bg-violet-400 p-1 text-white font-bold" style="transform: translateX(-50%); top: -1rem">Srpen</div> <div class="absolute bg-violet-400 p-1 text-white font-bold" style="transform: translateX(-50%); top: -1rem">
Srpen
</div> </div>
<div class="pt-14"> </div>
<div class="xl:pt-14">
{{> molecules-work-article-preview }}
{{> molecules-work-article-preview }} {{> molecules-work-article-preview }}
</div> </div>
</div> </div>
</div> </div>
<div class="container">
<div class="flex justify-center"> <div class="flex justify-center">
{{> atoms-button-animated(btn-text: "Zobrazit další", classes-btn-hidden: "bg-black") }} {{> atoms-button-animated(btn-text: "Zobrazit další", classes-btn-hidden: "bg-black") }}
</div> </div>
</div> </div>
</div>
</main> </main>
{{> organisms-newsletter-section }} {{> organisms-newsletter-section }}
......
...@@ -46,6 +46,10 @@ ...@@ -46,6 +46,10 @@
"right-side"; "right-side";
gap: 1rem; gap: 1rem;
max-width: 1150px; max-width: 1150px;
&.article-section {
max-width: 1400px;
}
} }
@responsive { @responsive {
.grid-container { .grid-container {
...@@ -77,8 +81,7 @@ ...@@ -77,8 +81,7 @@
} }
.grid-content-with-right-side { .grid-content-with-right-side {
grid-column-start: content; grid-column: content / right-side;
grid-column-end: right-side;
} }
@responsive { @responsive {
......
...@@ -159,15 +159,15 @@ ...@@ -159,15 +159,15 @@
} }
.head-4xl { .head-4xl {
@apply font-alt text-xl font-medium leading-7 tracking-tight uppercase mb-5 lg:text-4xl lg:leading-10 lg:text-4xl; @apply font-alt text-xl font-medium leading-7 tracking-tight uppercase mb-5 lg:text-4xl lg:leading-10 xl:text-4xl;
} }
.head-7xl { .head-7xl {
@apply font-alt text-3xl font-medium tracking-tight uppercase lg:text-7xl; @apply font-alt text-3xl font-medium tracking-tight uppercase xl:text-7xl;
} }
.head-8xl { .head-8xl {
@apply font-alt text-4xl font-medium tracking-tight uppercase lg:text-8xl; @apply font-alt text-4xl font-medium tracking-tight uppercase xl:text-8xl;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment