Skip to content
Snippets Groups Projects
Commit 01c6ba8f authored by OndraRehounek's avatar OndraRehounek
Browse files

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

parents f8b0b5ae 4dd5ab22
Branches
No related tags found
2 merge requests!607Pirati.cz,!575Feature/pirati cz
Pipeline #9570 passed
Showing
with 184 additions and 137 deletions
......@@ -3,4 +3,4 @@
line_length = 88
multi_line_output = 3
include_trailing_comma = true
known_third_party = PyPDF2,arrow,bleach,bs4,captcha,celery,django,environ,faker,fastjsonschema,icalevnt,markdown,modelcluster,pirates,pytest,pytz,requests,sentry_sdk,taggit,tweepy,wagtail,wagtailmetadata,weasyprint,yaml,zoneinfo
known_third_party = PyPDF2,arrow,bleach,bs4,captcha,celery,django,environ,faker,fastjsonschema,icalevnt,markdown,modelcluster,pirates,pytest,pytz,requests,sentry_sdk,taggit,tweepy,wagtail,wagtailmetadata,weasyprint,yaml
default_language_version:
python: python3.8
python: python3.9
exclude: snapshots/
repos:
......
......@@ -180,39 +180,41 @@ class MainHomePage(MenuMixin, ExtendedMetadataHomePageMixin, MetadataPageMixin,
def get_region_response(self, request):
last_month = timezone.now().today().replace(day=1) - timedelta(days=1)
first_day_of_last_month = last_month.replace(day=1)
if request.GET.get('region', None) == 'VSK':
if request.GET.get("region", None) == "VSK":
sorted_article_qs = MainArticlePage.objects.filter(
date__gt=first_day_of_last_month
).order_by("-date")
else:
sorted_article_qs = MainArticlePage.objects.filter(
date__gt=first_day_of_last_month, region=request.GET.get('region', None)
date__gt=first_day_of_last_month, region=request.GET.get("region", None)
).order_by("-date")
context = {
"article_data_list": sorted_article_qs[:3]
}
context = {"article_data_list": sorted_article_qs[:3]}
data = {
'html': render(request, 'main/includes/small_article_preview.html', context).content.decode("utf-8")
"html": render(
request, "main/includes/small_article_preview.html", context
).content.decode("utf-8")
}
return JsonResponse(data=data, safe=False)
def get_twitter_response(self, request):
tweet_paginator = Paginator(Tweet.objects.order_by("-twitter_id"), self.max_items)
tweet_page = tweet_paginator.get_page(request.GET.get('page', 1))
context = {
"tweet_list": tweet_page.object_list
}
html_content = render(request, 'main/includes/twitter_widget.html', context).content
tweet_paginator = Paginator(
Tweet.objects.order_by("-twitter_id"), self.max_items
)
tweet_page = tweet_paginator.get_page(request.GET.get("page", 1))
context = {"tweet_list": tweet_page.object_list}
html_content = render(
request, "main/includes/twitter_widget.html", context
).content
data = {
'html': html_content.decode("utf-8"),
'last_page': tweet_page.paginator.num_pages,
"html": html_content.decode("utf-8"),
"last_page": tweet_page.paginator.num_pages,
}
return JsonResponse(data=data, safe=False)
def serve(self, request, *args, **kwargs):
if not request.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest':
if not request.META.get("HTTP_X_REQUESTED_WITH") == "XMLHttpRequest":
return super().serve(request, *args, **kwargs)
if 'region' in request.GET:
if "region" in request.GET:
return self.get_region_response(request)
else:
return self.get_twitter_response(request)
......@@ -310,7 +312,7 @@ class MainArticlesPage(
first_day_of_last_month = last_month.replace(day=1)
sorted_article_qs = MainArticlePage.objects.filter(
date__gt=first_day_of_last_month
date__gt=first_day_of_last_month, article_type=ARTICLE_TYPES.WORK_TIMELINE
).order_by("-date")
article_data_list = []
......@@ -334,26 +336,56 @@ class MainArticlesPage(
def get_context(self, request, *args, **kwargs):
ctx = super().get_context(request, args, kwargs)
article_list = self.get_article_data_list(1)
ctx["article_data_list"] = article_list
ctx["show_next_articles"] = MainArticlePage.objects.count() > len(article_list)
article_timeline_list = self.get_article_data_list(1)
ctx["article_timeline_list"] = article_timeline_list
ctx["show_next_timeline_articles"] = MainArticlePage.objects.filter(
article_type=ARTICLE_TYPES.WORK_TIMELINE
).count() > len(article_timeline_list)
article_list = MainArticlePage.objects.filter(
article_type=ARTICLE_TYPES.PRESS_RELEASE
).order_by("-date")
ctx["article_article_list"] = article_list[:10]
ctx["show_next_article"] = len(article_list) > 4
return ctx
def get_articles_response(self, request):
article_list = self.get_article_data_list(int(request.GET.get('months', None)))
context = {
"article_data_list": article_list
def get_timeline_articles_response(self, request):
article_list = self.get_article_data_list(int(request.GET.get("months", None)))
context = {"article_data_list": article_list}
data = {
"html": render(
request, "main/blocks/articles_timeline_block.html", context
).content.decode("utf-8"),
"last_article": article_list[-1]
== MainArticlePage.objects.filter(article_type=ARTICLE_TYPES.WORK_TIMELINE)
.order_by("-date")
.last(),
}
return JsonResponse(data=data, safe=False)
def get_articles_response(self, request):
article_paginator = Paginator(
MainArticlePage.objects.filter(
article_type=ARTICLE_TYPES.PRESS_RELEASE
).order_by("-date", "title"),
10,
)
article_page = article_paginator.get_page(request.GET.get("page", 1))
context = {"article_data_list": article_page.object_list}
html_content = render(
request, "main/includes/person_article_preview.html", context
).content
data = {
'html': render(request, 'main/blocks/articles_block.html', context).content.decode("utf-8"),
'last_article': article_list[-1] == MainArticlePage.objects.all().order_by('-date').last()
"html": html_content.decode("utf-8"),
"last_page": article_page.paginator.num_pages,
}
return JsonResponse(data=data, safe=False)
def serve(self, request, *args, **kwargs):
if not request.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest':
if not request.META.get("HTTP_X_REQUESTED_WITH") == "XMLHttpRequest":
return super().serve(request, *args, **kwargs)
if 'months' in request.GET:
if "months" in request.GET:
return self.get_timeline_articles_response(request)
if "page" in request.GET:
return self.get_articles_response(request)
@staticmethod
......@@ -507,7 +539,7 @@ class MainPersonPage(ExtendedMetadataPageMixin, SubpageMixin, MetadataPageMixin,
blank=True,
null=True,
verbose_name="Hlavní obrázek",
related_name="+"
related_name="+",
)
profile_image = models.ForeignKey(
......@@ -516,7 +548,7 @@ class MainPersonPage(ExtendedMetadataPageMixin, SubpageMixin, MetadataPageMixin,
blank=True,
null=True,
verbose_name="Profilový obrázek",
related_name="+"
related_name="+",
)
before_name = models.CharField(
"Tituly před jménem", max_length=32, blank=True, null=True
......@@ -535,7 +567,7 @@ class MainPersonPage(ExtendedMetadataPageMixin, SubpageMixin, MetadataPageMixin,
blank=True,
null=True,
max_length=32,
help_text="Uživatelské jméno zadejte bez @ na začátku"
help_text="Uživatelské jméno zadejte bez @ na začátku",
)
social_links = StreamField(
......@@ -622,7 +654,7 @@ class MainContactPage(ExtendedMetadataPageMixin, SubpageMixin, MetadataPageMixin
text = StreamField(
[("two_columns_text", blocks.TwoTextColumnBlock())],
verbose_name="Kontaktní informace",
blank=True
blank=True,
)
### PANELS
......
<input type="text" class="text-input bg-white form-field__control {{ classes }}" value="" placeholder="{{ placeholder }}{{^ placeholder }}{{ form.placeholder }}{{/ placeholder }}" {{# disabled }}disabled{{/ disabled }} {{# readonly }}readonly{{/ readonly }} />
<input type="text" class="text-input bg-white form-field__control {{ classes }}" value=""
placeholder="{{ placeholder }}{{^ placeholder }}{{ form.placeholder }}{{/ placeholder }}" {{# disabled }}disabled{{/ disabled }} {{# readonly }}readonly{{/ readonly }} />
......@@ -5,7 +5,7 @@
class="mr-4 h-32 w-32"
>
<div class="flex flex-col justify-between items-start">
<span class="text-sm text-green-500 lg:text-base mb-2">23.2.2022</span>
<span class="text-sm text-green-500 mb-2 lg:text-base">23.2.2022</span>
<h4 class="font-alt leading-5 text-base uppercase lg:text-base mb-2">
Komentář Lukáše Koláříka: Kriminalita ve virtuálním prostoru není imaginární,
ale skutečná. Jak nenaletět internetovým šmejdům?
......
......@@ -2,7 +2,7 @@
<div class="flex flex-row sm:flex-col items-center">
<img class="rounded-full shadow-sm w-12 h-12 mb-4 sm:mb-2" src="https://randomuser.me/api/portraits/women/56.jpg"
alt="user image"/>
<div class="flex flex-col sm:sm:flex-col">
<div class="flex flex-col sm:flex-col">
<h5 class="font-alt text-xl mb-2 sm:text-base">Tomáš Marný</h5>
<small class="mb-4 text-turquoise-400">@pirat.tomas.marny</small>
</div>
......
......@@ -20,6 +20,7 @@
v-slot="{ isCurrentView, toggleView }">
<div class="grid-container article-section mb-8">
<div class="grid-full">
<div class="flex justify-center">
<div class="switch">
<a @click="toggleView('timeline')" class="switch__item"
:class="{'switch__item--active': isCurrentView('timeline')}">Poslanecká sněmovna</a>
......@@ -27,9 +28,10 @@
:class="{'switch__item--active': isCurrentView('articles')}">Vláda</a>
</div>
</div>
</div>
</div>
<template v-if="isCurrentView('timeline')">
<div class="mt-20">
<div class="mt-10 md:mt-20">
{{> organisms-main-articles-timeline }}
</div>
</template>
......
......@@ -14,12 +14,21 @@
</div>
<div class="">
<div class="__js-root">
<ui-view-provider :initial="{candidates: true, program: false}" :sync-location="true" v-slot="{ isCurrentView, toggleView }">
<div class="mb-12 container--medium">
<ui-view-provider :initial="{candidates: true, program: false}" :sync-location="true"
v-slot="{ isCurrentView, toggleView }">
<div class="mb-12 container--medium flex justify-start">
<ui-horizontal-scrollable>
<div class="switch">
<a @click="toggleView('candidates')" class="switch__item" :class="{'switch__item--active': isCurrentView('candidates')}">Komunální volby 2022</a>
<a @click="toggleView('program')" class="switch__item" :class="{'switch__item--active': isCurrentView('program')}">Sněmovní volby 2021</a>
<a @click="toggleView('candidates')" class="switch__item"
:class="{'switch__item--active': isCurrentView('candidates')}">Komunální volby 2022</a>
<a @click="toggleView('program')" class="switch__item"
:class="{'switch__item--active': isCurrentView('program')}">Sněmovní volby 2021</a>
<a @click="toggleView('program')" class="switch__item"
:class="{'switch__item--active': isCurrentView('program1')}">Sněmovní volby 2020</a>
<a @click="toggleView('program')" class="switch__item"
:class="{'switch__item--active': isCurrentView('program2')}">Sněmovní volby 2019</a>
</div>
</ui-horizontal-scrollable>
</div>
<div>
<template v-if="isCurrentView('candidates')">
......
......@@ -174,6 +174,9 @@
@apply font-alt text-4xl font-medium tracking-tight uppercase xl:text-8xl;
}
.head-9xl {
@apply font-alt text-5xl font-medium tracking-tight uppercase xl:text-8xl;
}
p {
@apply text-sm leading-6 lg:text-base;
......
.switch {
@apply py-5 justify-center;
@apply py-5;
}
.switch__item {
......
<div class="grid-container px-4 mb-4 bg-grey-150 xl:mb-20">
<div class="grid-container flex xl:grid mb-4 bg-grey-150 xl:mb-20 py-5">
<div class="flex justify-start xl:justify-end grid-left-side">
<i class="ico--download text-6xl mr-12 pt-5 pb-5"></i>
<i class="ico--download p-2 text-3xl md:text-4xl xl:text-7xl xl:mr-12"></i>
</div>
<div class="grid-content flex items-center flex-wrap gap-3">
<div class="flex items-center bg-white p-3 h-11 mr-3">
<div class="flex items-center bg-white h-11 p-1 mr-3">
<span class="font-bold mr-1">Stáhnout soubor: </span>
<span>{{ self.file }}</span>
</div>
<a href="{{ self.file.url }}" class="btn btn__slide__wrap h-11 p-0" download>
<span class="btn text-sm bg-black text-white w-32 lg:text-base">Stáhnout</span>
<span class="btn text-sm bg-white text-black w-32 lg:text-base">Stáhnout</span>
<span class="btn text-lg bg-black text-white w-32 lg:text-base">Stáhnout</span>
<span class="btn text-lg bg-white text-black w-32 lg:text-base">Stáhnout</span>
</a>
</div>
</div>
\ No newline at end of file
{% load wagtailimages_tags %}
<div class="grid-container px-3 pt-3 mb-4 bg-grey-150 xl:pt-0 xl:mb-20">
<div class="grid-container px-3 py-3 mb-4 bg-grey-150 xl:py-0 xl:mb-20">
<div class="grid-content-with-right-side flex flex-wrap gap-3 xl:gap-5">
{% image self.image max-500x500 as image %}
<img src="{{ image.url }}"
alt="" class="w-full max-w-sm">
<div class="flex flex-col justify-between">
<a href="{{ self.href }}" class="mt-0 xl:mt-8 mb-2 font-bold hover:no-underline leading-5">
<a href="{{ self.href }}" class="mt-4 xl:mt-8 mb-2 font-bold hover:no-underline leading-5">
{{ self.text }}
</a>
<span class="text-sm text-grey-200 uppercase mb-0 xl:mb-6">zdroj: {{ self.href }}</span>
<span class="text-sm text-grey-200 uppercase mb-4 xl:mb-6">zdroj: {{ self.href }}</span>
</div>
</div>
</div>
\ No newline at end of file
<div class="grid-container px-4 mb-4 bg-grey-150 pt-10 lg:mb-20">
<div class="grid-left-side flex justify-start xl:justify-end">
<i class="ico--code text-7xl mr-12"></i>
<div class="grid-container flex xl:grid mb-4 bg-grey-150 xl:mb-20 py-5">
<div class="grid-left-side flex lg:justify-end">
<span class="quote-icon p-2 xl:mr-12 font-alt"></span>
</div>
<div class="flex flex-col grid-content">
<span class="head-4xl">{{ self.quote }}</span>
<span class="text-3xl head-4xl xl:text-4xl">{{ self.quote }}</span>
<span class="font-alt text-turquoise-500 mb-6">– {{ self.autor_name }}</span>
</div>
</div>
\ No newline at end of file
{% for month_article_data in article_data_list %}
<div class="mb-4">
<h3 class="head-7xl mb-4 xl:hidden">
{{ month_article_data.month_text }}
</h3>
<div class="flex flex-col justify-between xl:flex-row">
<div class="xl:pt-8">
{% for article_page in month_article_data.left_column %}
{% include 'main/includes/work_article_preview.html' %}
{% empty %}
<div class="p-7 flex flex-col max-w-xl mb-8" />
{% endfor %}
</div>
<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">
{{ month_article_data.month_text }}
</div>
</div>
<div class="xl:pt-14">
{% for article_page in month_article_data.right_column %}
{% include 'main/includes/work_article_preview.html' %}
{% empty %}
<div class="p-7 flex flex-col max-w-xl mb-8" />
{% endfor %}
</div>
</div>
</div>
{% endfor %}
\ No newline at end of file
{% for month_article_data in article_data_list %}
<div class="mb-4">
<h2 class="head-4xl mb-5 xl:hidden">
{{ month_article_data.month_text }}
</h2>
<div class="article-timeline-grid justify-between">
<div class="article-timeline-grid__left-article xl:pt-8">
{% for article_page in month_article_data.left_column %}
{% include 'main/includes/work_article_preview.html' %}
{% empty %}
<div class="p-7 flex flex-col max-w-xl mb-8"/>
{% endfor %}
</div>
<div class="article-timeline-grid__timeline relative border border-violet-400 hidden xl:block">
<div class="article-timeline--month absolute bg-violet-400 p-1 text-white font-bold">
{{ month_article_data.month_text }}
</div>
</div>
<div class="article-timeline-grid__right-article xl:pt-14">
{% for article_page in month_article_data.right_column %}
{% include 'main/includes/work_article_preview.html' %}
{% empty %}
<div class="p-7 flex flex-col max-w-xl mb-8"/>
{% endfor %}
</div>
</div>
</div>
{% endfor %}
\ No newline at end of file
{% load wagtailimages_tags %}
{% load static wagtailimages_tags %}
<div class="bg-cover bg-no-repeat section-clip py-16 lg:py-36"
style="background-image: url('https://i.picsum.photos/id/630/1980/1400.jpg?hmac=WjDo021fzd9SaIlmsi9LtZJApZ02RMzdG0bYLx8iXOo')">
<div class="container--medium">
<h2 class="head-7xl text-center mb-6 xl:mb-28">
<div class="bg-cover bg-no-repeat section-clip py-16 xl:h-screen lg:py-36"
style="background-image: url('{% static 'main/images/background-images/bg-join-us.jpg' %}')">
<div class="container--wide mx-auto z-10">
<h2 class="head-7xl xl:text-center mb-6 xl:mb-28">
{{ self.title }}
</h2>
<div class="flex flex-wrap justify-center items-center">
<div class="flex flex-wrap gap-2 md:gap-1 justify-center items-center md:flex-row">
{% for box in self.list %}
<div class="mb-1 mr-1 w-60 w-80 h-80 flex bg-white flex-col items-center justify-center md:mr-1">
<div class="w-96 h-72 flex bg-white flex-col items-center justify-center drop-shadow-xl xl:m-0 sm:w-80 sm:h-80">
{% image box.image max-200x200 as box_img %}
<img
src="{{ box_img.url }}"
alt=""
class="mb-8"
class="mb-8 max-w-20 max-h-20"
>
<h5 class="head-4xl mb-8">
{{ box.title }}
......
......@@ -7,12 +7,10 @@
{% image slide.image fill-1920x1020 as slide_img %}
<img src="{{ slide_img.url }}" draggable="false">
<div class="header-carousel--text grid-container">
<div class="grid-content-with-right-side">
<div class="grid-content-with-right-side h-fit">
<h1 class="text-white">{{ slide.line_1 }}</h1>{# TODO SEO <h1><span><span> #}
<h1 class="text-orange-250">{{ slide.line_2 }}</h1>
{% include 'main/includes/button_animated.html' with btn_link=slide.button_link btn_text=slide.button_text %}
</a>
<h1 class="text-orange-250 mb-2">{{ slide.line_2 }}</h1>
{% include 'main/includes/button_animated.html' with btn_link=slide.button_link btn_text=slide.button_text extra_classes="btn-carousel" %}
</div>
</div>
</div>
......
{% load wagtailcore_tags wagtailimages_tags shared_filters %}
<div class="bg-cover bg-no-repeat section-clip mb-8 py-16 lg:py-36 lg:mb-16"
style="background-image: url('https://i.picsum.photos/id/630/1980/1400.jpg?hmac=WjDo021fzd9SaIlmsi9LtZJApZ02RMzdG0bYLx8iXOo')">
style="background-image: url('{% static 'main/images/background-images/bg-join-us.jpg' %}')">
<div class="container--medium mx-auto px-4">
<h2 class="head-7xl text-center mb-6 xl:mb-28">
<h2 class="head-7xl xl:text-center mb-6 xl:mb-28">
{{ self.title }}
</h2>
<div class="flex flex-wrap mb-5 lg:mb-10">
{% image article_data_list.0.image original as article_img %}
<img src="{{ article_img.url }}" draggable="false" alt="" class="lg:max-w-lg lg:mr-11">
<img src="{{ article_img.url }}" draggable="false" alt="" class="lg:max-w-lg lg:mr-11 h-fit">
<div class="flex flex-col max-w-xl items-start">
<span class="text-green-500 head-3xl mt-10 mb-4 lg:mb-8">{{ article_data_list.0.date }}</span>
<h5 class="head-4xl mb-5 lg:mb-10">{{ article_data_list.0.title }}</h5>
......
{% load wagtailimages_tags %}
<div class="container--medium mb-8 lg:mb-16">
<h2 class="head-7xl text-center mb-6 xl:mb-28">
<div class="container--medium mb-8 xl:h-screen flex flex-col justify-center lg:mb-16">
<h2 class="head-7xl xl:text-center mb-6 xl:mb-28">
{{ self.title }}
</h2>
<div class="flex flex-wrap space-x-1 justify-center items-center">
<div class="flex flex-wrap space-x-1 justify-center gap-2 md:gap-1 items-center">
{% for box in self.list %}
{% image box.image fill-500x500 as box_image %}
<div class="w-full max-w-xs mb-1 w-80 h-80 flex flex-col items-center justify-center"
<div class="w-96 h-60 flex bg-white flex-col items-center bg-cover justify-center drop-shadow-xl xl:m-0 sm:w-80 sm:h-80"
style="background-image: url('{{ box_image.url }}')">
<h5 class="head-alt-md text-white mt-24 mb-8">
{{ box.title }}
......
{% load static %}
<div class="bg-cover bg-no-repeat section-clip py-16 lg:py-36"
style="background-image: url('https://i.picsum.photos/id/630/1980/1400.jpg?hmac=WjDo021fzd9SaIlmsi9LtZJApZ02RMzdG0bYLx8iXOo')">
style="background-image: url('{% static 'main/images/background-images/bg-map.jpg' %}')">
<div class="container--medium mx-auto px-4 ">
<h2 class="head-7xl text-center mb-6 xl:mb-28">
<h2 class="head-7xl xl:text-center mb-6 xl:mb-28">
{{ self.title }}
</h2>
<div class="flex flex-wrap">
......@@ -18,13 +20,12 @@
{% endfor %}
</select>
</div>
<div id='searchResultWrapper' class="mb-3">
<div id='searchResultWrapper'>
{% include 'main/includes/small_article_preview.html' with article_data_list=article_data_list %}
</div>
</div>
</div>
</div>
<div></div>
</div>
</div>
<script type="text/javascript">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment