Skip to content
Snippets Groups Projects
Commit 2795cf9c authored by Tomáš Valenta's avatar Tomáš Valenta
Browse files

auto redirect in articles page, update content

parent 5226d281
Branches
No related tags found
2 merge requests!876Fix shared articles & release elections web,!863Add elections web
Pipeline #16127 passed
Showing
with 145 additions and 25 deletions
......@@ -33,8 +33,6 @@ class CandidateBlock(StructBlock):
description = TextBlock(
label="Popis",
required=False,
help_text="Pokud zůstane prázdné, použije se popis ze stránky kandidáta",
)
class Meta:
......
# Generated by Django 4.1.10 on 2024-01-06 06:27
from django.db import migrations
import wagtail.blocks
import wagtail.fields
import wagtail.images.blocks
class Migration(migrations.Migration):
dependencies = [
('elections', '0012_alter_electionshomepage_content'),
]
operations = [
migrations.AlterField(
model_name='electionshomepage',
name='content',
field=wagtail.fields.StreamField([('carousel', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(label='Obrázek na pozadí'))])), ('candidate', wagtail.blocks.StructBlock([('candidates', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('page', wagtail.blocks.PageChooserBlock(label='Stránka', page_type=['elections.ElectionsCandidatePage'])), ('image', wagtail.images.blocks.ImageChooserBlock(help_text='Pokud není vybrán, použije se obrázek ze stránky kandidáta', label='Obrázek', required=False)), ('description', wagtail.blocks.TextBlock(label='Popis'))]), label='Kandidáti'))])), ('program', wagtail.blocks.StructBlock([('categories', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('number', wagtail.blocks.IntegerBlock(label='Číslo')), ('name', wagtail.blocks.CharBlock(label='Název')), ('points', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('number', wagtail.blocks.IntegerBlock(label='Číslo')), ('content', wagtail.blocks.TextBlock(label='Obsah'))]), label='Body'))]), label='Kategorie')), ('long_version_url', wagtail.blocks.URLBlock(label='Odkaz na celou verzi programu')), ('long_version_text', wagtail.blocks.CharBlock(label='Nadpis odkazu na celou verzi programu'))])), ('news', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(help_text='Nejnovější články se načtou automaticky', label='Titulek')), ('description', wagtail.blocks.TextBlock(label='Popis'))], template='styleguide2/includes/organisms/articles/elections/articles_section.html'))], blank=True, use_json_field=True, verbose_name='Hlavní obsah'),
),
]
......@@ -5,7 +5,7 @@ from django.core.paginator import Paginator
from django.db import models
from django.forms.models import model_to_dict
from django.http import HttpResponseRedirect, JsonResponse
from django.shortcuts import render
from django.shortcuts import redirect, render
from django.utils import timezone
from modelcluster.contrib.taggit import ClusterTaggableManager
from modelcluster.fields import ParentalKey
......@@ -120,6 +120,9 @@ class ElectionsArticlesPage(MainArticlesPageMixin):
parent_page_types = ["elections.ElectionsHomePage"]
subpage_types = ["elections.ElectionsArticlePage"]
def serve(self, request, *args, **kwargs):
return redirect(self.root_page.url)
class ElectionsArticleTag(TaggedItemBase):
content_object = ParentalKey(
......
{% extends "styleguide2/article_page.html" %}
{% load wagtailcore_tags %}
{% block content %}
{% include 'styleguide2/includes/organisms/layout/elections/navbar.html' with selected_item=page.root_page.articles_page.get_menu_title %}
{% include 'styleguide2/includes/organisms/header/elections/article_header.html' with title=page.title description=page.perex tags=page.tags.names first_nav_text=page.root_page.articles_page.title first_nav_link=page.root_page.articles_page.url second_nav_text=page.date %}
<main role="main" class="mb-10 xl:mb-32">
<div class="container--wide flex flex-col">
{% if page.shared_from %}
<p>
<em>
Tento článek byl sdílen z jiného webu.
Originál si můžete přečíst <a href="{{ page.get_original_url }}">zde</a>.
</em>
</p>
{% endif %}
{% for block in page.content %}
{% include_block block %}
{% endfor %}
<div class="flex justify-start">
{% include 'styleguide2/includes/atoms/buttons/round_button.html' with url=page.root_page.articles_page.url button_text='Zpět na aktuality' %}
</div>
</div>
</main>
{% include 'styleguide2/includes/organisms/main_section/newsletter_section.html' %}
{% endblock %}
{% extends "styleguide2/articles_page.html" %}
{% block content %}
{% include 'styleguide2/includes/organisms/layout/elections/navbar.html' with selected_item=page.get_menu_title %}
{% include 'styleguide2/includes/organisms/header/elections/articles_header.html' with title=page.title tags=tags %}
<main role="main">
{% include 'styleguide2/includes/organisms/articles/main_articles_timeline.html' %}
</main>
{% include 'styleguide2/includes/organisms/main_section/newsletter_section.html' %}
{% endblock %}
{% extends "styleguide2/search_page.html" %}
{% block content %}
{% include 'styleguide2/includes/organisms/layout/elections/navbar.html' %}
{% include 'styleguide2/includes/organisms/header/elections/simple_header.html' with title=page.title %}
<main role="main" class="mb-10 xl:mb-32">
<div class="container--wide mb-2 lg:mb-12">
{% include 'styleguide2/includes/organisms/search/search_results.html' %}
</div>
</main>
{% endblock %}
# Generated by Django 4.1.10 on 2024-01-06 06:27
from django.db import migrations
import main.blocks
import wagtail.blocks
import wagtail.fields
import wagtail.images.blocks
class Migration(migrations.Migration):
dependencies = [
('main', '0067_alter_mainarticletag_content_object'),
]
operations = [
migrations.AlterField(
model_name='mainhomepage',
name='content',
field=wagtail.fields.StreamField([('carousel', wagtail.blocks.StructBlock([('desktop_line_1', wagtail.blocks.TextBlock(label='Desktop první řádek')), ('desktop_line_2', wagtail.blocks.TextBlock(label='Desktop druhý řádek')), ('mobile_line_1', wagtail.blocks.TextBlock(label='První mobilní řádek')), ('mobile_line_2', wagtail.blocks.TextBlock(label='Druhý mobilní řádek')), ('mobile_line_3', wagtail.blocks.TextBlock(label='Třetí mobilní řádek'))])), ('news', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(help_text='Nejnovější články se načtou automaticky', label='Titulek')), ('description', wagtail.blocks.TextBlock(label='Popis'))], template='styleguide2/includes/organisms/articles/articles_section.html')), ('europarl_news', wagtail.blocks.StructBlock([])), ('people', wagtail.blocks.StructBlock([('title_line_1', wagtail.blocks.CharBlock(label='První řádek titulku')), ('title_line_2', wagtail.blocks.CharBlock(label='Druhý řádek titulku')), ('description', wagtail.blocks.TextBlock(label='Popis')), ('list', wagtail.blocks.ListBlock(main.blocks.BoxBlock, label='Boxíky'))])), ('regions', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(help_text='Články pro regiony se načtou automaticky', label='Titulek'))])), ('boxes', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(label='Nadpis')), ('list', wagtail.blocks.ListBlock(main.blocks.BoxBlock, label='Boxíky')), ('image', wagtail.images.blocks.ImageChooserBlock(label='Obrázek pozadí', required=False))]))], blank=True, use_json_field=True, verbose_name='Hlavní obsah'),
),
]
This diff is collapsed.
This diff is collapsed.
......@@ -7,7 +7,7 @@
{% include 'styleguide2/includes/organisms/header/articles_header.html' with title=page.title tags=tags %}
<main role="main">
{% include 'styleguide2/includes/organisms/articles/main_articles_timeline.html' with article_timeline_list=article_timeline_list %}
{% include 'styleguide2/includes/organisms/articles/main_articles_timeline.html' %}
</main>
{% include 'styleguide2/includes/organisms/main_section/newsletter_section.html' %}
......
<div class="flex gap-3 text-grey-185 {{ classes }}">
<div
class="
{% block classes %}
flex gap-3 text-grey-185 {{ classes }}
{% endblock %}
"
>
{% if first_link %}
<a href="{{ first_link }}" class="underline">
{{ first_text }}
......
<a
href="{% if tags_are_selectable %}?tag_id={{ id }}{% endif %}"
class="text px-4 py-2 text-black bg-yellow-500 duration-200 hover:bg-yellow-600 hover:no-underline"
class="
{% if color_classes %}
{{ color_classes }}
{% else %}
text-black bg-yellow-500 hover:bg-yellow-600
{% endif %}
px-4 py-2 duration-200 hover:no-underline
"
style="
{% if filtered_tag and filtered_tag.id == id %}
background:white!important;
......
......@@ -11,7 +11,7 @@
draggable="false"
>
<div class="europarl--header-carousel--text-wrapper">
<div class="elections--header-carousel--text-wrapper">
<div
class="container--wide h-full flex flex-col justify-end items-start"
>
......
<div class="flex gap-2 flex-wrap max-w-[550px] {{ classes }}">
{% for tag in tags %}
{% include 'styleguide2/includes/atoms/tags/tag.html' with text=tag id=tag.id %}
{% include 'styleguide2/includes/atoms/tags/tag.html' with text=tag id=tag.id color_classes=tag_color_classes%}
{% endfor %}
</div>
......
......@@ -5,14 +5,12 @@
id="kandidati"
>
{% for candidate in self.candidates %}
{% firstof candidate.description candidate.page.perex as description %}
{% if candidate.image %}
{% image candidate.image original as resized_candidate_image %}
{% else %}
{% image candidate.page.image original as resized_candidate_image %}
{% endif %}
{% include "styleguide2/includes/molecules/candidates/elections/candidate_primary_box.html" with name=candidate.page.title position=candidate.page.position description=description url=candidate.page.url candidate_image=resized_candidate_image %}
{% include "styleguide2/includes/molecules/candidates/elections/candidate_primary_box.html" with name=candidate.page.title position=candidate.page.position description=candidate.description url=candidate.page.url candidate_image=resized_candidate_image %}
{% endfor %}
</ul>
......@@ -11,14 +11,22 @@
{% endblock %}
{% block after_heading %}
{% include 'styleguide2/includes/molecules/tags/tags.html' with classes='mb-4' tag_color_classes='bg-black text-white' %}
{% include 'styleguide2/includes/molecules/tags/tags.html' with classes='mb-4' tags_are_selectable=True %}
<div class="flex justify-start">
<form
class="flex justify-start"
method="get"
>
<input
type="text"
id="articles_search"
name="q"
{% if search_query %}
value="{{ search_query }}"
{% endif %}
class="max-w-md w-full bg-grey-180 px-4 py-2 text-black"
placeholder="Hledej..."
>
</div>
</form>
{% endblock %}
......@@ -16,7 +16,7 @@
{% for switch in ui_switch_iterable %}
<a
@click="toggleView('view{{ forloop.counter }}')"
class="switch__item--europarl"
class="switch__item--elections"
:class="{'switch__item--active': isCurrentView('view{{ forloop.counter }}')}"
>{{ switch.name }}</a>
{% endfor %}
......
......@@ -46,6 +46,8 @@
xl:pr-0
lg:max-w-screen-lg
{% block description_classes %}{% endblock %}
"
>
{{ description }}
......
......@@ -16,9 +16,9 @@
{% endblock %}
{% block extra_classes %}
navbar--europarl
navbar--elections
{% if is_transparent %}navbar--europarl-transparent{% endif %}
{% if is_transparent %}navbar--elections-transparent{% endif %}
{% endblock %}
{% block observer_script_toggled_class %}navbar--europarl-transparent{% endblock %}
{% block observer_script_toggled_class %}navbar--elections-transparent{% endblock %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment