From 43588f504d41751a58aafc59e90b61ca7d57077f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Valenta?= <git@imaniti.org> Date: Fri, 5 Jan 2024 18:57:35 +0100 Subject: [PATCH] finish everything in new elections web except for program --- elections/blocks.py | 46 ++++++- ...lter_electionshomepage_content_and_more.py | 60 +++++++++ ..._alter_electionsarticlepage_author_page.py | 19 +++ ...electionscandidatepage_articles_heading.py | 19 +++ ...electionscandidatepage_options_and_more.py | 25 ++++ .../0011_alter_electionshomepage_content.py | 21 ++++ elections/models.py | 119 +++++++++++++++++- .../elections/elections_candidate_page.html | 17 +++ .../elections/elections_home_page.html | 16 +++ .../{europarl => elections}/navigation.html | 2 +- .../molecules/blocks/inline_contact.html | 33 +++++ .../candidate_footer_box.html | 10 +- .../candidate_primary_box.html | 4 +- .../candidate_primary_box.yaml | 0 .../candidate_secondary_box.html | 0 .../candidate_secondary_box.yaml | 0 .../europarl/candidate_footer_box.yaml | 4 - .../{europarl => elections}/carousel.html | 0 .../organisms/articles/articles_section.html | 6 +- .../articles_section.html | 2 +- .../candidate_articles_section.html | 2 +- .../candidate_footer_list.html | 8 +- .../elections/candidate_primary_list.html | 18 +++ .../elections/candidate_secondary_list.html | 12 ++ .../europarl/candidate_primary_list.html | 11 -- .../europarl/candidate_secondary_list.html | 12 -- .../header/elections/article_header.html | 9 ++ .../articles_header.html | 4 +- .../candidate_header.html | 26 ++-- .../candidates_header.html | 2 +- .../header/elections/faq_header.html | 3 + .../simple_header.html | 2 +- .../elections/simple_header_with_tags.html | 5 + ...imple_header_with_tags_and_navigation.html | 9 ++ .../simple_header_with_ui_switch.html | 2 +- .../header/europarl/article_header.html | 9 -- .../organisms/header/europarl/faq_header.html | 3 - .../europarl/simple_header_with_tags.html | 5 - ...imple_header_with_tags_and_navigation.html | 9 -- .../organisms/header/simple_header.html | 80 ++++++------ .../organisms/layout/elections/navbar.html | 24 ++++ .../{europarl => elections}/navbar.yaml | 0 .../organisms/layout/europarl/navbar.html | 22 ---- .../includes/organisms/layout/navbar.html | 62 +++++++-- 44 files changed, 576 insertions(+), 166 deletions(-) create mode 100644 elections/migrations/0007_alter_electionshomepage_content_and_more.py create mode 100644 elections/migrations/0008_alter_electionsarticlepage_author_page.py create mode 100644 elections/migrations/0009_electionscandidatepage_articles_heading.py create mode 100644 elections/migrations/0010_alter_electionscandidatepage_options_and_more.py create mode 100644 elections/migrations/0011_alter_electionshomepage_content.py create mode 100644 elections/templates/elections/elections_candidate_page.html rename shared/templates/styleguide2/includes/atoms/header/{europarl => elections}/navigation.html (52%) create mode 100644 shared/templates/styleguide2/includes/molecules/blocks/inline_contact.html rename shared/templates/styleguide2/includes/molecules/candidates/{europarl => elections}/candidate_footer_box.html (62%) rename shared/templates/styleguide2/includes/molecules/candidates/{europarl => elections}/candidate_primary_box.html (67%) rename shared/templates/styleguide2/includes/molecules/candidates/{europarl => elections}/candidate_primary_box.yaml (100%) rename shared/templates/styleguide2/includes/molecules/candidates/{europarl => elections}/candidate_secondary_box.html (100%) rename shared/templates/styleguide2/includes/molecules/candidates/{europarl => elections}/candidate_secondary_box.yaml (100%) delete mode 100644 shared/templates/styleguide2/includes/molecules/candidates/europarl/candidate_footer_box.yaml rename shared/templates/styleguide2/includes/molecules/menus/{europarl => elections}/carousel.html (100%) rename shared/templates/styleguide2/includes/organisms/articles/{europarl => elections}/articles_section.html (68%) rename shared/templates/styleguide2/includes/organisms/articles/{europarl => elections}/candidate_articles_section.html (65%) rename shared/templates/styleguide2/includes/organisms/candidates/{europarl => elections}/candidate_footer_list.html (68%) create mode 100644 shared/templates/styleguide2/includes/organisms/candidates/elections/candidate_primary_list.html create mode 100644 shared/templates/styleguide2/includes/organisms/candidates/elections/candidate_secondary_list.html delete mode 100644 shared/templates/styleguide2/includes/organisms/candidates/europarl/candidate_primary_list.html delete mode 100644 shared/templates/styleguide2/includes/organisms/candidates/europarl/candidate_secondary_list.html create mode 100644 shared/templates/styleguide2/includes/organisms/header/elections/article_header.html rename shared/templates/styleguide2/includes/organisms/header/{europarl => elections}/articles_header.html (65%) rename shared/templates/styleguide2/includes/organisms/header/{europarl => elections}/candidate_header.html (73%) rename shared/templates/styleguide2/includes/organisms/header/{europarl => elections}/candidates_header.html (65%) create mode 100644 shared/templates/styleguide2/includes/organisms/header/elections/faq_header.html rename shared/templates/styleguide2/includes/organisms/header/{europarl => elections}/simple_header.html (82%) create mode 100644 shared/templates/styleguide2/includes/organisms/header/elections/simple_header_with_tags.html create mode 100644 shared/templates/styleguide2/includes/organisms/header/elections/simple_header_with_tags_and_navigation.html rename shared/templates/styleguide2/includes/organisms/header/{europarl => elections}/simple_header_with_ui_switch.html (90%) delete mode 100644 shared/templates/styleguide2/includes/organisms/header/europarl/article_header.html delete mode 100644 shared/templates/styleguide2/includes/organisms/header/europarl/faq_header.html delete mode 100644 shared/templates/styleguide2/includes/organisms/header/europarl/simple_header_with_tags.html delete mode 100644 shared/templates/styleguide2/includes/organisms/header/europarl/simple_header_with_tags_and_navigation.html create mode 100644 shared/templates/styleguide2/includes/organisms/layout/elections/navbar.html rename shared/templates/styleguide2/includes/organisms/layout/{europarl => elections}/navbar.yaml (100%) delete mode 100644 shared/templates/styleguide2/includes/organisms/layout/europarl/navbar.html diff --git a/elections/blocks.py b/elections/blocks.py index f6e75959..46fb15f7 100644 --- a/elections/blocks.py +++ b/elections/blocks.py @@ -1,11 +1,55 @@ from wagtail.blocks import StructBlock from wagtail.images.blocks import ImageChooserBlock +from wagtail.blocks import ( + RichTextBlock, + TextBlock, + PageChooserBlock, + ListBlock +) class ElectionsCarouselBlock(StructBlock): image = ImageChooserBlock(label="Obrázek na pozadĂ") class Meta: - template = "styleguide2/includes/molecules/menus/europarl/carousel.html" + template = "styleguide2/includes/molecules/menus/elections/carousel.html" icon = "form" label = "Carousel" + + +class CandidateBlock(StructBlock): + page = PageChooserBlock( + label="Stránka", + page_type=[ + "elections.ElectionsCandidatePage" + ] + ) + + image = ImageChooserBlock( + label="Obrázek", + help_text="Pokud nenĂ vybrán, pouĹľije se obrázek ze stránky kandidáta", + required=False + ) + + description = TextBlock( + label="Popis", + required=False, + help_text="Pokud zĹŻstane prázdnĂ©, pouĹľije se popis ze stránky kandidáta" + ) + + class Meta: + template = "styleguide2/includes/molecules/candidates/elections/candidate_primary_box.html" + icon = "form" + label = "Kandidát" + + +class CandidateListBlock(StructBlock): + candidates = ListBlock( + CandidateBlock(), + label="Kandidáti", + ) + + class Meta: + template = "styleguide2/includes/organisms/candidates/elections/candidate_primary_list.html" + icon = "form" + label = "Seznam kandidátĹŻ" diff --git a/elections/migrations/0007_alter_electionshomepage_content_and_more.py b/elections/migrations/0007_alter_electionshomepage_content_and_more.py new file mode 100644 index 00000000..28a0b9be --- /dev/null +++ b/elections/migrations/0007_alter_electionshomepage_content_and_more.py @@ -0,0 +1,60 @@ +# Generated by Django 4.1.10 on 2024-01-05 16:23 + +from django.db import migrations, models +import django.db.models.deletion +import shared.models.base +import wagtail.blocks +import wagtail.fields +import wagtail.images.blocks +import wagtailmetadata.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('wagtailcore', '0083_workflowcontenttype'), + ('calendar_utils', '0004_auto_20220505_1228'), + ('wagtailimages', '0025_alter_image_file_alter_rendition_file'), + ('elections', '0006_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([('candidate', wagtail.blocks.PageChooserBlock(label='Stránka', page_type=['elections.ElectionsCandidatePage'])), ('description', wagtail.blocks.RichTextBlock(help_text='Pokud zĹŻstane prázdnĂ©, pouĹľije se popis ze stránky kandidáta', label='Popis', required=False))]), label='Kandidáti'))]))], blank=True, use_json_field=True, verbose_name='HlavnĂ obsah'), + ), + migrations.CreateModel( + name='ElectionsCandidatesPage', + 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')), + ('calendar_url', models.URLField(blank=True, help_text='Kalendář se po uloĹľenĂ stránky aktualizuje na pozadĂ. U plnÄ›jšĂch kalendářů to mĹŻĹľe trvat i desĂtky sekund.', null=True, verbose_name='URL kalendáře ve formátu iCal')), + ('calendar', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='calendar_utils.calendar')), + ('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': 'Kandidáti', + }, + bases=(shared.models.base.SubpageMixin, wagtailmetadata.models.WagtailImageMetadataMixin, 'wagtailcore.page', models.Model), + ), + migrations.CreateModel( + name='ElectionsCandidatePage', + 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')), + ('calendar_url', models.URLField(blank=True, help_text='Kalendář se po uloĹľenĂ stránky aktualizuje na pozadĂ. U plnÄ›jšĂch kalendářů to mĹŻĹľe trvat i desĂtky sekund.', null=True, verbose_name='URL kalendáře ve formátu iCal')), + ('position', models.CharField(blank=True, max_length=64, null=True, verbose_name='Pozice/povolánĂ')), + ('perex', wagtail.fields.RichTextField()), + ('email', models.CharField(blank=True, max_length=128, null=True, verbose_name='E-mail')), + ('phone', models.CharField(blank=True, max_length=16, null=True, verbose_name='TelefonnĂ kontakt')), + ('social_links', 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, use_json_field=True, verbose_name='Odkazy na sociálnĂ sĂtÄ›')), + ('related_candidates', wagtail.fields.StreamField([('candidate', wagtail.blocks.PageChooserBlock(label='Detail kandidáta', page_type=['elections.ElectionsCandidatePage']))], blank=True, use_json_field=True, verbose_name='Dalšà kandidáti')), + ('calendar', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='calendar_utils.calendar')), + ('image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='wagtailimages.image', verbose_name='Obrázek')), + ('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={ + 'abstract': False, + }, + bases=(shared.models.base.SubpageMixin, wagtailmetadata.models.WagtailImageMetadataMixin, 'wagtailcore.page', models.Model), + ), + ] diff --git a/elections/migrations/0008_alter_electionsarticlepage_author_page.py b/elections/migrations/0008_alter_electionsarticlepage_author_page.py new file mode 100644 index 00000000..438bc843 --- /dev/null +++ b/elections/migrations/0008_alter_electionsarticlepage_author_page.py @@ -0,0 +1,19 @@ +# Generated by Django 4.1.10 on 2024-01-05 17:20 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('elections', '0007_alter_electionshomepage_content_and_more'), + ] + + operations = [ + migrations.AlterField( + model_name='electionsarticlepage', + name='author_page', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='elections.electionscandidatepage', verbose_name='Stránka autora (kandidáta)'), + ), + ] diff --git a/elections/migrations/0009_electionscandidatepage_articles_heading.py b/elections/migrations/0009_electionscandidatepage_articles_heading.py new file mode 100644 index 00000000..404a7d40 --- /dev/null +++ b/elections/migrations/0009_electionscandidatepage_articles_heading.py @@ -0,0 +1,19 @@ +# Generated by Django 4.1.10 on 2024-01-05 17:29 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('elections', '0008_alter_electionsarticlepage_author_page'), + ] + + operations = [ + migrations.AddField( + model_name='electionscandidatepage', + name='articles_heading', + field=models.CharField(default='Aktuality', help_text='NapĹ™. "Aktuality Mikuláše Peksy".', max_length=32, verbose_name='Nadpis sekce s ÄŤlánky'), + preserve_default=False, + ), + ] diff --git a/elections/migrations/0010_alter_electionscandidatepage_options_and_more.py b/elections/migrations/0010_alter_electionscandidatepage_options_and_more.py new file mode 100644 index 00000000..84e1ed74 --- /dev/null +++ b/elections/migrations/0010_alter_electionscandidatepage_options_and_more.py @@ -0,0 +1,25 @@ +# Generated by Django 4.1.10 on 2024-01-05 17:35 + +from django.db import migrations +import wagtail.blocks +import wagtail.fields +import wagtail.images.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ('elections', '0009_electionscandidatepage_articles_heading'), + ] + + operations = [ + migrations.AlterModelOptions( + name='electionscandidatepage', + options={'verbose_name': 'Kandidát'}, + ), + 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([('candidate', 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.RichTextBlock(help_text='Pokud zĹŻstane prázdnĂ©, pouĹľije se popis ze stránky kandidáta', label='Popis', required=False))]), label='Kandidáti'))]))], blank=True, use_json_field=True, verbose_name='HlavnĂ obsah'), + ), + ] diff --git a/elections/migrations/0011_alter_electionshomepage_content.py b/elections/migrations/0011_alter_electionshomepage_content.py new file mode 100644 index 00000000..b76c7da0 --- /dev/null +++ b/elections/migrations/0011_alter_electionshomepage_content.py @@ -0,0 +1,21 @@ +# Generated by Django 4.1.10 on 2024-01-05 17:44 + +from django.db import migrations +import wagtail.blocks +import wagtail.fields +import wagtail.images.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ('elections', '0010_alter_electionscandidatepage_options_and_more'), + ] + + 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(help_text='Pokud zĹŻstane prázdnĂ©, pouĹľije se popis ze stránky kandidáta', label='Popis', required=False))]), label='Kandidáti'))]))], blank=True, use_json_field=True, verbose_name='HlavnĂ obsah'), + ), + ] diff --git a/elections/models.py b/elections/models.py index 15cedb93..405a7424 100644 --- a/elections/models.py +++ b/elections/models.py @@ -55,6 +55,7 @@ class ElectionsHomePage(MainHomePageMixin): content = StreamField( [ ("carousel", blocks.ElectionsCarouselBlock()), + ("candidate", blocks.CandidateListBlock()) ], verbose_name="HlavnĂ obsah", blank=True, @@ -72,6 +73,7 @@ class ElectionsHomePage(MainHomePageMixin): subpage_types = [ "elections.ElectionsArticlesPage", + "elections.ElectionsCandidatesPage", "elections.ElectionsSearchPage", ] @@ -92,10 +94,6 @@ class ElectionsHomePage(MainHomePageMixin): def search_page_model(self): return ElectionsSearchPage - @property - def people_page(self): - return self._first_subpage_of_type(ElectionsPeoplePage) - @property def root_page(self): return self @@ -126,11 +124,11 @@ class ElectionsArticleTag(TaggedItemBase): class ElectionsArticlePage(MainArticlePageMixin): author_page = models.ForeignKey( - "main.MainPersonPage", + "elections.ElectionsCandidatePage", on_delete=models.SET_NULL, null=True, blank=True, - verbose_name="Stránka autora (osoby)", + verbose_name="Stránka autora (kandidáta)", ) tags = ClusterTaggableManager( through=ElectionsArticleTag, @@ -158,3 +156,112 @@ class ElectionsSearchPage(MainSearchPageMixin): ElectionsPersonPage, ElectionsSimplePage, ] + + +class ElectionsCandidatesPage( + ExtendedMetadataPageMixin, + SubpageMixin, + MetadataPageMixin, + CalendarMixin, + PageInMenuMixin, + Page, +): + parent_page_types = ["elections.ElectionsHomePage"] + subpage_types = ["elections.ElectionsCandidatePage"] + + class Meta: + verbose_name = "Kandidáti" + + +class ElectionsCandidatePage( + ExtendedMetadataPageMixin, + SubpageMixin, + MetadataPageMixin, + CalendarMixin, + PageInMenuMixin, + Page, +): + ## FIELDS + + image = models.ForeignKey( + "wagtailimages.Image", + on_delete=models.PROTECT, + blank=True, + null=True, + verbose_name="Obrázek", + related_name="+", + ) + + position = models.CharField( + "Pozice/povolánĂ", max_length=64, blank=True, null=True + ) + + perex = RichTextField() + + email = models.CharField("E-mail", max_length=128, blank=True, null=True) + phone = models.CharField("TelefonnĂ kontakt", max_length=16, blank=True, null=True) + + social_links = StreamField( + [ + ("social_links", shared_blocks.SocialLinkBlock()), + ], + verbose_name="Odkazy na sociálnĂ sĂtÄ›", + blank=True, + use_json_field=True, + ) + + articles_heading = models.CharField( + "Nadpis sekce s ÄŤlánky", + max_length=32, + help_text="NapĹ™. \"Aktuality Mikuláše Peksy\"." + ) + + related_candidates = StreamField( + [ + ( + "candidate", + PageChooserBlock(page_type="elections.ElectionsCandidatePage", label="Detail kandidáta"), + ) + ], + verbose_name="Dalšà kandidáti", + blank=True, + use_json_field=True, + ) + + ## PANELS + + content_panels = Page.content_panels + [ + FieldPanel("image"), + FieldPanel("position"), + FieldPanel("perex"), + FieldPanel("email"), + FieldPanel("phone"), + FieldPanel("social_links"), + FieldPanel("articles_heading"), + FieldPanel("related_candidates"), + ] + + promote_panels = make_promote_panels() + + ## RELATIONS + + parent_page_types = ["elections.ElectionsCandidatesPage"] + subpage_types = [] + + ## META + + class Meta: + verbose_name = "Kandidát" + + ## FUNCTIONS + + def get_context(self, request) -> dict: + context = super().get_context(request) + + context["article_data_list"] = ( + ElectionsArticlePage.objects.filter(author_page=self.id) + .order_by("-date") + .live()[:3] + ) + + return context diff --git a/elections/templates/elections/elections_candidate_page.html b/elections/templates/elections/elections_candidate_page.html new file mode 100644 index 00000000..488a70e4 --- /dev/null +++ b/elections/templates/elections/elections_candidate_page.html @@ -0,0 +1,17 @@ +{% extends "styleguide2/base.html" %} + +{% block content %} + {% include 'styleguide2/includes/organisms/layout/elections/navbar.html' with selected_item=page.get_menu_title %} + + <main role="main"> + {% include 'styleguide2/includes/organisms/header/elections/candidate_header.html' with title=page.title position=page.position perex=page.perex image=page.image email=page.email phone=page.phone social_links=page.social_links %} + + {% if article_data_list %} + {% include 'styleguide2/includes/organisms/articles/elections/candidate_articles_section.html' with title=page.articles_heading %} + {% endif %} + + {% if page.related_candidates %} + {% include 'styleguide2/includes/organisms/candidates/elections/candidate_footer_list.html' with candidates=page.related_candidates %} + {% endif %} + </main> +{% endblock %} diff --git a/elections/templates/elections/elections_home_page.html b/elections/templates/elections/elections_home_page.html index 1db4c8fc..0c8dfc01 100644 --- a/elections/templates/elections/elections_home_page.html +++ b/elections/templates/elections/elections_home_page.html @@ -1 +1,17 @@ {% extends "styleguide2/home_page.html" %} + +{% load wagtailcore_tags %} + +{% block content %} + +{% include 'styleguide2/includes/organisms/layout/elections/navbar.html' with is_transparent=True %} + +<main role="main"> + {% for block in page.content %} + {% include_block block %} + {% endfor %} + + {% include "styleguide2/includes/organisms/main_section/newsletter_section.html" %} +</main> + +{% endblock %} diff --git a/shared/templates/styleguide2/includes/atoms/header/europarl/navigation.html b/shared/templates/styleguide2/includes/atoms/header/elections/navigation.html similarity index 52% rename from shared/templates/styleguide2/includes/atoms/header/europarl/navigation.html rename to shared/templates/styleguide2/includes/atoms/header/elections/navigation.html index 17e79cdd..353023b9 100644 --- a/shared/templates/styleguide2/includes/atoms/header/europarl/navigation.html +++ b/shared/templates/styleguide2/includes/atoms/header/elections/navigation.html @@ -1,4 +1,4 @@ -{% extends 'patterns/atoms/header/navigation.html' %} +{% extends 'styleguide2/includes/atoms/header/navigation.html' %} {% block classes %} flex gap-3 text-black {{ classes }} diff --git a/shared/templates/styleguide2/includes/molecules/blocks/inline_contact.html b/shared/templates/styleguide2/includes/molecules/blocks/inline_contact.html new file mode 100644 index 00000000..fd292c4f --- /dev/null +++ b/shared/templates/styleguide2/includes/molecules/blocks/inline_contact.html @@ -0,0 +1,33 @@ +<div> + <h3 + class=" + hidden font-alt text-[3.5rem] mb-3 + xl:block + " + >Kontakty</h3> +</div> + +<div class="flex flex-col gap-2 text-lg"> + {% if phone %} + <a href="tel:{{ phone }}" class="font-bold underline"> + {{ phone }} + </a> + {% endif %} + + {% if email %} + <a href="{{ email }}" class="font-bold underline"> + {{ email }} + </a> + {% endif %} + + <div class="flex flex-col pt-4 gap-3"> + {% for social_link in social_links %} + <div class="flex items-center gap-2"> + <i class="{{ social_link.value.icon }}"></i> + <a href="{{ social_link.value.link }}" class="underline"> + {{ social_link.value.text }} + </a> + </div> + {% endfor %} + </div> +</div> diff --git a/shared/templates/styleguide2/includes/molecules/candidates/europarl/candidate_footer_box.html b/shared/templates/styleguide2/includes/molecules/candidates/elections/candidate_footer_box.html similarity index 62% rename from shared/templates/styleguide2/includes/molecules/candidates/europarl/candidate_footer_box.html rename to shared/templates/styleguide2/includes/molecules/candidates/elections/candidate_footer_box.html index 5d987f00..f1ec7c77 100644 --- a/shared/templates/styleguide2/includes/molecules/candidates/europarl/candidate_footer_box.html +++ b/shared/templates/styleguide2/includes/molecules/candidates/elections/candidate_footer_box.html @@ -1,3 +1,5 @@ +{% load wagtailimages_tags %} + <a href="#" class=" @@ -8,17 +10,19 @@ lg:min-w-[24rem] " > + {% image candidate_page.image original as candidate_image %} + <img class="w-3/5" - src="{{ image_source }}" + src="{{ candidate_image.url }}" > <div class="flex flex-col justify-end"> <h3 class="head-4xl group-hover:underline underline-offset-3" - >{{ name }}</h3> + >{{ candidate_page.title }}</h3> <p class="!no-underline"> - {{ position }} + {{ candidate_page.position }} </p> </div> </a> diff --git a/shared/templates/styleguide2/includes/molecules/candidates/europarl/candidate_primary_box.html b/shared/templates/styleguide2/includes/molecules/candidates/elections/candidate_primary_box.html similarity index 67% rename from shared/templates/styleguide2/includes/molecules/candidates/europarl/candidate_primary_box.html rename to shared/templates/styleguide2/includes/molecules/candidates/elections/candidate_primary_box.html index 3ed76e9c..c3167e8b 100644 --- a/shared/templates/styleguide2/includes/molecules/candidates/europarl/candidate_primary_box.html +++ b/shared/templates/styleguide2/includes/molecules/candidates/elections/candidate_primary_box.html @@ -1,7 +1,9 @@ +{% load wagtailimages_tags %} + <ui-candidate-primary-box name="{{ name }}" position="{{ position }}" description="{{ description }}" url="{{ url }}" - image-source="{{ image_source }}" + image-source="{{ candidate_image.url }}" ></ui-candidate-primary-box> diff --git a/shared/templates/styleguide2/includes/molecules/candidates/europarl/candidate_primary_box.yaml b/shared/templates/styleguide2/includes/molecules/candidates/elections/candidate_primary_box.yaml similarity index 100% rename from shared/templates/styleguide2/includes/molecules/candidates/europarl/candidate_primary_box.yaml rename to shared/templates/styleguide2/includes/molecules/candidates/elections/candidate_primary_box.yaml diff --git a/shared/templates/styleguide2/includes/molecules/candidates/europarl/candidate_secondary_box.html b/shared/templates/styleguide2/includes/molecules/candidates/elections/candidate_secondary_box.html similarity index 100% rename from shared/templates/styleguide2/includes/molecules/candidates/europarl/candidate_secondary_box.html rename to shared/templates/styleguide2/includes/molecules/candidates/elections/candidate_secondary_box.html diff --git a/shared/templates/styleguide2/includes/molecules/candidates/europarl/candidate_secondary_box.yaml b/shared/templates/styleguide2/includes/molecules/candidates/elections/candidate_secondary_box.yaml similarity index 100% rename from shared/templates/styleguide2/includes/molecules/candidates/europarl/candidate_secondary_box.yaml rename to shared/templates/styleguide2/includes/molecules/candidates/elections/candidate_secondary_box.yaml diff --git a/shared/templates/styleguide2/includes/molecules/candidates/europarl/candidate_footer_box.yaml b/shared/templates/styleguide2/includes/molecules/candidates/europarl/candidate_footer_box.yaml deleted file mode 100644 index 394d1d58..00000000 --- a/shared/templates/styleguide2/includes/molecules/candidates/europarl/candidate_footer_box.yaml +++ /dev/null @@ -1,4 +0,0 @@ -context: - image_source: '../../../../../static/images/mikulas-arrow.png' - name: 'Mikuláš Peksa' - position: 'Europoslanec' diff --git a/shared/templates/styleguide2/includes/molecules/menus/europarl/carousel.html b/shared/templates/styleguide2/includes/molecules/menus/elections/carousel.html similarity index 100% rename from shared/templates/styleguide2/includes/molecules/menus/europarl/carousel.html rename to shared/templates/styleguide2/includes/molecules/menus/elections/carousel.html diff --git a/shared/templates/styleguide2/includes/organisms/articles/articles_section.html b/shared/templates/styleguide2/includes/organisms/articles/articles_section.html index 6361a923..56b9b04e 100644 --- a/shared/templates/styleguide2/includes/organisms/articles/articles_section.html +++ b/shared/templates/styleguide2/includes/organisms/articles/articles_section.html @@ -9,11 +9,11 @@ xl:py-24 xl:flex-row xl:gap-4 " > - <h2 class="head-14xl head-compact"> - {{ self.title }} + <h2 class="{% block heading_classes %}head-14xl head-compact{% endblock %}"> + {% if not title %}{{ self.title }}{% else %}{{ title }}{% endif %} </h2> <p class="max-w-[350px] font-condensed text-xl"> - {{ self.description }} + {% if not description %}{{ self.description }}{% else %}{{ description }}{% endif %} </p> </div> diff --git a/shared/templates/styleguide2/includes/organisms/articles/europarl/articles_section.html b/shared/templates/styleguide2/includes/organisms/articles/elections/articles_section.html similarity index 68% rename from shared/templates/styleguide2/includes/organisms/articles/europarl/articles_section.html rename to shared/templates/styleguide2/includes/organisms/articles/elections/articles_section.html index dd10af48..044c4456 100644 --- a/shared/templates/styleguide2/includes/organisms/articles/europarl/articles_section.html +++ b/shared/templates/styleguide2/includes/organisms/articles/elections/articles_section.html @@ -1,4 +1,4 @@ -{% extends 'patterns/organisms/articles/articles_section.html' %} +{% extends 'styleguide2/includes/organisms/articles/articles_section.html' %} {% block wrapper_classes %} bg-pirati-yellow text-black diff --git a/shared/templates/styleguide2/includes/organisms/articles/europarl/candidate_articles_section.html b/shared/templates/styleguide2/includes/organisms/articles/elections/candidate_articles_section.html similarity index 65% rename from shared/templates/styleguide2/includes/organisms/articles/europarl/candidate_articles_section.html rename to shared/templates/styleguide2/includes/organisms/articles/elections/candidate_articles_section.html index 5e07ebc4..4d2fce7c 100644 --- a/shared/templates/styleguide2/includes/organisms/articles/europarl/candidate_articles_section.html +++ b/shared/templates/styleguide2/includes/organisms/articles/elections/candidate_articles_section.html @@ -1,4 +1,4 @@ -{% extends 'patterns/organisms/articles/articles_section.html' %} +{% extends 'styleguide2/includes/organisms/articles/articles_section.html' %} {% block heading_classes %} head-10xl {% endblock %} diff --git a/shared/templates/styleguide2/includes/organisms/candidates/europarl/candidate_footer_list.html b/shared/templates/styleguide2/includes/organisms/candidates/elections/candidate_footer_list.html similarity index 68% rename from shared/templates/styleguide2/includes/organisms/candidates/europarl/candidate_footer_list.html rename to shared/templates/styleguide2/includes/organisms/candidates/elections/candidate_footer_list.html index f4057372..05b4ac76 100644 --- a/shared/templates/styleguide2/includes/organisms/candidates/europarl/candidate_footer_list.html +++ b/shared/templates/styleguide2/includes/organisms/candidates/elections/candidate_footer_list.html @@ -12,7 +12,7 @@ <h2 class="head-10xl" > - {{ title }} + Dalšà kandidáti </h2> <div class="w-full"> @@ -26,9 +26,9 @@ " scroller-classes="!text-black" > - {% include 'patterns/molecules/candidates/europarl/candidate_footer_box.html' %} - {% include 'patterns/molecules/candidates/europarl/candidate_footer_box.html' %} - {% include 'patterns/molecules/candidates/europarl/candidate_footer_box.html' %} + {% for candidate in candidates %} + {% include 'styleguide2/includes/molecules/candidates/elections/candidate_footer_box.html' with candidate_page=candidate.value %} + {% endfor %} </ui-horizontal-scrollable> </div> </div> diff --git a/shared/templates/styleguide2/includes/organisms/candidates/elections/candidate_primary_list.html b/shared/templates/styleguide2/includes/organisms/candidates/elections/candidate_primary_list.html new file mode 100644 index 00000000..d87a6a69 --- /dev/null +++ b/shared/templates/styleguide2/includes/organisms/candidates/elections/candidate_primary_list.html @@ -0,0 +1,18 @@ +{% load wagtailimages_tags %} + +<ul + class="candidate-primary-list __js-root" + id="{{ id }}" +> + {% for candidate in self.candidates %} + {% firstof candidate.description candidate.page.description 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 %} + {% endfor %} +</ul> diff --git a/shared/templates/styleguide2/includes/organisms/candidates/elections/candidate_secondary_list.html b/shared/templates/styleguide2/includes/organisms/candidates/elections/candidate_secondary_list.html new file mode 100644 index 00000000..178aaf08 --- /dev/null +++ b/shared/templates/styleguide2/includes/organisms/candidates/elections/candidate_secondary_list.html @@ -0,0 +1,12 @@ +<ul class="candidate-secondary-list pt-14 pb-16"> + <div class="container--wide"> + <h2 class="head-7xl mb-3">Dalšà kandidáti</h2> + </div> + + {% include "styleguide2/includes/molecules/candidates/elections/candidate_secondary_box.html" %} + {% include "styleguide2/includes/molecules/candidates/elections/candidate_secondary_box.html" %} + {% include "styleguide2/includes/molecules/candidates/elections/candidate_secondary_box.html" %} + {% include "styleguide2/includes/molecules/candidates/elections/candidate_secondary_box.html" %} + {% include "styleguide2/includes/molecules/candidates/elections/candidate_secondary_box.html" %} + {% include "styleguide2/includes/molecules/candidates/elections/candidate_secondary_box.html" %} +</ul> diff --git a/shared/templates/styleguide2/includes/organisms/candidates/europarl/candidate_primary_list.html b/shared/templates/styleguide2/includes/organisms/candidates/europarl/candidate_primary_list.html deleted file mode 100644 index 585348ce..00000000 --- a/shared/templates/styleguide2/includes/organisms/candidates/europarl/candidate_primary_list.html +++ /dev/null @@ -1,11 +0,0 @@ -<ul - class="candidate-primary-list __js-root" - id="{{ id }}" -> - {% include "patterns/molecules/candidates/europarl/candidate_primary_box.html" %} - {% include "patterns/molecules/candidates/europarl/candidate_primary_box.html" %} - {% include "patterns/molecules/candidates/europarl/candidate_primary_box.html" %} - {% include "patterns/molecules/candidates/europarl/candidate_primary_box.html" %} - {% include "patterns/molecules/candidates/europarl/candidate_primary_box.html" %} - {% include "patterns/molecules/candidates/europarl/candidate_primary_box.html" %} -</ul> diff --git a/shared/templates/styleguide2/includes/organisms/candidates/europarl/candidate_secondary_list.html b/shared/templates/styleguide2/includes/organisms/candidates/europarl/candidate_secondary_list.html deleted file mode 100644 index 3e6e6a3c..00000000 --- a/shared/templates/styleguide2/includes/organisms/candidates/europarl/candidate_secondary_list.html +++ /dev/null @@ -1,12 +0,0 @@ -<ul class="candidate-secondary-list pt-14 pb-16"> - <div class="container--wide"> - <h2 class="head-7xl mb-3">Dalšà kandidáti</h2> - </div> - - {% include "patterns/molecules/candidates/europarl/candidate_secondary_box.html" %} - {% include "patterns/molecules/candidates/europarl/candidate_secondary_box.html" %} - {% include "patterns/molecules/candidates/europarl/candidate_secondary_box.html" %} - {% include "patterns/molecules/candidates/europarl/candidate_secondary_box.html" %} - {% include "patterns/molecules/candidates/europarl/candidate_secondary_box.html" %} - {% include "patterns/molecules/candidates/europarl/candidate_secondary_box.html" %} -</ul> diff --git a/shared/templates/styleguide2/includes/organisms/header/elections/article_header.html b/shared/templates/styleguide2/includes/organisms/header/elections/article_header.html new file mode 100644 index 00000000..4e02b5f1 --- /dev/null +++ b/shared/templates/styleguide2/includes/organisms/header/elections/article_header.html @@ -0,0 +1,9 @@ +{% extends 'styleguide2/includes/organisms/header/elections/simple_header_with_tags_and_navigation.html' %} + +{% block before_heading %} + {% include 'styleguide2/includes/atoms/header/elections/navigation.html' with classes='mb-6' first_text=first_nav_text second_text=second_nav_text second_link=second_link %} +{% endblock %} + +{% block heading_classes %}!text-black head-8xl{% endblock %} + +{% block description_classes %}!text-black{% endblock %} diff --git a/shared/templates/styleguide2/includes/organisms/header/europarl/articles_header.html b/shared/templates/styleguide2/includes/organisms/header/elections/articles_header.html similarity index 65% rename from shared/templates/styleguide2/includes/organisms/header/europarl/articles_header.html rename to shared/templates/styleguide2/includes/organisms/header/elections/articles_header.html index a21212d8..84125be6 100644 --- a/shared/templates/styleguide2/includes/organisms/header/europarl/articles_header.html +++ b/shared/templates/styleguide2/includes/organisms/header/elections/articles_header.html @@ -1,4 +1,4 @@ -{% extends 'patterns/organisms/header/europarl/simple_header_with_tags.html' %} +{% extends 'styleguide2/includes/organisms/header/elections/simple_header_with_tags.html' %} {% block classes %} bg-pirati-yellow flex items-center w-full mb-10 pt-28 pb-8 @@ -11,7 +11,7 @@ {% endblock %} {% block after_heading %} - {% include 'patterns/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' tag_color_classes='bg-black text-white' %} <div class="flex justify-start"> <input diff --git a/shared/templates/styleguide2/includes/organisms/header/europarl/candidate_header.html b/shared/templates/styleguide2/includes/organisms/header/elections/candidate_header.html similarity index 73% rename from shared/templates/styleguide2/includes/organisms/header/europarl/candidate_header.html rename to shared/templates/styleguide2/includes/organisms/header/elections/candidate_header.html index 345c84e7..cb803c35 100644 --- a/shared/templates/styleguide2/includes/organisms/header/europarl/candidate_header.html +++ b/shared/templates/styleguide2/includes/organisms/header/elections/candidate_header.html @@ -1,4 +1,6 @@ -{% extends 'patterns/organisms/header/europarl/simple_header.html' %} +{% extends 'styleguide2/includes/organisms/header/elections/simple_header.html' %} + +{% load wagtailcore_tags wagtailimages_tags %} {% block classes %} bg-pirati-yellow flex items-center w-full pt-28 pb-8 @@ -25,7 +27,7 @@ {% endblock %} " > - {{ name }} + {{ title }} </h1> {% endblock %} @@ -52,25 +54,13 @@ [&_.content-block]:gap-4 " > - <div class="content-block"> - <p> - {{ description_1 }} - </p> - - <p> - {{ description_2 }} - </p> - - <p> - {{ description_3 }} - </p> - </div> + {{ perex|richtext }} </div> {% endblock %} {% block contact %} <div> - {% include 'patterns/molecules/blocks/inline_contact.html' %} + {% include 'styleguide2/includes/molecules/blocks/inline_contact.html' with phone=phone email=email social_links=social_links %} </div> {% endblock %} </div> @@ -80,9 +70,11 @@ flex justify-center items-start grow w-full " > + {% image image original as person_image %} + <img class="lg:w-3/5" - src="../../../../../static/images/mikulas-arrow.png" + src="{{ person_image.url }}" > </div> </div> diff --git a/shared/templates/styleguide2/includes/organisms/header/europarl/candidates_header.html b/shared/templates/styleguide2/includes/organisms/header/elections/candidates_header.html similarity index 65% rename from shared/templates/styleguide2/includes/organisms/header/europarl/candidates_header.html rename to shared/templates/styleguide2/includes/organisms/header/elections/candidates_header.html index ac66d1cd..6e1659c6 100644 --- a/shared/templates/styleguide2/includes/organisms/header/europarl/candidates_header.html +++ b/shared/templates/styleguide2/includes/organisms/header/elections/candidates_header.html @@ -1,4 +1,4 @@ -{% extends 'patterns/organisms/header/europarl/simple_header.html' %} +{% extends 'styleguide2/includes/organisms/header/elections/simple_header.html' %} {% block classes %} bg-pirati-yellow flex items-center w-full pt-28 pb-8 diff --git a/shared/templates/styleguide2/includes/organisms/header/elections/faq_header.html b/shared/templates/styleguide2/includes/organisms/header/elections/faq_header.html new file mode 100644 index 00000000..838dbe0a --- /dev/null +++ b/shared/templates/styleguide2/includes/organisms/header/elections/faq_header.html @@ -0,0 +1,3 @@ +{% extends 'styleguide2/includes/organisms/header/elections/simple_header_with_ui_switch.html' %} + +{% block extra_classes %}!mb-0{% endblock %} diff --git a/shared/templates/styleguide2/includes/organisms/header/europarl/simple_header.html b/shared/templates/styleguide2/includes/organisms/header/elections/simple_header.html similarity index 82% rename from shared/templates/styleguide2/includes/organisms/header/europarl/simple_header.html rename to shared/templates/styleguide2/includes/organisms/header/elections/simple_header.html index 18525839..759bc153 100644 --- a/shared/templates/styleguide2/includes/organisms/header/europarl/simple_header.html +++ b/shared/templates/styleguide2/includes/organisms/header/elections/simple_header.html @@ -1,4 +1,4 @@ -{% extends 'patterns/organisms/header/simple_header.html' %} +{% extends 'styleguide2/includes/organisms/header/simple_header.html' %} {% block classes %} bg-pirati-yellow flex items-center w-full mb-20 pt-28 pb-8 diff --git a/shared/templates/styleguide2/includes/organisms/header/elections/simple_header_with_tags.html b/shared/templates/styleguide2/includes/organisms/header/elections/simple_header_with_tags.html new file mode 100644 index 00000000..d08e8e87 --- /dev/null +++ b/shared/templates/styleguide2/includes/organisms/header/elections/simple_header_with_tags.html @@ -0,0 +1,5 @@ +{% extends 'styleguide2/includes/organisms/header/elections/simple_header.html' %} + +{% block after_heading %} + {% include 'styleguide2/includes/molecules/tags/tags.html' with classes='mb-4' tag_color_classes='bg-black text-white' %} +{% endblock %} diff --git a/shared/templates/styleguide2/includes/organisms/header/elections/simple_header_with_tags_and_navigation.html b/shared/templates/styleguide2/includes/organisms/header/elections/simple_header_with_tags_and_navigation.html new file mode 100644 index 00000000..ec7a56ac --- /dev/null +++ b/shared/templates/styleguide2/includes/organisms/header/elections/simple_header_with_tags_and_navigation.html @@ -0,0 +1,9 @@ +{% extends 'styleguide2/includes/organisms/header/elections/simple_header.html' %} + +{% block before_heading %} + {% include 'styleguide2/includes/atoms/header/elections/navigation.html' with classes='mb-6' %} +{% endblock %} + +{% block after_heading %} + {% include 'styleguide2/includes/molecules/tags/tags.html' with classes='mb-4 mt-4' tag_color_classes='bg-black text-white' %} +{% endblock %} diff --git a/shared/templates/styleguide2/includes/organisms/header/europarl/simple_header_with_ui_switch.html b/shared/templates/styleguide2/includes/organisms/header/elections/simple_header_with_ui_switch.html similarity index 90% rename from shared/templates/styleguide2/includes/organisms/header/europarl/simple_header_with_ui_switch.html rename to shared/templates/styleguide2/includes/organisms/header/elections/simple_header_with_ui_switch.html index 05088a37..cfdc0243 100644 --- a/shared/templates/styleguide2/includes/organisms/header/europarl/simple_header_with_ui_switch.html +++ b/shared/templates/styleguide2/includes/organisms/header/elections/simple_header_with_ui_switch.html @@ -1,4 +1,4 @@ -{% extends 'patterns/organisms/header/europarl/simple_header.html' %} +{% extends 'styleguide2/includes/organisms/header/elections/simple_header.html' %} {% block after_description %} <div diff --git a/shared/templates/styleguide2/includes/organisms/header/europarl/article_header.html b/shared/templates/styleguide2/includes/organisms/header/europarl/article_header.html deleted file mode 100644 index e573f117..00000000 --- a/shared/templates/styleguide2/includes/organisms/header/europarl/article_header.html +++ /dev/null @@ -1,9 +0,0 @@ -{% extends 'patterns/organisms/header/europarl/simple_header_with_tags_and_navigation.html' %} - -{% block before_heading %} - {% include 'patterns/atoms/header/europarl/navigation.html' with classes='mb-6' first_text=first_nav_text second_text=second_nav_text second_link=second_link %} -{% endblock %} - -{% block heading_classes %}!text-black head-8xl{% endblock %} - -{% block description_classes %}!text-black{% endblock %} diff --git a/shared/templates/styleguide2/includes/organisms/header/europarl/faq_header.html b/shared/templates/styleguide2/includes/organisms/header/europarl/faq_header.html deleted file mode 100644 index 4a5adf04..00000000 --- a/shared/templates/styleguide2/includes/organisms/header/europarl/faq_header.html +++ /dev/null @@ -1,3 +0,0 @@ -{% extends 'patterns/organisms/header/europarl/simple_header_with_ui_switch.html' %} - -{% block extra_classes %}!mb-0{% endblock %} diff --git a/shared/templates/styleguide2/includes/organisms/header/europarl/simple_header_with_tags.html b/shared/templates/styleguide2/includes/organisms/header/europarl/simple_header_with_tags.html deleted file mode 100644 index b0fb3ce2..00000000 --- a/shared/templates/styleguide2/includes/organisms/header/europarl/simple_header_with_tags.html +++ /dev/null @@ -1,5 +0,0 @@ -{% extends 'patterns/organisms/header/europarl/simple_header.html' %} - -{% block after_heading %} - {% include 'patterns/molecules/tags/tags.html' with classes='mb-4' tag_color_classes='bg-black text-white' %} -{% endblock %} diff --git a/shared/templates/styleguide2/includes/organisms/header/europarl/simple_header_with_tags_and_navigation.html b/shared/templates/styleguide2/includes/organisms/header/europarl/simple_header_with_tags_and_navigation.html deleted file mode 100644 index a50b5455..00000000 --- a/shared/templates/styleguide2/includes/organisms/header/europarl/simple_header_with_tags_and_navigation.html +++ /dev/null @@ -1,9 +0,0 @@ -{% extends 'patterns/organisms/header/europarl/simple_header.html' %} - -{% block before_heading %} - {% include 'patterns/atoms/header/europarl/navigation.html' with classes='mb-6' %} -{% endblock %} - -{% block after_heading %} - {% include 'patterns/molecules/tags/tags.html' with classes='mb-4 mt-4' tag_color_classes='bg-black text-white' %} -{% endblock %} diff --git a/shared/templates/styleguide2/includes/organisms/header/simple_header.html b/shared/templates/styleguide2/includes/organisms/header/simple_header.html index 008718d3..e1fe580d 100644 --- a/shared/templates/styleguide2/includes/organisms/header/simple_header.html +++ b/shared/templates/styleguide2/includes/organisms/header/simple_header.html @@ -4,54 +4,58 @@ bg-black flex items-center w-full mb-20 pt-28 pb-8 xl:pt-48 xl:pb-24 + + {% block extra_classes %}{% endblock %} {% endblock %} " > <div class="flex justify-start w-full"> <div class="container--wide w-full"> - <div class="text-white flex flex-col"> - {% block before_heading %}{% endblock %} - - {% block heading %} - <h1 - class=" - {% block heading_classes %} - mb-1 - - {% if is_short %}head-short{% endif %} - - {% if description %} - head-8xl - {% else %} - head-14xl - {% endif %} - {% endblock %} - " - > - {{ title }} - </h1> - {% endblock %} - - {% block after_heading %}{% endblock %} - - {% block description %} - {% if description %} - <p + {% block content %} + <div class="text-white flex flex-col"> + {% block before_heading %}{% endblock %} + + {% block heading %} + <h1 class=" - font-semibold text-lg leading-7 pr-4 + {% block heading_classes %} + mb-1 - xl:pr-0 + {% if is_short %}head-short{% endif %} - lg:max-w-screen-lg + {% if description %} + head-8xl + {% else %} + head-14xl + {% endif %} + {% endblock %} " > - {{ description }} - </p> - {% endif %} - {% endblock %} - - {% block after_description %}{% endblock %} - </div> + {{ title }} + </h1> + {% endblock %} + + {% block after_heading %}{% endblock %} + + {% block description %} + {% if description %} + <p + class=" + font-semibold text-lg leading-7 pr-4 + + xl:pr-0 + + lg:max-w-screen-lg + " + > + {{ description }} + </p> + {% endif %} + {% endblock %} + + {% block after_description %}{% endblock %} + </div> + {% endblock %} </div> </div> </header> diff --git a/shared/templates/styleguide2/includes/organisms/layout/elections/navbar.html b/shared/templates/styleguide2/includes/organisms/layout/elections/navbar.html new file mode 100644 index 00000000..db48f1d2 --- /dev/null +++ b/shared/templates/styleguide2/includes/organisms/layout/elections/navbar.html @@ -0,0 +1,24 @@ +{% extends 'styleguide2/includes/organisms/layout/navbar.html' %} + +{% load static %} + +{% block navbar_logo_images %} + <img class="navbar__logo--white w-[220px] lg:w-[280px]" src="{% static 'elections/logo-full-white.svg' %}" alt=""> + <img class="navbar__logo--black w-[220px] lg:w-[280px]" src="{% static 'elections/logo-full-black.svg' %}" alt=""> +{% endblock %} + +{% block popout_logo_image %} + <img + class="w-[220px] mt-3" + src="{% static 'elections/logo-full-black.svg' %}" + alt="" + > +{% endblock %} + +{% block extra_classes %} + navbar--europarl + + {% if is_transparent %}navbar--europarl-transparent{% endif %} +{% endblock %} + +{% block observer_script_toggled_class %}navbar--europarl-transparent{% endblock %} diff --git a/shared/templates/styleguide2/includes/organisms/layout/europarl/navbar.yaml b/shared/templates/styleguide2/includes/organisms/layout/elections/navbar.yaml similarity index 100% rename from shared/templates/styleguide2/includes/organisms/layout/europarl/navbar.yaml rename to shared/templates/styleguide2/includes/organisms/layout/elections/navbar.yaml diff --git a/shared/templates/styleguide2/includes/organisms/layout/europarl/navbar.html b/shared/templates/styleguide2/includes/organisms/layout/europarl/navbar.html deleted file mode 100644 index fff908e8..00000000 --- a/shared/templates/styleguide2/includes/organisms/layout/europarl/navbar.html +++ /dev/null @@ -1,22 +0,0 @@ -{% extends 'patterns/organisms/layout/navbar.html' %} - -{% block navbar_logo_images %} - <img class="navbar__logo--white w-[220px] lg:w-[280px]" src="../../../../../static/images/europarl/logo-full-white.svg" alt=""> - <img class="navbar__logo--black w-[220px] lg:w-[280px]" src="../../../../../static/images/europarl/logo-full-black.svg" alt=""> -{% endblock %} - -{% block popout_logo_image %} - <img - class="w-[220px] mt-3" - src="../../../../../static/images/europarl/logo-full-black.svg" - alt="" - > -{% endblock %} - -{% block extra_classes %} - navbar--europarl - - {% if is_transparent %}navbar--europarl-transparent{% endif %} -{% endblock %} - -{% block observer_script_toggled_class %}navbar--europarl-transparent{% endblock %} diff --git a/shared/templates/styleguide2/includes/organisms/layout/navbar.html b/shared/templates/styleguide2/includes/organisms/layout/navbar.html index a57ceb96..50eff8d4 100644 --- a/shared/templates/styleguide2/includes/organisms/layout/navbar.html +++ b/shared/templates/styleguide2/includes/organisms/layout/navbar.html @@ -2,13 +2,17 @@ <!-- Navbar --> <nav + id="navbar" class=" - static absolute left-0 top-0 z-20 w-full duration-200 navbar + fixed left-0 top-[-1px] z-20 w-full duration-200 navbar + xl:absolute xl:bg-transparent - {% if is_transparent %}navbar--transparent{% endif %} - {% if is_on_dark_background %}navbar--on-dark-bg{% endif %} + {% block extra_classes %} + {% if is_transparent %}navbar--transparent{% endif %} + {% if is_on_dark_background %}navbar--on-dark-bg{% endif %} + {% endblock %} " > <div class="container--wide py-3 xl:py-6 flex justify-between items-center"> @@ -16,8 +20,10 @@ <div class="flex items-center xl:items-start"> <!-- BEGIN Logo--> <a href="{{ page.root_page.url }}" class="z-20 xl:mt-2"> - <img class="navbar__logo--white w-[150px] lg:w-[180px]" src="{% static 'styleguide2/images/logo-full-white.svg' %}" alt=""> - <img class="navbar__logo--black w-[150px] lg:w-[180px]" src="{% static 'styleguide2/images/logo-full-black.svg' %}" alt=""> + {% block navbar_logo_images %} + <img class="navbar__logo--white w-[150px] lg:w-[180px]" src="{% static 'styleguide2/images/logo-full-white.svg' %}" alt=""> + <img class="navbar__logo--black w-[150px] lg:w-[180px]" src="{% static 'styleguide2/images/logo-full-black.svg' %}" alt=""> + {% endblock %} </a> <!-- END Logo --> </div> @@ -140,11 +146,13 @@ > <div class="grid-container"> <div class="grid-left-side"> - <img - class="w-[150px] mt-3" - src="{% static 'styleguide2/images/logo-full-black.svg' %}" - alt="" - > + {% block popout_logo_image %} + <img + class="w-[150px] mt-3" + src="{% static 'styleguide2/images/logo-full-black.svg' %}" + alt="" + > + {% endblock %} </div> </div> @@ -203,3 +211,37 @@ </div> </div> </nav> + +{% block observer_script %} + <script> + window.onscroll = () => { + const screenWidth = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) + + if (screenWidth > 1199) { + return + } + + const navbar = document.querySelector("#navbar") + const transparentClass = "{% block observer_script_toggled_class %}navbar--transparent{% endblock %}" + + if (window.scrollY === 0) { + navbar.classList.add(transparentClass) + } else { + navbar.classList.remove(transparentClass) + } + } + + const menuItems = document.querySelectorAll(".navbar__menu-item") + + menuItems.forEach( + (element) => { + element.addEventListener( + "click", + (event) => { + document.getElementById("navbar__mobile-menu__toggle").checked = false + } + ) + } + ) + </script> +{% endblock %} -- GitLab