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
Select Git revision
  • feat-more-blocks
  • feat-rework-election-page
  • feat/custom-css
  • feat/dary-improvements
  • feat/geo-feature-collections
  • feat/hideable-tweets
  • feat/instagram-feed
  • feat/people-octopus-imports
  • feat/pirstan-changes
  • feat/redesign-fixes-3
  • feat/redesign-improvements-10
  • feat/redesign-improvements-8
  • feat/separate-import-thread
  • feature/crypto-widget
  • features/add-custom-numbering-for-candidates
  • features/add-dynamic-candidate-numbers
  • features/add-embed-to-articles
  • features/add-feature-enlarging-sub-block
  • features/add-link-to-images
  • features/add-pdf-page
  • features/add-redirects
  • features/add-thumbnail-principle-to-uniweb-and-senate
  • features/add-timeline
  • features/add-typed-table
  • features/create-collapsible-extra-legal-info
  • features/create-mastodon-feed-block
  • features/create-wordcloud-from-article-page
  • features/donation-panel-should-be-optional
  • features/extend-hero-banner
  • features/fix-broken-calendar-categories
  • master
  • test
32 results

Target

Select target project
  • to/majak
  • b1242/majak
2 results
Select Git revision
  • feat-more-blocks
  • feat-rework-election-page
  • feat/custom-css
  • feat/dary-improvements
  • feat/geo-feature-collections
  • feat/hideable-tweets
  • feat/instagram-feed
  • feat/people-octopus-imports
  • feat/pirstan-changes
  • feat/redesign-fixes-3
  • feat/redesign-improvements-10
  • feat/redesign-improvements-8
  • feat/separate-import-thread
  • feature/crypto-widget
  • features/add-custom-numbering-for-candidates
  • features/add-dynamic-candidate-numbers
  • features/add-embed-to-articles
  • features/add-feature-enlarging-sub-block
  • features/add-link-to-images
  • features/add-pdf-page
  • features/add-redirects
  • features/add-thumbnail-principle-to-uniweb-and-senate
  • features/add-timeline
  • features/add-typed-table
  • features/create-collapsible-extra-legal-info
  • features/create-mastodon-feed-block
  • features/create-wordcloud-from-article-page
  • features/donation-panel-should-be-optional
  • features/extend-hero-banner
  • features/fix-broken-calendar-categories
  • master
  • test
32 results
Show changes
Commits on Source (18)
Showing
with 511 additions and 53 deletions
......@@ -123,11 +123,11 @@ class CardLinkBlock(CardLinkBlockMixin):
class Meta:
template = "district/blocks/card_link_block.html"
icon = "link"
label = "Karta odkazu"
label = "Karta s odkazem"
class CardLinkWithHeadlineBlock(CardLinkWithHeadlineBlockMixin):
card_items = ListBlock(CardLinkBlock(), label="Karty odkazu")
card_items = ListBlock(CardLinkBlock(), label="Karty s odkazy")
class Meta:
template = "district/blocks/card_link_with_headline_block.html"
......
# Generated by Django 4.1.6 on 2023-02-28 07:51
from django.db import migrations
import wagtail.blocks
import wagtail.fields
import wagtail.images.blocks
class Migration(migrations.Migration):
dependencies = [
('district', '0105_alter_districtarticlepage_content'),
]
operations = [
migrations.AlterField(
model_name='districtcrossroadpage',
name='cards_content',
field=wagtail.fields.StreamField([('cards', wagtail.blocks.StructBlock([('headline', wagtail.blocks.CharBlock(label='Titulek bloku', required=False)), ('card_items', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(label='Obrázek')), ('title', wagtail.blocks.CharBlock(label='Titulek', required=True)), ('text', wagtail.blocks.RichTextBlock(label='Krátký text pod nadpisem', required=False)), ('page', wagtail.blocks.PageChooserBlock(label='Stránka', page_type=['district.DistrictArticlePage', 'district.DistrictArticlesPage', 'district.DistrictCenterPage', 'district.DistrictContactPage', 'district.DistrictCrossroadPage', 'district.DistrictCustomPage', 'district.DistrictElectionCampaignPage', 'district.DistrictElectionProgramPage', 'district.DistrictElectionRootPage', 'district.DistrictPeoplePage', 'district.DistrictPersonPage', 'district.DistrictPostElectionStrategyPage', 'district.DistrictProgramPage'], required=False)), ('link', wagtail.blocks.URLBlock(label='Odkaz', required=False))]), label='Karty s odkazy'))]))], blank=True, use_json_field=True, verbose_name='Karty rozcestníku'),
),
]
......@@ -59,7 +59,7 @@
<div class="navbar__brand my-4 flex items-center lg:block lg:pr-8 lg:my-0">
<a href="/">
{% if page.root_page.custom_logo %}
{% image page.root_page.custom_logo width-128 as logo %}
{% image page.root_page.custom_logo width-512 as logo %}
<img
src="{{ logo.url }}"
class="w-10 lg:w-full lg:border-r lg:border-grey-300 lg:pr-8"
......
......@@ -53,7 +53,7 @@ class CardLinkBlock(CardLinkBlockMixin):
class Meta:
template = "main/blocks/card_link_block.html"
icon = "link"
label = "Karta odkazu"
label = "Karta s odkazem"
class CTAMixin(StructBlock):
......@@ -359,12 +359,12 @@ class TwoTextColumnBlock(StructBlock):
text_column_2 = RichTextBlock(label="Druhý sloupec textu")
class Meta:
icon = "text"
icon = "doc-full"
label = "Text ve dvou sloupcích"
class CardLinkWithHeadlineBlock(CardLinkWithHeadlineBlockMixin):
card_items = ListBlock(CardLinkBlock(), label="Karty odkazu")
card_items = ListBlock(CardLinkBlock(), label="Karty s odkazy")
class Meta:
template = "main/blocks/card_link_with_headline_block.html"
......@@ -372,4 +372,39 @@ class CardLinkWithHeadlineBlock(CardLinkWithHeadlineBlockMixin):
label = "Karty odkazů s nadpisem"
class HoaxBlock(StructBlock):
title = CharBlock(label="Titulek")
hoax = RichTextBlock(label="Hoax")
image = ImageChooserBlock(label="Obrázek")
image_explanation = CharBlock(label="Popis obrázku", required=False)
reality = RichTextBlock(label="Realita")
class Meta:
icon = "view"
label = "Hoax"
template = "main/blocks/hoax_block.html"
class TeamBlock(StructBlock):
title = CharBlock(label="Název sekce týmů")
slug = CharBlock(
label="Slug sekce",
required=False,
help_text="Není třeba vyplňovat, bude automaticky vyplněno",
)
team_list = ListBlock(
CardLinkWithHeadlineBlock(label="Karta týmu"),
label="Týmy",
)
class Meta:
icon = "group"
label = "Týmy"
def get_prep_value(self, value):
value = super().get_prep_value(value)
value["slug"] = slugify(value["title"])
return value
# TwitterCarouselBlock
# Generated by Django 4.1.6 on 2023-02-28 08:10
from django.db import migrations, models
import django.db.models.deletion
import shared.models
import wagtail.blocks
import wagtail.fields
import wagtail.images.blocks
import wagtailmetadata.models
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0083_workflowcontenttype'),
('wagtailimages', '0025_alter_image_file_alter_rendition_file'),
('main', '0045_alter_mainprogrampage_program'),
]
operations = [
migrations.AlterModelOptions(
name='mainpeoplepage',
options={'verbose_name': 'Lidé a týmy'},
),
migrations.AlterField(
model_name='maincrossroadpage',
name='headlined_cards_content',
field=wagtail.fields.StreamField([('headlined_cards', wagtail.blocks.StructBlock([('headline', wagtail.blocks.CharBlock(label='Titulek bloku', required=False)), ('card_items', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(label='Obrázek')), ('title', wagtail.blocks.CharBlock(label='Titulek', required=True)), ('text', wagtail.blocks.RichTextBlock(label='Krátký text pod nadpisem', required=False)), ('page', wagtail.blocks.PageChooserBlock(label='Stránka', page_type=['main.MainArticlesPage', 'main.MainArticlePage', 'main.MainProgramPage', 'main.MainPeoplePage', 'main.MainPersonPage', 'main.MainSimplePage', 'main.MainContactPage', 'main.MainCrossroadPage'], required=False)), ('link', wagtail.blocks.URLBlock(label='Odkaz', required=False))]), label='Karty s odkazy'))]))], blank=True, use_json_field=True, verbose_name='Karty rozcestníku s nadpisem'),
),
migrations.AlterField(
model_name='mainpeoplepage',
name='people',
field=wagtail.fields.StreamField([('people_group', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(label='Titulek')), ('slug', wagtail.blocks.CharBlock(help_text='Není třeba vyplňovat, bude automaticky vyplněno', label='Slug skupiny', required=False)), ('person_list', wagtail.blocks.ListBlock(wagtail.blocks.PageChooserBlock(label='Detail osoby', page_type=['main.MainPersonPage']), label='Skupina osob'))], label='Seznam osob')), ('team_group', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(label='Název sekce týmů')), ('slug', wagtail.blocks.CharBlock(help_text='Není třeba vyplňovat, bude automaticky vyplněno', label='Slug sekce', required=False)), ('team_list', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('headline', wagtail.blocks.CharBlock(label='Titulek bloku', required=False)), ('card_items', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(label='Obrázek')), ('title', wagtail.blocks.CharBlock(label='Titulek', required=True)), ('text', wagtail.blocks.RichTextBlock(label='Krátký text pod nadpisem', required=False)), ('page', wagtail.blocks.PageChooserBlock(label='Stránka', page_type=['main.MainArticlesPage', 'main.MainArticlePage', 'main.MainProgramPage', 'main.MainPeoplePage', 'main.MainPersonPage', 'main.MainSimplePage', 'main.MainContactPage', 'main.MainCrossroadPage'], required=False)), ('link', wagtail.blocks.URLBlock(label='Odkaz', required=False))]), label='Karty s odkazy'))], label='Karta týmu'), label='Týmy'))]))], blank=True, use_json_field=True, verbose_name='Lidé a týmy'),
),
migrations.CreateModel(
name='MainHoaxPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')),
('description', wagtail.fields.RichTextField(blank=True, null=True, verbose_name='Popis')),
('content', wagtail.fields.StreamField([('hoax', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(label='Titulek')), ('hoax', wagtail.blocks.RichTextBlock(label='Hoax')), ('image', wagtail.images.blocks.ImageChooserBlock(label='Obrázek')), ('image_explanation', wagtail.blocks.RichTextBlock(label='Popis obrázku', required=False)), ('reality', wagtail.blocks.RichTextBlock(label='Realita'))]))], blank=True, use_json_field=True, verbose_name='Hoaxy a jejich vysvětlení')),
('search_image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image', verbose_name='Search image')),
],
options={
'verbose_name': 'Hoaxy',
},
bases=(shared.models.SubpageMixin, wagtailmetadata.models.WagtailImageMetadataMixin, 'wagtailcore.page', models.Model),
),
]
# Generated by Django 4.1.6 on 2023-02-28 10:03
from django.db import migrations
import wagtail.blocks
import wagtail.fields
import wagtail.images.blocks
class Migration(migrations.Migration):
dependencies = [
('main', '0046_alter_mainpeoplepage_options_and_more'),
]
operations = [
migrations.AlterField(
model_name='mainhoaxpage',
name='content',
field=wagtail.fields.StreamField([('hoax', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(label='Titulek')), ('hoax', wagtail.blocks.RichTextBlock(label='Hoax')), ('image', wagtail.images.blocks.ImageChooserBlock(label='Obrázek')), ('image_explanation', wagtail.blocks.CharBlock(label='Popis obrázku', required=False)), ('reality', wagtail.blocks.RichTextBlock(label='Realita'))]))], blank=True, use_json_field=True, verbose_name='Hoaxy a jejich vysvětlení'),
),
]
......@@ -23,6 +23,7 @@ from wagtail.blocks import CharBlock, RichTextBlock
from wagtail.contrib.routable_page.models import RoutablePageMixin, route
from wagtail.fields import RichTextField, StreamField
from wagtail.models import Page
from wagtail.search import index
from wagtailmetadata.models import MetadataPageMixin
from elections2021.constants import REGION_CHOICES # pozor, import ze sousedního modulu
......@@ -182,6 +183,7 @@ class MainHomePage(
"main.MainSimplePage",
"main.MainContactPage",
"main.MainCrossroadPage",
"main.MainHoaxPage",
]
### OTHERS
......@@ -338,7 +340,7 @@ class MainHomePage(
class MainArticlesPage(
ExtendedMetadataPageMixin, SubpageMixin, MetadataPageMixin, Page
RoutablePageMixin, ExtendedMetadataPageMixin, SubpageMixin, MetadataPageMixin, Page
):
perex = models.TextField()
last_import_log = models.TextField(
......@@ -434,22 +436,23 @@ class MainArticlesPage(
return article_data_list
def get_context(self, request, *args, **kwargs):
def get_context(self, request, get_articles: bool = True, *args, **kwargs):
ctx = super().get_context(request, args, kwargs)
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
).live().count() > len(article_timeline_list)
article_list = (
MainArticlePage.objects.filter(article_type=ARTICLE_TYPES.PRESS_RELEASE)
.order_by("-date")
.live()[:11]
) # dám LIMIT +1, abych věděl, jestli má cenu show_next
ctx["article_article_list"] = article_list[:10]
ctx["show_next_article"] = len(article_list) > 10
if get_articles:
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
).live().count() > len(article_timeline_list)
article_list = (
MainArticlePage.objects.filter(article_type=ARTICLE_TYPES.PRESS_RELEASE)
.order_by("-date")
.live()[:11]
) # dám LIMIT +1, abych věděl, jestli má cenu show_next
ctx["article_article_list"] = article_list[:10]
ctx["show_next_article"] = len(article_list) > 10
return ctx
......@@ -486,12 +489,69 @@ class MainArticlesPage(
}
return JsonResponse(data=data, safe=False)
def get_all_articles_search_response(self, request):
article_paginator = Paginator(
MainArticlePage
.objects
.order_by("-date")
.live()
.search(request.GET["q"]),
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": html_content.decode("utf-8"),
"has_next": article_page.has_next(),
}
return JsonResponse(data=data, safe=False)
@cached_property
def search_url(self):
return self.url + self.reverse_subpage("search")
@route(r"^search")
def search(self, request):
if request.method == "GET" and "q" in request.GET:
query = request.GET["q"]
article_results = (
MainArticlePage
.objects
.order_by("-date")
.live()
.search(query)
[:11]
)
return render(
request,
"main/main_article_search.html",
{
**self.get_context(request, get_articles=False),
"query": query,
"article_results": article_results[:10],
"show_more_articles": len(article_results) > 10,
"sub_heading": f"Vyhledávání „{query}"
}
)
else:
return HttpResponseRedirect(self.url)
def serve(self, request, *args, **kwargs):
if request.META.get("HTTP_X_REQUESTED_WITH") == "XMLHttpRequest":
if "months" in request.GET:
return self.get_timeline_articles_response(request)
if "page" in request.GET:
return self.get_articles_response(request)
if "q" not in request.GET:
return self.get_articles_response(request)
else:
return self.get_all_articles_search_response(request)
return super().serve(request, *args, **kwargs)
......@@ -551,6 +611,14 @@ class MainArticlePage(
)
tags = ClusterTaggableManager(through=MainArticleTag, blank=True)
search_fields = Page.search_fields + [
index.SearchField("title"),
index.SearchField("author"),
index.SearchField("author_page"),
index.SearchField("perex"),
index.SearchField("content"),
]
### PANELS
content_panels = ArticleMixin.content_panels + [
......@@ -626,8 +694,11 @@ class MainPeoplePage(ExtendedMetadataPageMixin, SubpageMixin, MetadataPageMixin,
perex = RichTextField()
people = StreamField(
[("people_group", blocks.PeopleGroupBlock(label="Seznam osob"))],
verbose_name="Lidé",
[
("people_group", blocks.PeopleGroupBlock(label="Seznam osob")),
("team_group", blocks.TeamBlock()),
],
verbose_name="Lidé a týmy",
blank=True,
use_json_field=True,
)
......@@ -643,12 +714,16 @@ class MainPeoplePage(ExtendedMetadataPageMixin, SubpageMixin, MetadataPageMixin,
### RELATIONS
parent_page_types = ["main.MainHomePage"]
subpage_types = ["main.MainPersonPage"]
subpage_types = [
"main.MainPersonPage",
"main.MainSimplePage",
"main.MainCrossroadPage",
]
### OTHERS
class Meta:
verbose_name = "Lidé"
verbose_name = "Lidé a týmy"
class MainPersonPage(ExtendedMetadataPageMixin, SubpageMixin, MetadataPageMixin, Page):
......@@ -787,6 +862,7 @@ class MainSimplePage(ExtendedMetadataPageMixin, SubpageMixin, MetadataPageMixin,
"main.MainHomePage",
"main.MainSimplePage",
"main.MainCrossroadPage",
"main.MainPeoplePage",
]
subpage_types = ["main.MainSimplePage"]
......@@ -874,6 +950,7 @@ class MainCrossroadPage(
parent_page_types = [
"main.MainHomePage",
"main.MainCrossroadPage",
"main.MainPeoplePage",
]
subpage_types = [
"main.MainSimplePage",
......@@ -883,3 +960,44 @@ class MainCrossroadPage(
class Meta:
verbose_name = "Rozcestník s kartami"
class MainHoaxPage(
ExtendedMetadataPageMixin, SubpageMixin, MetadataPageMixin, Page
):
### FIELDS
description = RichTextField(
"Popis",
blank=True,
null=True,
)
content = StreamField(
[
(("hoax"), blocks.HoaxBlock())
],
verbose_name="Hoaxy a jejich vysvětlení",
blank=True,
use_json_field=True,
)
### PANELS
content_panels = Page.content_panels + [
FieldPanel("description"),
FieldPanel("content"),
]
promote_panels = make_promote_panels()
settings_panels = []
### RELATIONS
parent_page_types = ["main.MainHomePage"]
subpage_types = []
### OTHERS
class Meta:
verbose_name = "Hoaxy"
main/static/main/images/hoax.webp

4.85 KiB

main/static/main/images/person-table.png

228 KiB

This diff is collapsed.
This diff is collapsed.
......@@ -7,9 +7,12 @@
<span class="font-bold mr-1">Stáhnout soubor: </span>
<span class="overflow-hidden text-ellipsis">{{ self.file }}</span>
</div>
<a href="{{ self.file.url }}" class="btn btn__slide__wrap h-11 p-0" download>
<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 href="{{ self.file.url }}" class="btn btn--black btn--to-yellow-500 btn--hoveractive uppercase">
<span class="btn__body-wrap">
<span class="btn__body text-lg lg:text-base">
Stáhnout
</span>
</span>
</a>
</div>
</div>
......@@ -4,9 +4,11 @@
{% if self.headline %}
<h2 class="head-4xl mt-5 mb-5">{{ self.headline }}</h2>
{% endif %}
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
<ul class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
{% for card_block in self.card_items %}
{% include_block card_block %}
<li>
{% include_block card_block %}
</li>
{% endfor %}
</div>
</ul>
</div>
{% load wagtailimages_tags wagtailcore_tags static %}
{% image self.image width-800 as img %}
<ui-popout>
<template slot="toggler">
{{ self.title }}
</template>
<ui-popout-content>
<div class="flex flex-wrap gap-4 lg:flex-nowrap">
<div class="grow lg:grow-0 lg:basis-2/3 max-w-screen-lg">
<div class="prose max-w-none">
{{ self.hoax|richtext }}
</div>
<img
class="mt-10"
src="{% static "main/images/hoax.webp" %}"
alt="Hoax"
>
<h3 class="head-2xl mt-10">Jak to je?</h3>
<div class="prose max-w-none">
{{ self.reality|richtext }}
</div>
</div>
<div class="lg:basis-1/3">
<img
class="w-full mb-3"
src="{{ img.url }}"
alt="{{ img.alt }}"
>
<small class="text-grey-300">
<i>{{ self.image_explanation }}</i>
</small>
</div>
</div>
</ui-popout-content>
</ui-popout>
......@@ -5,12 +5,22 @@
style="background-image: url('{{ image_url | default_if_none:"https://cc.cz/wp-content/uploads/2022/04/bartos-otv.jpg" }}')"
>
<div class="grid-container header-max-width pt-16">
<div class="pl-4 pr-2 col-start-1 col-end-3 sm:col-start-2 sm:col-end-13 sm:pr-0">
<h1 class="font-alt text-white">
<span class="text-2xl">{{ before_title | default_if_none:"" }}</span><br>
<span class="font-alt text-7xl">{{ page.title | default_if_none:"" }}</span><span class="text-2xl">{{ after_title | default_if_none:"" }}</span><br>
<span class="font-alt">{{ subtitle | default_if_none:"" }}</span>
</h1>
<div class="pl-4 pr-2 col-start-1 col-end-3 sm:col-start-2 sm:col-end-13 sm:pr-0">
<h1 class="font-alt text-white">
<span class="text-xl sm:text-2xl">{{ before_title | default_if_none:"" }}</span><br>
<div class="flex items-baseline flex-col sm:flex-row">
<span class="font-alt text-6xl sm:text-7xl grow sm:grow-0">{{ page.title | default_if_none:"" }}</span>
{% if after_title %}
<span class="text-xl sm:text-2xl">
<span class="text-xl hidden sm:text-2xl sm:inline">, </span>{{ after_title }}
</span>
{% endif %}
</div>
<br>
<span class="font-alt">{{ subtitle | default_if_none:"" }}</span>
</h1>
</div>
</div>
</div>
</header>
......@@ -4,6 +4,11 @@
<h1 class="head-8xl text-white">
{{ page.title }}
</h1>
{% if sub_heading %}
<h2 class="head-3xl text-white">
{{ sub_heading }}
</h2>
{% endif %}
</div>
</div>
</header>
......@@ -9,7 +9,7 @@
<img src="{% static 'main/images/lahev.svg' %}" alt="newsletter_icon" class="newsletter-grid__icon text-7xl xl:text-9xl w-32">
</div>
<div>
<h5 class="font-alt mb-2 text-6xl xl:text-7xl uppercase">
<h5 class="font-alt mb-2 text-5xl md:text-6xl xl:text-7xl uppercase">
Odebírej náš newsletter
</h5>
<span class="inline-block uppercase text-xl xl:text-base font-bold mb-4 xl:w-full">
......
{% extends "main/base.html" %}
{% load wagtailcore_tags wagtailimages_tags shared_filters %}
{% block content %}
{% include 'main/includes/layout/simple_page_header.html' with sub_heading=sub_heading %}
<main role="main">
<div class="__js-root">
<div class="grid-container article-section mb-8">
<div class="grid-full">
<div class="flex justify-center">
<div class="flex flex-col items-end gap-3">
<form
class="flex flex-row"
method="get"
action="{{ page.search_url }}"
>
<input
class="bg-grey-150 w-56 h-10 px-4 text-lg xl:h-14 xl:px-5"
type="text"
id="q"
name="q"
value="{{ query }}"
placeholder="Hledat články..."
aria-label="Vyhledávací box"
>
<button
class="btn btn--yellow-500 btn--to-yellow-600 btn--hoveractive"
aria-label="Vyhledat"
type="submit"
>
<div class="btn__body-wrap h-10 w-12 min-h-0 min-w-0 xl:h-14 xl:w-14">
<div class="btn__body p-0">
<i class="ico--search"></i>
</div>
</div>
</button>
</form>
<a href="{{ page.url }}" class="btn btn--black btn--to-yellow-500 btn--hoveractive uppercase">
<span class="btn__body-wrap">
<span class="btn__body text-lg lg:text-base">
Zpět na seznam
</span>
</span>
</a>
</div>
</div>
</div>
</div>
<section class="mb-3 xl:mb-14">
{% if article_results %}
<div id="searchArticleResultWrapper">
{% include 'main/includes/person_article_preview.html' with article_data_list=article_results %}
</div>
{% if show_more_articles %}
<div class="grid-container">
<div class="grid-content-with-right-side">
<a
onclick="showMoreArticles(event, this)"
href="#"
data-url="{{ page_url }}"
data-page="2"
data-query="{{ query }}"
class="btn btn--black btn--to-yellow-500 btn--hoveractive uppercase"
>
<span class="btn__body-wrap">
<span class="btn__body text-lg lg:text-base">
Zobrazit další
</span>
</span>
</a>
</div>
</div>
{% endif %}
{% else %}
<div class="grid-container article-section mb-8">
<div class="grid-full">
<p class="text-grey-300 text-center">Žádné výsledky.</p>
</div>
</div>
{% endif %}
</section>
{% include "main/includes/newsletter_section.html" %}
</div>
</main>
<script type="text/javascript">
async function showMoreArticles(event, btn) {
event.preventDefault()
let searchArticleResultWrapper = document.getElementById('searchArticleResultWrapper')
let url = (
btn.getAttribute('data-url')
+ `?page=${btn.getAttribute('data-page')}`
+ `&q=${btn.getAttribute('data-query')}`
)
const response = await fetch(url, {
method: "GET",
headers: {"X-Requested-With": "XMLHttpRequest"},
})
const data = await response.json()
searchArticleResultWrapper.innerHTML += data.html;
if (!data.has_next) { btn.style.display = 'none'; }
btn.setAttribute('data-page', parseInt(btn.getAttribute('data-page')) + 1)
}
</script>
{% endblock content %}
......@@ -20,13 +20,40 @@
v-slot="{ isCurrentView, toggleView }">
<div class="grid-container article-section mb-8">
<div class="grid-full">
<div class="flex justify-center">
<div class="flex flex-col items-center">
<div class="switch">
<a @click="toggleView('timeline')" class="switch__item"
:class="{'switch__item--active': isCurrentView('timeline')}">Aktuality</a>
<a @click="toggleView('articles')" class="switch__item"
:class="{'switch__item--active': isCurrentView('articles')}">Tiskové zprávy</a>
</div>
<div class="xl:mt-3">
<form
class="flex flex-row"
method="get"
action="{{ page.search_url }}"
>
<input
class="bg-grey-150 w-56 h-10 px-4 text-lg xl:h-14 xl:px-5"
type="text"
id="q"
name="q"
placeholder="Hledat články..."
aria-label="Vyhledávací box"
>
<button
class="btn btn--yellow-500 btn--to-yellow-600 btn--hoveractive"
aria-label="Vyhledat"
type="submit"
>
<div class="btn__body-wrap h-10 w-12 min-h-0 min-w-0 xl:h-14 xl:w-14">
<div class="btn__body p-0">
<i class="ico--search"></i>
</div>
</div>
</button>
</form>
</div>
</div>
</div>
</div>
......
{% extends "main/base.html" %}
{% load wagtailcore_tags %}
{% block content %}
{% include 'main/includes/layout/simple_page_header.html' %}
<main role="main" class="mb-10 xl:mb-32 __js-root">
{% if page.description %}
<div class="grid-container mb-2 lg:mb-12">
<div class="grid-content">
<div class="prose max-w-none font-condensed text-xl text-black leading-7 mb-12 program-perex">
{{ page.description|richtext }}
</div>
</div>
</div>
{% endif %}
<div class="grid-container mb-2 lg:mb-12">
<div class="grid-left-side-with-content">
{% for block in page.content %}
{% include_block block %}
{% endfor %}
</div>
</div>
</main>
{% endblock %}