Skip to content
Snippets Groups Projects
Commit d673f6bc authored by Tomi Valentová's avatar Tomi Valentová
Browse files

add news block

parent 3e8e03d9
Branches
No related tags found
2 merge requests!1047Uniweb redesign,!1045Uniweb redesign, minor district redesign fixes
Showing
with 4 additions and 493 deletions
......@@ -109,15 +109,6 @@ class ElectionsCountdownBlock(StructBlock):
template = "styleguide2/includes/organisms/main_section/district/elections.html"
class CalendarBlock(StructBlock):
title = CharBlock(label="Titulek", required=False)
class Meta:
label = "Kalendář"
icon = "calendar-alt"
template = "styleguide2/includes/organisms/main_section/district/calendar.html"
class NewsletterBlock(StructBlock):
class Meta:
label = "Newsletter banner"
......
......@@ -2,7 +2,7 @@
from django.db import migrations
from district.blocks import CalendarBlock
from shared.blocks import CalendarBlock
def add_calendar_block(apps, schema_editor):
......
......@@ -37,6 +37,7 @@ from shared.blocks import (
ButtonGroupBlock,
CarouselProgramBlock,
ChartBlock,
CalendarBlock,
NewsBlock,
NewsletterSubscriptionBlock,
PeopleOverviewBlock,
......@@ -97,7 +98,7 @@ class DistrictHomePage(CalendarMixin, MainHomePageMixin):
template="styleguide2/includes/organisms/main_section/district/representatives_section.html"
),
),
("calendar_block", blocks.CalendarBlock()),
("calendar_block", CalendarBlock()),
("carousel_program", CarouselProgramBlock()),
("newsletter_block", blocks.NewsletterBlock()),
],
......
{% load wagtailimages_tags %}
<h2 class="head-heavy-sm mb-2">{{ self.title }}</h2>
<div class="content-block">
{% if self.map_image %}
<a href="{{ self.map_link }}">
{% image self.map_image width-1000 as img %}
<img src="{{ img.url }}" alt="{{ img.alt }}" class="h-80 w-full object-cover">
</a>
{% endif %}
<p>{{ self.address | linebreaks }}</p>
{% if self.address_info %}
<p>
<small>{{ self.address_info }}</small>
</p>
{% endif %}
</div>
<ul class="unordered-list">
{% for article in self.articles %}
<li>
<a href="{{ article.url }}" class="underline">
{{ article.title }}
</a>
</li>
{% endfor %}
</ul>
<div class="article-card-list grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 lg:gap-8">
{% for article in self.articles %}
{% include "shared/article_preview.html" with article=article perex_size="h-12" %}
{% endfor %}
</div>
<div class="candidate-card-list grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4">
{% for block in self.candidate_list %}
{% if forloop.counter <= self.candidate_list_big_count %}
{% if block.block_type == 'person_page' %}
{% include "shared/full_candidate_snippet.html" with person_page=block.value %}
{% endif %}
{% if block.block_type == 'person_block' %}
{% include "shared/blocks/full_candidate_snippet_block.html" with block=block.value %}
{% endif %}
{% endif %}
{% endfor %}
{% if self.cta_text %}
<aside class="banner bg-black text-white container-padding--zero sm:container-padding--auto">
<i class="ico--pirati banner__icon"></i>
<div class="banner__body">
<h1 class="head-alt-lg banner__cta">
{{ self.cta_text }}
</h1>
{% if self.cta_button_text and self.cta_link %}
<a href="{{ self.cta_link }}" class="btn btn--white btn--fullwidth mt-8">
<div class="btn__body ">
{{ self.cta_button_text }}
</div>
</a>
{% endif %}
</div>
</aside>
{% endif %}
</div>
<div>
<ui-view-provider :initial="{fullCandidateTable: false}" v-slot="{ isCurrentView, setView }">
<div class="candidate-table pt-8 container-padding--zero lg:container-padding--auto" :class="{'candidate-table--fadeout': !isCurrentView('fullCandidateTable')}">
{% for block in self.candidate_list %}
{# Záměrně neomezuju list přes indexy, ale ifuju, abych si držel counter pro snippet #}
{% if forloop.counter > self.candidate_list_big_count and forloop.counter <= self.candidate_list_shown_count %}
{% if block.block_type == 'person_page' %}
{% include "shared/compact_candidate_snippet.html" with person_page=block.value %}
{% endif %}
{% if block.block_type == 'person_block' %}
{% include "shared/blocks/compact_candidate_snippet_block.html" with block=block.value %}
{% endif %}
{% endif %}
{% endfor %}
<template v-if="isCurrentView('fullCandidateTable')">
{% for block in self.candidate_list %}
{# Záměrně neomezuju list přes indexy, ale ifuju, abych si držel counter pro snippet #}
{% if forloop.counter > self.candidate_list_shown_count %}
{% if block.block_type == 'person_page' %}
{% include "shared/compact_candidate_snippet.html" with person_page=block.value %}
{% endif %}
{% if block.block_type == 'person_block' %}
{% include "shared/blocks/compact_candidate_snippet_block.html" with block=block.value %}
{% endif %}
{% endif %}
{% endfor %}
</template>
</div>
{% if self.candidate_list|length > self.candidate_list_big_count %}
<div class="text-center pt-8" v-if="!isCurrentView('fullCandidateTable')">
<button class="btn btn--icon text-xl btn--black btn--hoveractive" @click="setView('fullCandidateTable', true)">
<div class="btn__body-wrap">
<div class="btn__body ">Zobrazit vše</div>
<div class="btn__icon "><i class="ico--chevron-right"></i></div>
</div>
</button>
</div>
{% endif %}
</ui-view-provider>
</div>
{% load wagtailcore_tags wagtailimages_tags %}
{% image self.image width-356 as img %}
{% firstof self.page.url self.link as target_url %}
<article class="card card--hoveractive">
<a href="{{ target_url }}">
<img src="{{ img.url }}" alt="{{ self.page.title }}" class="w-full h-48 object-cover">
</a>
<div class="card__body p-4">
<h1 class="card-headline mb-2">
<a href="{{ target_url }}">
{{ self.title }}
</a>
</h1>
<div class="card-body-text">
{{ self.text | default_if_none:'' | richtext }}
</div>
</div>
</article>
{% load wagtailcore_tags %}
<div class="mb-8">
{% if self.headline %}
<h1 class="head-heavy-base mb-8">{{ self.headline }}</h1>
{% endif %}
<main>
<div 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 %}
{% endfor %}
</div>
</main>
</div>
{% load wagtailimages_tags %}
<h2 class="head-heavy-sm mb-2">
{{ self.title }}
</h2>
<div class="space-y-4">
{% for contact_details in self.contact_list %}
<div class="grid grid-cols-1 xl:grid-cols-2 gap-4">
{% with contact_details.person as person_page %}
{% image person_page.profile_image fill-256x256 as contact_box_image %}
{% include 'styleguide2/includes/molecules/contact/contact_person_large_box.html' with image=contact_box_image name=person_page.title function=person_page.position %}
{% endwith %}
</div>
{% endfor %}
</div>
{% load wagtailimages_tags %}
<div class="relative hero hero--image p-0 text-center md:text-left">
<picture aria-hidden="true">
{% image self.xxl_banner min-1280x1 as xxl_image %}
{% image self.xl_banner max-1280x2000 as xl_image %}
{% image self.lg_banner max-1024x2000 as lg_image %}
{% image self.md_banner max-768x2000 as md_image %}
{% image self.sm_banner max-640x2000 as sm_image %}
<source media="(min-width:1536px)" srcset="{{ xxl_image.full_url }}">
<source media="(min-width:1280px)" srcset="{{ xl_image.full_url }}">
<source media="(min-width:1024px)" srcset="{{ lg_image.full_url }}">
<source media="(min-width:768px)" srcset="{{ md_image.full_url }}">
<img src="{{ sm_image.full_url }}" width="auto" class="w-full">
</picture>
<div class="absolute h-full w-full md:w-1/2" style="bottom: 0">{# TODO: Update style guide #}
<div class="flex h-full items-end md:items-center justify-center text-center lg:text-left">
<div class="mx-2 mb-10">
<h1 class="head-alt-lg md:head-alt-xl text-shadow-lg max-w-2xl mx-auto lg:mx-0">
{% firstof self.title page.title %}
</h1>
{% if self.subtitle %}
<h2 class="head-xs mt-2 text-shadow-lg">
{{ self.subtitle }}
</h2>
{% endif %}
{% if self.button_link and self.button_text %}
<div class="mt-4 md:mt-8 space-y-4">
<div class="w-100">
<a href="{{ self.button_link }}" class="btn btn--white btn--hoveractive text-base btn--fullwidth md:btn--autowidth">
<div class="btn__body ">{{ self.button_text }}</div>
</a>
</div>
</div>
{% endif %}
</div>
</div>
</div>
</div>
{% load wagtailimages_tags %}
<header class="hero py-8 lg:py-16">
<div class="container container--default grid md:grid-cols-7 md:grid-rows-3 gap-2 items-center text-center md:text-left">
<div class="md:col-span-3 md:row-span-2 order-2 md:order-1">
<h1 class="head-alt-lg lg:head-alt-xl">{% firstof self.title page.title %}</h1>
</div>
<div class="md:row-span-1 md:col-span-3 order-3">
<div class="mt-4 md:mt-8 space-y-4 ">
{% if self.button_link and self.button_text %}
<a href="{{ self.button_link }}" class="btn btn--icon btn--hoveractive btn--fullwidth sm:btn--autowidth text-lg">
<div class="btn__body-wrap">
<div class="btn__body ">{{ self.button_text }}</div>
<div class="btn__icon ">
<i class="ico--chevron-right"></i>
</div>
</div>
</a>
{% endif %}
</div>
</div>
<div class="md:col-span-4 order-1 md:order-2 md:row-span-3">
{% image self.image width-572 as img %}
<img src="{{ img.url }}" alt="" class="object-contain h-32 md:h-64 lg:h-80 m-auto block">
</div>
</div>
</header>
{% load wagtailimages_tags %}
{% image self.image fill-1920x620 as img %}
<header class="hero hero--image hero--condensed" style="--image-url: url({{ img.full_url }})"
>
<div class="container container--default">
{% if self.title %}
<h1 class="head-alt-lg md:head-alt-xl text-shadow-lg max-w-2xl ">
{{ self.title }}
</h1>
{% endif %}
{% if self.subtitle %}
<h2 class="head-xs mt-2 text-shadow-lg">
{{ self.subtitle }}
</h2>
{% endif %}
</div>
</header>
{% load static %}
<section class="topic">
<label>{{ self.name }}</label>
<svg>
<use xlink:href="{% static 'district/svg/theme-icons/' %}{{ self.icon }}.svg#icon"></use>
</svg>
<div style="display:none" aria-hidden="true" class="block-topic-content">
<div class="program-header-wrapper">
<h2>{{ self.heading }}</h2>
{{ self.description }}
</div>
{% for item in self.program_items %}
<div class="program-point-wrapper">
<div class="program-point-content-wrapper">
{{ item.content }}
</div>
<div class="program-point-button-wrapper">
<svg class="program-point-share" title="Sdílet">
<use xlink:href="{% static 'district/svg/share.svg#icon' %}"></use>
</svg>
</div>
</div>
{% endfor %}
</div>
</section>
<section>
<h2 class="head-heavy-base mb-4">
{{ self.group_title }}
</h2>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 row-gap-8 col-gap-8">
{% for person_details in self.person_list %}
{% with person_details.person as person_page %}
{% include "shared/person_badge_snippet.html" with title=person_details.position|default:person_page.job %}
{% endwith %}
{% endfor %}
</div>
</section>
{% load wagtailimages_tags %}
<div class="grid grid-cols-1 xl:grid-cols-2 gap-4 mt-4 mb-4">
{% with self.person.specific as person_page %}
{% image person_page.profile_image fill-256x256 as contact_box_image %}
{% firstof self.caption person_page.position as function %}
{% include 'styleguide2/includes/molecules/contact/contact_person_large_box.html' with image=contact_box_image name=person_page.title function=function %}
{% endwith %}
</div>
<article class="mt-8">
<div class="lg:flex lg:space-x-16">
<div class="lg:w-3/5">
<h2 class="head-heavy-sm mb-2 lg:mb-4">
{{ self.headline }}
</h2>
<div itemprop="description" class="w-full content-block">
<p>
{{ self.perex }}
</p>
</div>
</div>
<div class="pt-8 w-100 lg:w-2/5 md:pt-0">
<div class="card">
<div class="card__body">
{% with self.person.person as person_page %}
{% include "shared/person_badge_snippet.html" with title=self.person.position|default:person_page.job %}
{% endwith %}
<div class="content-block">
<div class="space-y-4 mt-8">
<div>
{% if self.redmine_issue %}
<a href="https://redmine.pirati.cz/issues/{{ self.redmine_issue }}" class="contact-line icon-link content-block--nostyle">
<i class="ico--info"></i>
<span>Plnění programu: {{ self.completion_percentage | default_if_none:'' }}%</span>
</a>
{% else %}
<span class="contact-line content-block--nostyle">
<i class="ico--info"></i>
<span>Plnění programu: {{ self.completion_percentage | default_if_none:'' }}%</span>
</span>
{% endif %}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="mt-4">
<table class="table table--striped table--bordered w-full">
<thead>
<tr>
<td>Název</td>
<td>Stav plnění</td>
</tr>
</thead>
<tbody>
{% for item in self.program_items %}
<tr>
<td>
{% if item.issue_link %}
<a href="{{ item.issue_link }}" target="_blank">
{{ item.title | default_if_none:'' }}
</a>
{% else %}
<span>
{{ item.title | default_if_none:'' }}
</span>
{% endif %}
</td>
<td>{{ item.completion_percentage | default_if_none:'' }} %</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</article>
......@@ -10,48 +10,4 @@
{% include_block block %}
{% endfor %}
</main>
{% comment %}{% if page.content %}
<div class="mb-8 lg:mb-24">
{% for block in page.content %}
{% include_block block %}
{% endfor %}
</div>
{% endif %}{% endcomment %}
{% comment %} {% if page.articles %}
<h2 class="clear-both head-alt-md md:head-alt-lg pb-4 lg:pb-8">
{{ page.articles_title }}
</h2>
<!-- list of articles -->
<div class="article-card-list grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 lg:gap-8">
{% for a in page.articles %}
{% include "shared/article_preview.html" with article=a %}
{% endfor %}
</div>
<div class="mb-8 lg:mb-24">
{% include "shared/more_articles_snippet.html" %}
</div>
{% endif %}
{% if page.election_countdown_datetime %}
<section class="my-8 lg:my-24 container-padding--zero lg:container-padding--auto">
{% include "shared/election_countdown_snippet.html" %}
</section>
{% endif %}
{% if page.show_calendar_on_hp %}
<section class="my-8 lg:my-24 container-padding--zero lg:container-padding--auto">
{% include "shared/calendar_current_events_snippet.html" with calendar=page.calendar %}
</section>
{% endif %}
{% if page.newsletter_info %}
<section class="my-8 lg:my-24 container-padding--zero lg:container-padding--auto">
{% include "shared/blocks/newsletter_subscription_block.html" with value=page.newsletter_info %}
</section>
{% endif%}
{% include "shared/followus_snippet.html" %}{% endcomment %}
{% endblock %}
{% load wagtailcore_tags %}
<div class="content-block">
{% if page.root_election_page.campaigns|length > 1 %}
<h3>{{ page.campaign_page.title }}</h3>
{% endif %}
<ul class="unordered-list unordered-list--linked">
{% for program_page in page.campaign_page.program_points %}
<li>
<a href="{% pageurl program_page %}" class="{% if program_page.id == page.id %}font-bold {% endif %}content-block--nostyle">
{{ program_page.title }}
</a>
</li>
{% endfor %}
</ul>
<a href="{% pageurl page.campaign_page %}?view=candidates" class="btn btn--icon btn--grey-125 text-sm btn--hoveractive btn--fullwidth md:btn--autowidth content-block--nostyle">
<div class="btn__body-wrap">
<div class="btn__body ">Kandidátní listina</div>
<div class="btn__icon ">
<i class="ico--chevron-right"></i>
</div>
</div>
</a>
{% if page.campaign_page.post_election_strategy %}
<hr>
<h3>{{ page.campaign_page.post_election_strategy.title }}</h3>
<p>Přečtěte si, jak se zachováme po volbách. Nemusíte volit zajíce v pytli.</p>
<a href="{% pageurl page.campaign_page.post_election_strategy %}" class="btn btn--icon btn--grey-125 text-sm btn--hoveractive btn--fullwidth md:btn--autowidth content-block--nostyle">
<div class="btn__body-wrap">
<div class="btn__body ">Zjistit víc</div>
<div class="btn__icon ">
<i class="ico--chevron-right"></i>
</div>
</div>
</a>
{% endif %}
{% if page.root_election_page.campaigns|length > 1 %}
<hr />
<h3>Další</h3>
<ul class="unordered-list unordered-list--linked">
{% for campaign in page.root_election_page.campaigns %}
{% if campaign.id != page.campaign_page.id %}
<li>
<a href="{% pageurl campaign %}" class="content-block--nostyle">
{{ campaign.title }}
</a>
</li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
<hr>
<h3>Financování kampaně</h3>
<p>Transparentní financování kampaně je pro nás samozřejmost.</p>
<a href="{% firstof page.campaign_funding_info page.campaign_page.campaign_funding_info 'https://wiki.pirati.cz/ft/start' %}" class="btn btn--icon btn--grey-125 text-sm btn--hoveractive btn--fullwidth md:btn--autowidth content-block--nostyle">
<div class="btn__body-wrap">
<div class="btn__body ">Zjistit víc</div>
<div class="btn__icon ">
<i class="ico--chevron-right"></i>
</div>
</div>
</a>
</div>
......@@ -7,3 +7,4 @@ from .programs import * # noqa
from .struct import * # noqa
from .text import * # noqa
from .video import * # noqa
from .calendar import * # noqa
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment