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

WIP - begin uniweb redesign

parent 8348f0ee
Branches
No related tags found
2 merge requests!1047Uniweb redesign,!1045Uniweb redesign, minor district redesign fixes
Pipeline #18717 passed
Showing
with 500 additions and 513 deletions
......@@ -15,7 +15,7 @@ from shared.models import (
)
from shared.utils import subscribe_to_newsletter
from tuning import admin_help
from uniweb.constants import RICH_TEXT_FEATURES
from shared.const import RICH_TEXT_DEFAULT_FEATURES
class CzechInspirationalHomePage(
......@@ -166,9 +166,9 @@ class CzechInspirationalChapterPage(
### FIELDS
number = models.IntegerField("číslo kapitoly", default=0)
text = RichTextField("text", blank=True, features=RICH_TEXT_FEATURES)
text = RichTextField("text", blank=True, features=RICH_TEXT_DEFAULT_FEATURES)
extra_text = RichTextField(
"extra modrý blok", blank=True, features=RICH_TEXT_FEATURES
"extra modrý blok", blank=True, features=RICH_TEXT_DEFAULT_FEATURES
)
author = models.CharField("autor", max_length=250, blank=True, null=True)
image = models.ForeignKey(
......
......
......@@ -61,7 +61,7 @@ from . import blocks
from .forms import JekyllImportForm
CONTENT_BLOCKS = DEFAULT_CONTENT_BLOCKS + [
("chart", ChartBlock(template="district/blocks/chart.html")),
("chart", ChartBlock()),
("related", blocks.ArticlesBlock()),
("related_links", blocks.ArticleLinksBlock()),
]
......
......
{% load wagtailcore_tags %}
{% load static %}
<script src="{% static "shared/vendor/chart.js/chart.umd.4.2.0.js" %}"></script>
<div class="py-4">
<canvas
class="lg:h-120 lg:w-auto w-full mx-auto"
id="{{ block.id }}"
></canvas>
</div>
{% include "shared/chart_script_snippet.html" with value=value block_id=block.id %}
{% extends "district/base.html" %}
{% load wagtailcore_tags wagtailimages_tags shared_filters %}
{% block subheader %}
{% if page.hero_image %}
{% image page.hero_image fill-1920x800-c75 jpegquality-80 as bg_img %}
{% else %}
{% image page.root_page.fallback_image fill-1920x800-c75 jpegquality-80 as bg_img %}
{% endif %}
<header class="hero hero--image text-center md:text-left {% if page.root_election_page.campaigns|length > 1 %}pb-0 pt-16{% else %}py-16{% endif %}" style="--image-url: url({{ bg_img.full_url }})">
<div class="container container--default grid lg:grid-cols-7 gap-4 items-center text-center lg:text-left">
<div class="lg:col-span-3 order-2 lg:order-1">
{% if page.number %}
<div class="flag bg-violet-400 text-white head-alt-base mb-6">
Volte č. {{ page.number }}
</div>
{% endif %}
{% if page.hero_headline %}
<h2 class="head-xs md:head-base text-shadow-lg mb-2">
{{ page.root_election_page.title }}
</h2>
<h1 class="head-alt-lg md:head-alt-xl text-shadow-lg">
{{ page.hero_headline|default:page.title }}
</h1>
{% else %}
<h1 class="head-alt-lg md:head-alt-xl text-shadow-lg">
{{ page.root_election_page.title }}
</h1>
{% endif %}
{% if page.hero_motto %}
<h2 class="head-xs text-shadow-lg mt-2">
{{ page.hero_motto }}
</h2>
{% endif %}
<div class="mt-4 md:mt-8 space-y-4">
{% for block in page.hero_cta_buttons %}
{% include_block block with block_id=block.id %}
{% endfor %}
</div>
</div>
<div class="lg:col-span-4 order-1 lg:order-2">
{% if page.hero_candidates_image %}
{% image page.hero_candidates_image width-490 as candidates_img %}
<img src="{{ candidates_img.url }}" class="h-32 lg:h-80 m-auto object-contain" alt="Kandidáti">
{% endif %}
</div>
</div>
{% if page.root_election_page.campaigns|length > 1 %}
<div class="container container--default text-white pb-16">
<hr class="hr--big opacity-25" />
<div class="leading-loose grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 text-shadow-lg text-base md:text-sm">
{% for campaign in page.root_election_page.campaigns %}
<span><a href="{% pageurl campaign %}" class="{% if campaign.pk == page.pk %}font-bold{% endif %}">{{ campaign.title }}</a></span>
{% endfor %}
</div>
</div>
{% endif %}
</header>
{% endblock subheader %}
{% block container %}
<div class="__js-root">
<ui-view-provider
:initial="{candidates: true, program: false}" :sync-location="true" v-slot="{ isCurrentView, toggleView }"
>
<div class="container container--default pt-8 lg:py-24 space-y-8 lg:space-y-16">
{% if page.content %}
<section class="space-y-8">
{% for block in page.content %}
{% include_block block %}
{% endfor %}
</section>
{% endif %}
<section>
{% if page.program_points %}
<div class="text-center">
<div class="switch">
<a
@click="toggleView('candidates')"
class="switch__item"
:class="{'switch__item--active': isCurrentView('candidates')}"
>
Kandidáti
</a>
<a
@click="toggleView('program')"
class="switch__item"
:class="{'switch__item--active': isCurrentView('program')}"
>
Program
</a>
</div>
</div>
{% endif %}
<template v-if="isCurrentView('candidates')">
<h1 class="head-alt-md text-center py-8 lg:pt-24 lg:pb-8">{{ page.candidate_list_title|default:"Kandidátní listina" }}</h1>
{% for block in self.candidates %}
{% include_block block %}
{% endfor %}
</template>
{% if page.program_points %}
<template v-if="isCurrentView('program')">
<h1
class="head-alt-md text-center py-8 lg:pt-24 {% if not page.show_program_points_inline %}lg:pb-8{% else %}pb-0{% endif %}"
>{{ page.program_point_list_title|default:"Volební program" }}</h1>
{% if page.show_program_points_inline %}
{% for program_point in page.program_points %}
<h2 class="head-alt-md mb-2 mt-8">
{{ program_point.title }}
</h2>
<p
class="font-bold text-lg leading-normal {% if program_point.guarantor is not none %}mb-3{% else %}mb-5{% endif %}"
>
{{ program_point.perex }}
</p>
{% if program_point.guarantor is not none %}
<p class="mb-5 text-grey-300">
Garant:
<a
href="{{ program_point.guarantor.url }}"
>{{ program_point.guarantor }}</a>
</p>
{% endif %}
{% for block in program_point.content %}
{% include_block block %}
{% endfor %}
{% endfor %}
{% else %}
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
{% for program_point in page.program_points %}
<div class="card card--hoveractive">
<a href="{% pageurl program_point %}">
{% image program_point.image width-357 as list_image %}
<img src="{{ list_image.url }}" alt="{{ program_point.title }}" class="w-full h-48 object-cover">
</a>
<div class="card__body p-4">
<h1 class="card-headline mb-2">
<a href="{% pageurl program_point %}">
{{ program_point.title }}
</a>
</h1>
<p class="card-body-text">
{{ program_point.perex }}
</p>
</div>
</div>
{% endfor %}
</div>
{% endif %}
</template>
{% endif %}
</section>
<section class="flex flex-col lg:flex-row lg:space-x-8">
{% if page.post_election_strategy %}
<a
href="{{ page.post_election_strategy.url }}"
class="super-button bg-grey-125 text-black lg:w-full container-padding--zero lg:container-padding--auto"
>
<span class="super-button__body">Povolební strategie</span>
<i class="super-button__icon ico--strategy"></i>
</a>
{% endif %}
<a
href="{% firstof page.campaign_funding_info page.campaign_page.campaign_funding_info 'https://wiki.pirati.cz/ft/start' %}"
class="super-button bg-black text-white lg:w-full container-padding--zero lg:container-padding--auto"
>
<span class="super-button__body">Financování kampaně</span>
<i class="super-button__icon ico--calculator"></i>
</a>
</section>
</div>
</ui-view-provider>
</div>
{% endblock %}
{% extends "district/base.html" %}
{% load wagtailcore_tags wagtailimages_tags shared_filters %}
{% block content %}
<div class="lg:flex lg:space-x-8 xl:space-x-16">
<section
{% if page.guarantor is not none %}
class="lg:w-3/5 xl:w-2/3"
{% endif %}
>
<h1 class="head-alt-md md:head-alt-lg max-w-5xl mb-4">
{{ page.title }}
</h1>
<p class="font-bold text-lg leading-normal mb-8">
{{ page.perex }}
</p>
{% for block in page.content %}
{% include_block block with block_id=block.id %}
{% endfor %}
</section>
{% if page.guarantor is not none %}
<section class="pt-8 lg:w-2/5 xl:w-1/3 lg:pt-0">
<div class="lg:card lg:elevation-10">
<div class="lg:card__body">
<h2 class="head-heavy-sm mb-4"><a href="{% pageurl page.root_election_page %}">{{ page.root_election_page.title }}</a></h2>
{% include "shared/person_badge_snippet.html" with person_page=page.guarantor title="Garant bodu" %}
<hr />
{% include "district/includes/election_subpage_sidebar_content.html" %}
</div>
</div>
</section>
{% endif %}
</div>
{% endblock content %}
{% extends "district/base.html" %}
{% load wagtailcore_tags wagtailimages_tags shared_filters static %}
{% block styles %}
<link
rel="stylesheet"
href="{% static 'district/fonts/bebas-neue/style.css' %}"
>
<link
rel="stylesheet"
href="{% static 'district/css/jquery.modal.css' %}"
>
<link
rel="stylesheet"
href="{% static 'district/css/mast-share.css' %}"
>
<link
rel="stylesheet"
href="{% static 'district/css/custom.css' %}"
>
<script
type="text/javascript"
src="{% static 'district/js/jquery-3.1.0.min.js' %}"
></script>
<script
type="text/javascript"
src="{% static 'district/js/mast-share.js' %}"
></script>
<script
type="text/javascript"
src="{% static 'district/js/js.cookie.min.js' %}"
></script>
{% endblock %}
{% block content %}
<div class="lg:flex lg:mt-8 space-y-16 lg:space-y-0 lg:space-x-8 xl:space-x-16 mb-5">
<section id="content">
<header>
<h1 itemprop="headline" class="head-alt-md md:head-alt-lg max-w-5xl mb-8">
{{ page.title }}
</h1>
</header>
<p>
{{ page.perex }}
</p>
<noscript>
<section id="no-js-program">
<br>
<small>I bez JavaScriptu máme program! :)</small>
<br>
{% for block in page.content %}
<h2>{{ block.value.name }}</h2>
<p>{{ block.value.description }}</p>
{% for item in block.value.program_items %}
{{ item.content }}
{% endfor %}
{% endfor %}
</section>
</noscript>
<section class="main-wrapper" id="js-program" style="display:none">
<div class="content-wrapper">
<section class="topic-wrapper">
{% for block in page.content %}
{% include_block block %}
{% endfor %}
</section>
<section class="topic-content-wrapper"></section>
</div>
</section>
<section class="buttons-wrapper">
<a
class="bottom-button"
id="button-odebirej-novinky"
href="https://nalodeni.pirati.cz/news/all/"
>Odebírej<br>Novinky</a>
<a
class="bottom-button"
id="button-pridej-se-k-nam"
href="https://nalodeni.pirati.cz/"
>Přidej se<br>k nám!</a>
<a
class="bottom-button"
id="button-prihod-do-truhly"
href="https://dary.pirati.cz/"
>Přihoď<br>do truhly</a>
</section>
</section>
</div>
<section id="share-form" class="modal">
<h2>Sdílení je aktem lásky.</h2>
<textarea id="share-text" rows="5"></textarea>
<section class="share-icon-wrapper">
<div class="mast-share mast-share-sm share-icon">
<input type="checkbox" class="mast-check-toggle">
<div class="mast-instance">
<span>Instance: </span>
<input type="textbox" name="mast-instance-input" placeholder="mastodon.social">
<button class="mast-share-button">Sdílet</button>
</div>
<label class="mast-top mast-check-label">
<img
src="{% static 'district/svg/share-icons/mastodon-brands.svg' %}"
alt="Sdílet na Mastodonu"
height="40"
width="40"
>
</label>
</div>
<a
id="share-diaspora"
class="share-icon"
href="#"
rel="nofollow noopener noreferrer"
><img
src="{% static 'district/svg/share-icons/diaspora-brands.svg' %}"
alt="Sdílet na Diaspoře"
height="40"
width="40"
></a>
<a
id="share-twitter"
class="share-icon"
href="#"
rel="nofollow noopener noreferrer"
><img
src="{% static 'district/svg/share-icons/twitter-square-brands.svg' %}"
alt="Sdílet na Twitteru"
height="40"
width="40"
></a>
<a
id="share-facebook"
class="share-icon"
href="#"
rel="nofollow noopener noreferrer"
><img
src="{% static 'district/svg/share-icons/facebook-square-brands.svg' %}"
alt="Sdílet na Facebooku"
height="40"
width="40"
></a>
</section>
</section>
<script
type="text/javascript"
src="{% static 'district/js/ui.js' %}"
></script>
{% endblock %}
{% extends "district/base.html" %}
{% load wagtailcore_tags wagtailimages_tags shared_filters %}
{% block content %}
<div class="lg:flex lg:space-x-8 xl:space-x-16">
<section class="lg:w-3/5 xl:w-2/3">
<h1 class="head-alt-md md:head-alt-lg max-w-5xl mb-4">
{{ page.title }}
</h1>
<p class="font-bold text-lg leading-normal mb-8">
{{ page.perex }}
</p>
{% for block in page.content %}
{% include_block block %}
{% endfor %}
</section>
<section class="pt-8 lg:w-2/5 xl:w-1/3 lg:pt-0">
<div class="lg:card lg:elevation-10">
<div class="lg:card__body">
<h2 class="head-heavy-sm mb-4"><a href="{% pageurl page.root_election_page %}">{{ page.root_election_page.title }}</a></h2>
{% include "district/includes/election_subpage_sidebar_content.html" %}
</div>
</div>
</section>
</div>
{% endblock content %}
......@@ -1025,7 +1025,7 @@ class ChartBlock(blocks.StructBlock):
return context
class Meta:
# template = ""
template = "styleguide2/includes/molecules/blocks/chart.html"
label = "Graf"
icon = "form"
help_text = """Všechny položky zdrojů dat se chovají jako sloupce.
......@@ -1062,7 +1062,7 @@ class NewsletterSubscriptionBlock(blocks.StructBlock):
class Meta:
label = "Formulář pro odebírání newsletteru"
icon = "form"
template = "shared/blocks/newsletter_subscription_block.html"
template = "styleguide2/includes/organisms/main_section/newsletter_section.html"
DEFAULT_CONTENT_BLOCKS = [
......
......
{% load table_block_tags shared_filters %}
<div class="my-6 prose"
style="max-width: unset">
<table
class="max-w-prose"
style="
{% comment %}TODO{% endcomment %}
{% if self.alignment == "left" %}
{% elif alignment == "center" %}
margin-left: auto;
margin-right: auto;
{% elif alignment == "right" %}
margin-left: auto;
{% elif alignment == "full" %}
width: 100%;
{% endif %}
"
>
{% if table.table_caption %}
<caption class="head-heavy-sm my-4">{{ table.table_caption }}</caption>
{% endif %}
{% if table_header %}
<thead>
<tr>
{% for column in table_header %}
{% with forloop.counter0 as col_index %}
<th scope="col" {% cell_classname 0 col_index %}>
{% if column.strip %}
{{ column.strip|markdown }}
{% endif %}
</th>
{% endwith %}
{% endfor %}
</tr>
</thead>
{% endif %}
<tbody>
{% for row in table.data %}
{% with forloop.counter0 as row_index %}
<tr>
{% for column in row %}
{% with forloop.counter0 as col_index %}
{% if table.first_col_is_header and forloop.first %}
<th scope="row" {% cell_classname row_index col_index table_header %}>
{% if column.strip %}
{{ column.strip|markdown }}
{% endif %}
</th>
{% else %}
<td {% cell_classname row_index col_index table_header %}>
{% if column.strip %}
{{ column.strip|markdown }}
{% endif %}
</td>
{% endif %}
{% endwith %}
{% endfor %}
</tr>
{% endwith %}
{% endfor %}
</tbody>
</table>
</div>
\ No newline at end of file
{% load wagtailcore_tags %}
{% load static %}
<script src="{% static "shared/vendor/chart.js/chart.umd.4.2.0.js" %}"></script>
<div class="py-4">
<canvas
class="lg:h-120 lg:w-auto w-full mx-auto"
id="{{ block.id }}"
></canvas>
</div>
<script>
window.addEventListener(
"load",
() => {
const getRandomInt = (max) => {
return Math.floor(Math.random() * Math.floor(max));
}
const chartType = "{{ value.chart_type }}";
let colorOrder = getRandomInt(6);
const colors = [
"rgba(255, 99, 132, 0.6)",
"rgba(54, 162, 235, 0.6)",
"rgba(255, 206, 86, 0.6)",
"rgba(75, 192, 192, 0.6)",
"rgba(153, 102, 255, 0.6)",
"rgba(255, 159, 64, 0.6)",
"rgba(75, 192, 192, 0.6)",
"rgba(153, 102, 255, 0.6)",
];
const getColor = () => {
if (colorOrder === colors.length) {
colorOrder = 0;
}
return colors[colorOrder++];
}
const getDatasets = () => {
const datasets = {{ value.datasets|safe }};
let finalDatasets = [];
for (let i = 0; i < datasets.length; i++) {
let tempDataset = {};
tempDataset["label"] = datasets[i]["label"];
tempDataset["data"] = datasets[i]["data"];
if (chartType == "pie" || chartType == "doughnut" || datasets.length == 1) {
let backgroundColor = [];
for (let j = 0; j < tempDataset["data"].length; j++)
backgroundColor.push(getColor());
tempDataset["backgroundColor"] = backgroundColor;
} else {
tempDataset["backgroundColor"] = getColor();
}
tempDataset["borderColor"] = getColor();
tempDataset["borderWidth"] = 1;
tempDataset["fill"] = true;
tempDataset["tension"] = 0.3;
finalDatasets.push(tempDataset);
}
return finalDatasets;
};
const ctx = document.getElementById("{{ block.id }}").getContext("2d");
const blockChart = new Chart(
ctx,
{
type: "{% if value.chart_type != "horizontalBar" %}{{ value.chart_type }}{% else %}bar{% endif %}",
data: {
labels: {{ value.labels|safe }},
datasets: getDatasets(),
},
options: {
{% if value.chart_type == "horizontalBar" %}
indexAxis: "y",
{% endif %}
plugins: {
title: {
display: true,
text: "{{ value.title|escapejs }}",
},
},
scales: {
y: {
ticks: {
beginAtZero: true,
},
},
}{% if value.hide_points %},
elements: {
point: {
radius: 0
}
}
{% endif %}
}
}
);
}
);
</script>
\ No newline at end of file
......@@ -48,9 +48,11 @@
{% endfor %}
</div>
{% if page.root_page.search_page %}
<form method="GET" action="{{ page.root_page.search_page.url }}">
{% include 'styleguide2/includes/atoms/form_fields/form_input.html' with placeholder='Hledej' classes='text-black p-3 w-60' name='q' value=global_search_query %}
</form>
{% endif %}
{% block after_desktop_search %}{% endblock %}
</div>
......@@ -187,6 +189,7 @@
"
>
<div class="flex flex-col gap-1.5 items-start">
{% if page.root_page.search_page %}
<form
method="GET"
action="{{ page.root_page.search_page.url }}"
......@@ -194,6 +197,7 @@
>
{% include 'styleguide2/includes/atoms/form_fields/form_input.html' with placeholder='Hledej' classes='text-black px-2 py-1 w-full' name='q' value=global_search_query %}
</form>
{% endif %}
{% if page.root_page.important_item_name %}
{% firstof page.root_page.important_item_page.url page.root_page.important_item_url as target %}
......
......
......@@ -16,7 +16,7 @@
{% for block in page.content %}
{% include_block block %}
{% endfor %}
{% endblock %}
</div>
{% endblock %}
</main>
{% endblock %}
from shared_legacy.const import RICH_TEXT_DEFAULT_FEATURES
RICH_TEXT_FEATURES = RICH_TEXT_DEFAULT_FEATURES
BLACK_ON_WHITE = "black_on_white"
WHITE_ON_BLACK = "white_on_black"
WHITE_ON_BLUE = "white_on_blue"
......
......
# Generated by Django 5.0.6 on 2024-06-18 10:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('uniweb', '0064_alter_uniwebhomepage_top_menu_and_more'),
]
operations = [
migrations.AlterField(
model_name='uniwebhomepage',
name='title_suffix',
field=models.CharField(blank=True, help_text="Umožňuje přidat příponu k základnímu titulku stránky. Pokud je např. titulek stránky pojmenovaný 'Kontakt' a do přípony vyplníte 'MS Pardubice', výsledný titulek bude 'Kontakt | Piráti MS Pardubice'. Pokud příponu nevyplníte, použije se název domovské stránky a text 'Piráti', např. 'Kontakt | Piráti Pardubice'.", max_length=100, null=True, verbose_name='Přípona titulku stránky'),
),
]
This diff is collapsed.
# Generated by Django 5.0.6 on 2024-06-18 11:44
import django.db.models.deletion
import shared.blocks.main
import wagtail.blocks
import wagtail.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('uniweb', '0066_alter_uniwebflexiblepage_content_and_more'),
('wagtailcore', '0093_uploadedfile'),
]
operations = [
migrations.AddField(
model_name='uniwebhomepage',
name='footer_other_links',
field=wagtail.fields.StreamField([('other_links', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(label='Titulek')), ('list', wagtail.blocks.ListBlock(shared.blocks.main.LinkBlock, label='Seznam odkazů'))]))], blank=True, verbose_name='Odkazy v zápatí webu'),
),
migrations.AddField(
model_name='uniwebhomepage',
name='footer_person_list',
field=wagtail.fields.StreamField([], blank=True, verbose_name='Osoby v zápatí webu'),
),
migrations.AddField(
model_name='uniwebhomepage',
name='important_item_name',
field=models.CharField(blank=True, help_text='Pokud není odkazovaná stránka na Majáku, použij možnost zadání samotné adresy níže.', max_length=16, null=True, verbose_name='Jméno'),
),
migrations.AddField(
model_name='uniwebhomepage',
name='important_item_page',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='wagtailcore.page', verbose_name='Stránka'),
),
migrations.AddField(
model_name='uniwebhomepage',
name='important_item_url',
field=models.URLField(blank=True, null=True, verbose_name='Adresa'),
),
migrations.AddField(
model_name='uniwebhomepage',
name='menu',
field=wagtail.fields.StreamField([('menu_item', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(help_text='Pokud není odkazovaná stránka na Majáku, použij možnost zadání samotné adresy níže.', label='Titulek', required=True)), ('page', wagtail.blocks.PageChooserBlock(label='Stránka', required=False)), ('link', wagtail.blocks.URLBlock(label='Odkaz', required=False))])), ('menu_parent', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(label='Titulek', required=True)), ('menu_items', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(help_text='Pokud není odkazovaná stránka na Majáku, použij možnost zadání samotné adresy níže.', label='Titulek', required=True)), ('page', wagtail.blocks.PageChooserBlock(label='Stránka', required=False)), ('link', wagtail.blocks.URLBlock(label='Odkaz', required=False))]), label='Položky menu'))]))], blank=True, verbose_name='Položky'),
),
migrations.AddField(
model_name='uniwebhomepage',
name='menu_button_content',
field=wagtail.fields.StreamField([('navbar_menu_item', wagtail.blocks.StructBlock([('button_link', wagtail.blocks.URLBlock(label='Odkaz tlačítka')), ('button_text', wagtail.blocks.CharBlock(label='Text tlačítka'))]))], blank=True, verbose_name='Obsah menu pro zapojení se'),
),
migrations.AddField(
model_name='uniwebhomepage',
name='menu_button_name',
field=models.CharField(blank=True, max_length=16, null=True, verbose_name='Text na tlačítku pro zapojení'),
),
migrations.AddField(
model_name='uniwebhomepage',
name='social_links',
field=wagtail.fields.StreamField([('social_links', wagtail.blocks.StructBlock([('text', wagtail.blocks.CharBlock(label='Název')), ('link', wagtail.blocks.URLBlock(label='Odkaz')), ('icon', wagtail.blocks.CharBlock(help_text='Seznam ikon - https://styleguide.pirati.cz/latest/?p=viewall-atoms-icons <br/>Název ikony zadejte bez tečky na začátku', label='Ikona'))]))], blank=True, verbose_name='Odkazy na sociální sítě'),
),
]
......@@ -27,9 +27,8 @@ from wagtailmetadata.models import MetadataPageMixin
from calendar_utils.models import CalendarMixin
from shared.models import SharedTaggedUniwebArticle
from shared_legacy.blocks import ChartBlock, FlipCardsBlock, NewsletterSubscriptionBlock
from shared_legacy.const import RICH_TEXT_DEFAULT_FEATURES
from shared_legacy.models import (
from shared_legacy.blocks import FlipCardsBlock
from shared.models import (
ArticleMixin,
ArticlesPageMixin,
ExtendedMetadataHomePageMixin,
......@@ -37,7 +36,15 @@ from shared_legacy.models import (
FooterMixin,
PdfPageMixin,
SubpageMixin,
MainHomePageMixin,
MainMenuMixin,
SocialMixin,
CalendarMixin,
MainSearchPageMixin,
)
from shared.blocks import HeadlineBlock, NewsletterSubscriptionBlock, ChartBlock, GalleryBlock
from shared_legacy.models import FooterMixin as LegacyFooterMixin
from shared.const import RICH_TEXT_DEFAULT_FEATURES
from shared_legacy.utils import make_promote_panels, strip_all_html_tags, trim_to_length
from tuning import admin_help
......@@ -53,7 +60,6 @@ from .constants import (
COLOR_CSS,
FUTURE,
LEFT,
RICH_TEXT_FEATURES,
)
......@@ -88,9 +94,9 @@ class AlignBlock(blocks.StructBlock):
class ColumnsTextBlock(blocks.StructBlock):
left_text = blocks.RichTextBlock(label="levý sloupec", features=RICH_TEXT_FEATURES)
left_text = blocks.RichTextBlock(label="levý sloupec", features=RICH_TEXT_DEFAULT_FEATURES)
right_text = blocks.RichTextBlock(
label="pravý sloupec", features=RICH_TEXT_FEATURES
label="pravý sloupec", features=RICH_TEXT_DEFAULT_FEATURES
)
class Meta:
......@@ -101,9 +107,9 @@ class ColumnsTextBlock(blocks.StructBlock):
class AdvancedColumnsTextBlock(ColorBlock, AlignBlock):
left_text = blocks.RichTextBlock(label="levý sloupec", features=RICH_TEXT_FEATURES)
left_text = blocks.RichTextBlock(label="levý sloupec", features=RICH_TEXT_DEFAULT_FEATURES)
right_text = blocks.RichTextBlock(
label="pravý sloupec", features=RICH_TEXT_FEATURES
label="pravý sloupec", features=RICH_TEXT_DEFAULT_FEATURES
)
class Meta:
......@@ -138,7 +144,7 @@ class PictureTitleBlock(ColorBlock):
class AdvancedTextBlock(ColorBlock, AlignBlock):
text = blocks.RichTextBlock(label="text", features=RICH_TEXT_FEATURES)
text = blocks.RichTextBlock(label="text", features=RICH_TEXT_DEFAULT_FEATURES)
class Meta:
label = "text (pokročilý)"
......@@ -149,7 +155,7 @@ class AdvancedTextBlock(ColorBlock, AlignBlock):
class PictureListBlock(ColorBlock):
items = blocks.ListBlock(
blocks.RichTextBlock(label="odstavec", features=RICH_TEXT_FEATURES),
blocks.RichTextBlock(label="odstavec", features=RICH_TEXT_DEFAULT_FEATURES),
label="odstavce",
)
picture = ImageChooserBlock(
......@@ -273,6 +279,76 @@ class ButtonBlock(blocks.StructBlock):
CONTENT_STREAM_BLOCKS = [
# title, advanced_title
("headline", HeadlineBlock()),
# picture_title
# text
(
"text",
blocks.RichTextBlock(
label="Textový editor",
features=RICH_TEXT_DEFAULT_FEATURES,
template="styleguide2/includes/atoms/text/prose_richtext.html",
),
),
# advanced_text
# text_columns
# advanced_text_columns
# gallery
(
"new_gallery",
GalleryBlock()
),
# picture_list
# aligned_table
(
"aligned_table",
AlignedTableBlock(
group="ostatní",
template="styleguide2/includes/atoms/table/aligned_table.html",
),
),
# table
(
"table",
TableBlock(
label="Tabulka",
group="ostatní",
template="styleguide2/includes/atoms/table/table.html",
),
),
# articles
# calendar_agenda
# button
# chart
("chart", ChartBlock()),
# cards
(
"title",
blocks.CharBlock(
......@@ -283,16 +359,18 @@ CONTENT_STREAM_BLOCKS = [
),
),
("advanced_title", AdvancedTitleBlock()),
("picture_title", PictureTitleBlock()),
(
"text",
blocks.RichTextBlock(
label="text",
features=RICH_TEXT_FEATURES,
group="texty",
template="uniweb/blocks/text.html",
),
),
# (
# "text",
# blocks.RichTextBlock(
# label="Textový editor",
# features=RICH_TEXT_DEFAULT_FEATURES,
# template="styleguide2/includes/atoms/text/prose_richtext.html",
# ),
# ),
("advanced_text", AdvancedTextBlock()),
("text_columns", ColumnsTextBlock()),
("advanced_text_columns", AdvancedColumnsTextBlock()),
......@@ -307,25 +385,9 @@ CONTENT_STREAM_BLOCKS = [
),
),
("picture_list", PictureListBlock()),
(
"aligned_table",
AlignedTableBlock(
group="ostatní",
template="uniweb/blocks/aligned_table.html",
),
),
(
"table",
TableBlock(
label="Tabulka",
group="ostatní",
template="uniweb/blocks/table.html",
),
),
("articles", ArticlesBlock()),
("calendar_agenda", CalendarAgendaBlock()),
("button", ButtonBlock()),
("chart", ChartBlock(template="uniweb/blocks/chart.html")),
("cards", FlipCardsBlock(template="uniweb/blocks/flip_cards.html")),
]
......@@ -338,13 +400,7 @@ class UniwebArticleTag(TaggedItemBase):
)
class UniwebHomePage(
Page,
ExtendedMetadataHomePageMixin,
MetadataPageMixin,
CalendarMixin,
FooterMixin,
):
class UniwebHomePage(CalendarMixin, LegacyFooterMixin, MainHomePageMixin):
### FIELDS
fallback_image = models.ForeignKey(
......@@ -399,6 +455,14 @@ class UniwebHomePage(
help_text="užší stránka je vhodná pro lepší čitelnost textů",
)
### Header
menu_button_name = models.CharField(
verbose_name="Text na tlačítku pro zapojení",
max_length=16,
blank=True,
null=True,
)
### Footer
hide_footer = models.BooleanField(
"skrýt patičku", default=False, help_text="Chcete skrýt patičku?"
......@@ -428,10 +492,6 @@ class UniwebHomePage(
### PANELS
content_panels = Page.content_panels + [FieldPanel("content")]
promote_panels = make_promote_panels(admin_help.build(admin_help.IMPORTANT_TITLE))
settings_panels = [
FieldPanel("logo"),
MultiFieldPanel(
......@@ -441,7 +501,7 @@ class UniwebHomePage(
FieldPanel("narrow_layout"),
FieldPanel("fallback_image"),
],
"nastavení webu",
"Obecné nastavení webu",
),
MultiFieldPanel(
[
......@@ -456,24 +516,28 @@ class UniwebHomePage(
FieldPanel("show_logo"),
FieldPanel("show_social_links"),
FieldPanel("show_pirate_buttons"),
FieldPanel("footer_links"),
FieldPanel("footer_extra_content"),
FieldPanel("donation_page"),
],
"nastavení patičky",
"Patička",
),
]
menu_panels = [FieldPanel("top_menu")]
menu_panels = (
MainMenuMixin.menu_panels
+ SocialMixin.menu_panels
+ [
FieldPanel("menu_button_name"),
FieldPanel("menu_button_content"),
]
)
edit_handler = TabbedInterface(
[
ObjectList(content_panels, heading=gettext_lazy("Content")),
ObjectList(promote_panels, heading=gettext_lazy("Promote")),
ObjectList(
settings_panels, heading=gettext_lazy("Settings"), classname="settings"
),
ObjectList(menu_panels, heading="Menu"),
ObjectList(MainHomePageMixin.content_panels, heading="Obsah"),
ObjectList(menu_panels, heading="Hlavička"),
ObjectList(MainHomePageMixin.footer_panels, heading="Patička"),
ObjectList(MainHomePageMixin.promote_panels, heading="Propagace"),
ObjectList(settings_panels, heading="Nastavení"),
]
)
......@@ -485,6 +549,7 @@ class UniwebHomePage(
"uniweb.UniwebFormPage",
"uniweb.UniwebPeoplePage",
"uniweb.UniwebCalendarPage",
"uniweb.UniwebSearchPage",
]
### OTHERS
......@@ -492,6 +557,24 @@ class UniwebHomePage(
class Meta:
verbose_name = "Univerzální web"
@property
def gdpr_and_cookies_page(self):
from main.models import MainHomePage
return MainHomePage.objects.first().gdpr_and_cookies_page
@property
def article_page_model(self):
return UniwebArticlePage
@property
def articles_page_model(self):
return UniwebArticlesIndexPage
@property
def search_page_model(self):
return UniwebSearchPage
@property
def root_page(self):
return self
......@@ -533,7 +616,10 @@ class UniwebFlexiblePage(
"uniweb.UniwebFlexiblePage",
"uniweb.UniwebFormPage",
]
subpage_types = ["uniweb.UniwebFlexiblePage", "uniweb.UniwebFormPage"]
subpage_types = [
"uniweb.UniwebFlexiblePage",
"uniweb.UniwebFormPage",
]
### OTHERS
......@@ -974,3 +1060,9 @@ class UniwebPdfPage(MetadataPageMixin, SubpageMixin, Page, PdfPageMixin):
class Meta:
verbose_name = "PDF stránka"
class UniwebSearchPage(MainSearchPageMixin):
### RELATIONS
parent_page_types = ["uniweb.UniwebHomePage"]
\ No newline at end of file
{% extends "uniweb/base.html" %}
{% extends "styleguide2/simple_page.html" %}
{% load wagtailcore_tags %}
{% block content %}
<main>
{% block navbar %}
{% include 'styleguide2/includes/organisms/layout/district/navbar.html' with selected_item=page.get_menu_title %}
{% endblock %}
{% include "uniweb/snippet_sections.html" %}
{% block header %}
{% include 'styleguide2/includes/organisms/header/photo_header.html' with title=page.title main_image=page.main_image %}
{% endblock %}
<main class="mb-2 lg:mb-12">
{% block inner_content %}
<div class="mt-8">
{% for block in page.content %}
<div
{% if block.block_type != "newsletter" %}
class="container--wide"
{% endif %}
>
{% include_block block %}
</div>
{% endfor %}
</div>
{% endblock %}
</main>
{% endblock %}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment