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

Add MakeAWish page

parent 121e947c
No related branches found
No related tags found
2 merge requests!1266Release,!1265Release
Pipeline #20792 passed
......@@ -40,3 +40,21 @@ class TourDateBlock(StructBlock):
required=True,
help_text="Např. 13:00 - 17:00 Parkoviště před Olympií"
)
class Meta:
icon = "heart"
label = "Datum tour"
class StatBlock(StructBlock):
count = CharBlock(
label="Číslo"
)
description = CharBlock(
label="Popis"
)
class Meta:
icon = "heart"
label = "Statistika"
\ No newline at end of file
# Generated by Django 5.0.7 on 2025-03-18 16:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('make_a_wish', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='makeawishroot',
name='main_text',
field=models.TextField(verbose_name='Hlavní text'),
),
]
# Generated by Django 5.0.7 on 2025-03-18 16:52
import wagtail.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('make_a_wish', '0002_alter_makeawishroot_main_text'),
]
operations = [
migrations.AddField(
model_name='makeawishroot',
name='stats',
field=wagtail.fields.StreamField([('stat', 2)], block_lookup={0: ('wagtail.blocks.CharBlock', (), {'label': 'Číslo'}), 1: ('wagtail.blocks.CharBlock', (), {'label': 'Popis'}), 2: ('wagtail.blocks.StructBlock', [[('count', 0), ('description', 1)]], {})}, default=[], verbose_name='Statistiky'),
preserve_default=False,
),
]
from django.db import models
from wagtail.models import Page
from wagtail.fields import RichTextField, StreamField
from shared.const import RICH_TEXT_DEFAULT_FEATURES
from .blocks import CommonWishBlock, TourDateBlock
from wagtail.fields import StreamField
from shared.models import (
ExtendedMetadataHomePageMixin,
)
from wagtailmetadata.models import MetadataPageMixin
from wagtail.admin.panels import FieldPanel
from .blocks import (
CommonWishBlock,
TourDateBlock,
StatBlock,
)
class MakeAWishRoot(
Page, ExtendedMetadataHomePageMixin, MetadataPageMixin
):
main_text = RichTextField(verbose_name="Hlavní text", features=RICH_TEXT_DEFAULT_FEATURES)
main_text = models.TextField(verbose_name="Hlavní text")
new_wish_image = models.ForeignKey(
"wagtailimages.Image",
......@@ -43,12 +48,20 @@ class MakeAWishRoot(
verbose_name="Tour termíny"
)
stats = StreamField(
[
("stat", StatBlock())
],
verbose_name="Statistiky"
)
content_panels = Page.content_panels + [
FieldPanel("main_text"),
FieldPanel("new_wish_image"),
FieldPanel("video_url"),
FieldPanel("common_wishes"),
FieldPanel("tour_dates"),
FieldPanel("stats"),
]
class Meta:
......
{% extends 'styleguide2/includes/organisms/header/simple_header.html' %}
{% load wagtailcore_tags wagtailimages_tags %}
{% block wrapper_sizing_classes %}pb-0{% endblock %}
{% block content_container %}
<div class="w-full">
<div class="container--wide flex justify-between items-end w-full">
<div class="text-white flex flex-col">
<h1
class="mb-1 head-14xl xl:pb-14 xl:block hidden"
>
{{ title }}
</h1>
</div>
<div class="xl:block xl:w-auto w-full flex justify-center items-center">
{% image new_wish_image original class="pb-4 xl:mr-32 xl:w-[300px] w-[200px]" %}
</div>
</div>
</div>
{% endblock %}
\ No newline at end of file
{% extends "styleguide2/base.html" %}
{% load wagtailcore_tags wagtailimages_tags %}
{% block content %}
{% include 'styleguide2/includes/organisms/layout/navbar.html' %}
{% include 'make_a_wish/header/wish_header.html' with title=page.title new_wish_image=page.new_wish_image %}
<main role="main">
<div class="container--wide grid grid-cols-1 xl:grid-cols-2 gap-8">
<div>
<div class="prose prose-black text-2xl xl:text-3xl mb-8">
{{ page.main_text }}
</div>
<div class="bg-grey-175 border-grey-200 border-2">
<div class="flex gap-0 xl:flex-row flex-col">
{% image page.new_wish_image original class="h-32 xl:flex-1" style="height:6rem" %}
<div
class="
font-alt text-3xl xl:border-l-2 border-grey-200 xl:w-48 justify-center items-center flex
hover:bg-grey-200 duration-100 cursor-pointer
h-24
"
id="open_wish"
>
+ Přidat přání
</div>
</div>
<div class="hidden duration-150" id="make_a_wish">
<form class="border-t-2 border-grey-200 p-8">
<input
type="text"
class="bg-white font-alt p-3 text-3xl border-2 border-grey-200 w-full"
placeholder="Přeju si, aby..."
>
<div class="flex xl:gap-6 gap-4 justify-center mt-4 xl:flex-row flex-col">
<input
type="text"
class="bg-white font-alt p-3 text-3xl border-2 border-grey-200 flex-1"
placeholder="Jméno & příjmení"
>
<input
type="email"
class="bg-white font-alt p-3 text-3xl border-2 border-grey-200 flex-1"
placeholder="E-mail"
>
</div>
<div class="mt-4">
<input
type="submit"
class="bg-black duration-150 font-alt text-4xl p-3 hover:bg-grey-600 text-white w-full cursor-pointer"
value="Odeslat přání"
>
</div>
</form>
</div>
</div>
<div class="xl:mb-16 hidden" id="separator"></div>
</div>
<div class="flex xl:justify-end xl:absolute xl:ml-[920px] xl:mt-[-8px] xl:mb-0 mb-8">
<video
width="720"
height="1280"
class="w-96 mr-16"
autoplay controls muted
>
<source src="{{ page.video_url }}" type="video/mp4">
</video>
</div>
</div>
<div class="bg-black">
<div class="container--wide text-white pb-16 pt-24 xl:pr-[71px]">
<div class="grid grid-cols-1 xl:grid-cols-3">
<div class="xl:col-span-2 xl:pr-32">
<h2 class="head-14xl xl:text-8xl">Co trápí čechy a češky</h2>
<div class="text-7xl xl:text-center"></div>
</div>
</div>
<div class="mt-16 p-12 bg-grey-50">
<ul class="flex flex-col xl:gap-6 gap-12">
{% for wish in page.common_wishes %}
<li>
<div class="flex xl:gap-8 gap-6 items-center xl:flex-row flex-col">
{% image wish.value.image original class="rounded-full h-32 w-32" %}
<div class="text-black">
<h4 class="font-alt text-5xl mb-3">{{ wish.value.title }}</h4>
<p class="text-2xl xl:mb-0">{{ wish.value.description }}</p>
</div>
</div>
</li>
{% endfor %}
</ul>
</div>
<div class="mt-12 xl:p-12 p-6 bg-grey-50 text-black">
<h3 class="head-4xl text-5xl px-6 pt-6">Máte přání tour</h3>
<ul class="flex flex-col gap-4 mt-8">
{% for tour_date in page.tour_dates %}
<li class="py-4">
<div class="font-alt text-4xl">
{{ tour_date.value.date }}
</div>
<div class="text-2xl">
{{ tour_date.value.details }}
</div>
</li>
{% if not forloop.last %}
<div class="mx-24 border-t-2 border-grey-200"></div>
{% endif %}
{% endfor %}
</ul>
</div>
<h3 class="mt-12 xl:head-6xl head-9xl text-white">Naše data</h3>
<div class="mt-4 p-6 bg-grey-50 text-black flex gap-8 xl:gap-16 justify-between xl:flex-row flex-col">
{% for stat_info in page.stats %}
<div class="flex gap-4 items-center">
<div class="text-6xl font-alt">{{ stat_info.value.count }}</div>
<div class="text-3xl font-alt">
{{ stat_info.value.description }}
</div>
</div>
{% endfor %}
</div>
</div>
</div>
</main>
<script>
document.getElementById("open_wish").onclick = ((e) => {
const makeAWish = document.getElementById("make_a_wish");
const separator = document.getElementById("separator");
if (makeAWish.classList.contains("hidden")) {
makeAWish.classList.remove("hidden");
separator.classList.remove("hidden");
e.currentTarget.innerHTML = "← Zrušit"
} else {
makeAWish.classList.add("hidden");
separator.classList.add("hidden");
e.currentTarget.innerHTML = "+ Přidat přání"
}
});
</script>
{% endblock %}
Source diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -22,7 +22,7 @@
{% block classes %}
flex items-center w-full pt-28 pb-8
xl:pt-48 xl:pb-24
{% block wrapper_sizing_classes %}xl:pt-48 xl:pb-24{% endblock %}
{% block extra_classes %}{% endblock %}
......@@ -45,6 +45,7 @@
{% endif %}
>
<div class="flex justify-start w-full">
{% block content_container %}
<div class="container--wide w-full">
{% block content %}
<div class="text-white flex flex-col">
......@@ -98,6 +99,7 @@
</div>
{% endblock %}
</div>
{% endblock %}
</div>
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment