From 1b50b8b6b1574a243b2f981af2b6212e3cdf99fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Valenta?= <git@imaniti.org> Date: Fri, 10 Mar 2023 08:25:39 +0100 Subject: [PATCH] add uniweb people templates --- uniweb/models.py | 7 +- .../uniweb/blocks/people_group_block.html | 12 ++ .../templates/uniweb/uniweb_people_page.html | 17 ++ .../templates/uniweb/uniweb_person_page.html | 179 ++++++++++++++++++ 4 files changed, 213 insertions(+), 2 deletions(-) create mode 100644 uniweb/templates/uniweb/blocks/people_group_block.html create mode 100644 uniweb/templates/uniweb/uniweb_people_page.html create mode 100644 uniweb/templates/uniweb/uniweb_person_page.html diff --git a/uniweb/models.py b/uniweb/models.py index 947ffc2e..e68eb96c 100644 --- a/uniweb/models.py +++ b/uniweb/models.py @@ -202,6 +202,8 @@ class MenuItemBlock(blocks.StructBlock): "uniweb.UniwebFlexiblePage", "uniweb.UniwebArticlesIndexPage", "uniweb.UniwebFormPage", + "uniweb.UniwebPeoplePage", + "uniweb.UniwebPersonPage", ], ) @@ -387,6 +389,7 @@ class UniwebHomePage( "uniweb.UniwebFlexiblePage", "uniweb.UniwebArticlesIndexPage", "uniweb.UniwebFormPage", + "uniweb.UniwebPeoplePage", ] ### OTHERS @@ -588,8 +591,8 @@ class UniwebFormPage( return form -# Don't waste time making a new mixin for this, we'll be doing Octopus imports -# within a short while. +# Don't waste time making a new mixin for this, +# we'll be doing Octopus imports within a short while. class UniwebPersonPage( ExtendedMetadataPageMixin, SubpageMixin, MetadataPageMixin, Page ): diff --git a/uniweb/templates/uniweb/blocks/people_group_block.html b/uniweb/templates/uniweb/blocks/people_group_block.html new file mode 100644 index 00000000..752458f0 --- /dev/null +++ b/uniweb/templates/uniweb/blocks/people_group_block.html @@ -0,0 +1,12 @@ +<section> + <h2 class="head-heavy-base mb-4"> + {{ self.group_title }} + </h2> + <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 row-gap-8 col-gap-8"> + {% for person_details in self.person_list %} + {% with person_details.person as person_page %} + {% include "shared/person_badge_snippet.html" with title=person_details.position|default:person_page.job_function %} + {% endwith %} + {% endfor %} + </div> +</section> diff --git a/uniweb/templates/uniweb/uniweb_people_page.html b/uniweb/templates/uniweb/uniweb_people_page.html new file mode 100644 index 00000000..03470d5c --- /dev/null +++ b/uniweb/templates/uniweb/uniweb_people_page.html @@ -0,0 +1,17 @@ +{% extends "uniweb/base.html" %} +{% load wagtailcore_tags wagtailimages_tags shared_filters %} + +{% block content %} + <header> + <h1 itemprop="headline" class="head-alt-md md:head-alt-lg max-w-5xl mb-8"> + {{ page.title }} + </h1> + </header> + + {% for block in page.content %} + {% include_block block %} + {% if not forloop.last %} + <hr class="hr--big"> + {% endif %} + {% endfor %} +{% endblock %} diff --git a/uniweb/templates/uniweb/uniweb_person_page.html b/uniweb/templates/uniweb/uniweb_person_page.html new file mode 100644 index 00000000..9d1b880f --- /dev/null +++ b/uniweb/templates/uniweb/uniweb_person_page.html @@ -0,0 +1,179 @@ +{% extends "uniweb/base.html" %} +{% load static wagtailcore_tags wagtailimages_tags shared_filters %} + +{% block subheader %} + {% image page.get_background_photo fill-1920x500-c75 jpegquality-80 as bg_img %} + + <header class="hero hero--image pt-16 pb-24 lg:pt-32 pb-24" style="--image-url: url({{ bg_img.full_url }})"> + <div class="container container--default text-center lg:text-left"> + <h1 class="head-alt-lg md:head-alt-xl text-shadow-lg max-w-2xl"> + {{ page.title }} + </h1> + <h2 class="head-xs text-shadow-lg mt-2 max-w-xl"> + {{ page.job | default_if_none:"" }} + </h2> + </div> + </header> +{% endblock %} + +{% block container_spacing %}py-8 lg:pb-16{% endblock %} + +{% block content %} + <div class="flex flex-col lg:flex-row lg:space-x-8 xl:space-x-16"> + <section class="lg:w-3/5 xl:w-2/3"> + <div class="content-block w-full"> + {{ page.text|richtext }} + </div> + </section> + + <section class="lg:w-2/5 xl:w-1/3 pt-8 lg:pt-0 order-first lg:order-last candidate-detail__sidebar"> + <div class="container-padding--zero lg:card lg:elevation-10 lg:container-padding--auto"> + <div class="card__body p-4 lg:p-8"> + <div class="text-center mb-8"> + <div class="avatar avatar--2xl lg:avatar--3xl avatar--bordered candidate-detail__avatar"> + {% if page.profile_photo %} + {% image page.profile_photo fill-208x208 as profile_img %} + {% image page.profile_photo fill-416x416 as profile_img_2x %} + <img src="{{ profile_img.url }}" srcset="{{ profile_img.url }}, {{ profile_img_2x.url }} 2x" alt="{{ page.profile_photo }}"> + {% else %} + <img src="{% static "shared/img/unknown_pirate_416x416.jpg" %}" alt="{{ person_page.title }}"/> + {% endif%} + </div> + + </div> + {% if page.facebook_url or page.instagram_url or page.twitter_url or page.youtube_url or page.flickr_url or page.custom_web_url or page.other_urls %} + <div class="social-icon-group space-x-2 text-lg"> + {% if page.facebook_url %} + <a href="{{ page.facebook_url }}" target="_blank" class="social-icon" rel="noreferrer noopener"> + <i class="ico--facebook"></i> + </a> + {% endif %} + {% if page.instagram_url %} + <a href="{{ page.instagram_url }}" target="_blank" class="social-icon" rel="noreferrer noopener"> + <i class="ico--instagram"></i></a> + {% endif %} + {% if page.twitter_url %} + <a href="{{ page.twitter_url }}" target="_blank" class="social-icon" rel="noreferrer noopener"> + <i class="ico--twitter"></i> + </a> + {% endif %} + {% if page.youtube_url %} + <a href="{{ page.youtube_url }}" target="_blank" class="social-icon" rel="noreferrer noopener"> + <i class="ico--youtube"></i> + </a> + {% endif %} + {% if page.flickr_url %} + <a href="{{ page.flickr_url }}" target="_blank" class="social-icon" rel="noreferrer noopener"> + <i class="ico--flickr"></i> + </a> + {% endif %} + {% if page.custom_web_url %} + <a href="{{ page.custom_web_url }}" target="_blank" class="social-icon" rel="noreferrer noopener"> + <i class="ico--globe"></i> + </a> + {% endif %} + {% for person_link_block in page.other_urls %} + <a + href="{{ person_link_block.value.url }}" + target="_blank" + class="social-icon" + rel="noreferrer noopener" + title="{{ person_link_block.value.title }}" + > + <i class="{% firstof person_link_block.value.custom_icon 'ico--globe' %}"></i> + </a> + {% endfor %} + </div> + {% endif %} + + {% if page.is_pirate %} + <hr> + <div class="flex items-center"> + <div class="avatar w-6 mr-2"> + <img src="{% static "elections2021/images/logo-pirati-21px.svg" %}"> + </div> + <span class="font-bold font-condensed">Pirátská strana</span> + </div> + {% endif %} + + {% if not page.is_pirate and page.other_party %} + <hr> + <div class="flex items-center"> + {% if page.other_party_logo %} + {% image page.other_party_logo width-48 as logo_img %} + <div class="avatar w-6 mr-2"> + <img src="{{ logo_img.url }}" alt="{{ page.other_party }}"> + </div> + {% endif %} + <span class="font-bold font-condensed">{{ page.other_party }}</span> + </div> + {% endif %} + + {% if page.phone or page.email and page.show_email %} + <hr> + <div class="content-block"> + <div class="space-y-4"> + {% if page.phone %} + <div> + <h4>Telefon</h4> + <a href="tel:{{ page.phone }}" class="contact-line icon-link content-block--nostyle"> + <i class="ico--phone"></i><span>{{ page.phone }}</span> + </a> + </div> + {% endif %} + + {% if page.email and page.show_email %} + <div> + <h4>Email</h4> + <a href="mailto:{{ page.email }}" class="contact-line icon-link content-block--nostyle"> + <i class="ico--envelope"></i><span>{{ page.email }}</span> + </a> + </div> + {% endif %} + </div> + </div> + {% endif %} + + {% if random_people %} + <hr> + <div class="content-block"> + <h2>Lidé</h2> + + <div class="space-y-4 mt-4"> + {% for person in random_people %} + {% include "shared/person_badge_snippet.html" with person_page=person skipcontacts=1 %} + {% endfor %} + </div> + + <a href="{{ page.root_page.people_page.url }}" + class="btn btn--icon btn--violet-500 btn--fullwidth btn--hoveractive pt-4"> + <div class="btn__body-wrap"> + <div class="btn__body ">Poznejte celý náš tým</div> + <div class="btn__icon "> + <i class="ico--chevron-right"></i> + </div> + </div> + </a> + </div> + {% endif %} + {% comment %} <hr> {% endcomment %} +{# <h2>Kancelář</h2>#} +{# <h4>Poslanecká sněmovna</h4>#} +{# <p>#} +{# Jiřího náměstí 39, 290 33 Poděbrady#} +{# </p>#} +{# <iframe#} +{# src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d82007.99920528589!2d15.688131074078123!3d50.034780639742856!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x470dc94b239307b5%3A0x12d59894ccf624ae!2sPardubice!5e0!3m2!1scs!2scz!4v1589382658695!5m2!1scs!2scz"#} +{# width="100%" height="300" id="mapa-mobile" frameborder="0" style="border:0;" allowfullscreen=""#} +{# aria-hidden="false" tabindex="0"></iframe>#} +{# <h4>Otevírací doba</h4>#} +{# <p>Pondělí 14:00 - 18:00 objednat se přes: kancelář-podebrady@pirati.cz nebo 778 111 462.</p>#} + + <!-- Mobile divider --> + <hr class="block lg:hidden"> + </div> + </div> + </section> + </div> + +{% endblock %} -- GitLab