From a598fc5858f31b09e8394484fa66082666dd2730 Mon Sep 17 00:00:00 2001 From: Ondrej Rehounek <ondra.rehounek@seznam.cz> Date: Wed, 16 Nov 2022 17:15:09 +0100 Subject: [PATCH] main: november updates vol. 2 --- main/models.py | 10 ++++++++++ main/templates/main/blocks/news_block.html | 7 ++++++- main/templates/main/includes/href_button.html | 2 +- .../main/includes/href_button_secondary.html | 4 ++-- .../main/includes/newsletter_section.html | 16 ++++++++++------ 5 files changed, 29 insertions(+), 10 deletions(-) diff --git a/main/models.py b/main/models.py index 4a58027f..9b26987e 100644 --- a/main/models.py +++ b/main/models.py @@ -255,6 +255,10 @@ class MainHomePage( def newsletter_subscribe_url(self): return self.url + self.reverse_subpage("newsletter_subscribe") + @property + def articles_page(self): + return self._first_subpage_of_type(MainArticlesPage) + @property def root_page(self): return self @@ -280,6 +284,12 @@ class MainHomePage( return HttpResponseRedirect(self.url) return HttpResponseRedirect(self.url) + def _first_subpage_of_type(self, page_type) -> Page or None: + try: + return self.get_descendants().type(page_type).live().specific()[0] + except IndexError: + return None + class MainArticlesPage( ExtendedMetadataPageMixin, SubpageMixin, MetadataPageMixin, Page diff --git a/main/templates/main/blocks/news_block.html b/main/templates/main/blocks/news_block.html index 9d115203..e1e6b31c 100644 --- a/main/templates/main/blocks/news_block.html +++ b/main/templates/main/blocks/news_block.html @@ -21,11 +21,16 @@ </div> </div> - <div class="__js-root"> + <div class="__js-root mb-20"> <ui-article-carousel> {% include 'main/includes/article_carousel_item.html' with article_carousel_list=article_carousel_list %} </ui-article-carousel> </div> + + <div class="text-center w-full"> + {% include 'main/includes/href_button.html' with btn_link=page.root_page.articles_page.url btn_text="Více aktualit" size_classes="h-14 w-44" %} + </div> + {% endif %} </div> </div> diff --git a/main/templates/main/includes/href_button.html b/main/templates/main/includes/href_button.html index 68a7f41c..9f00ff26 100644 --- a/main/templates/main/includes/href_button.html +++ b/main/templates/main/includes/href_button.html @@ -1,6 +1,6 @@ <a href="{{ btn_link }}" class="btn btn--black btn--to-yellow-500 btn--hoveractive uppercase {{ extra_classes }}"> <span class="btn__body-wrap w-40 h-11"> - <span class="btn__body text-lg lg:text-base xl:w-auto w-40 h-11"> + <span class="btn__body text-lg lg:text-base xl:w-auto {{ size_classes | default_if_none:"w-40 h-11" }}"> {{ btn_text | default_if_none:"Číst dále" }} </span> </span> diff --git a/main/templates/main/includes/href_button_secondary.html b/main/templates/main/includes/href_button_secondary.html index 69cc1439..c909b041 100644 --- a/main/templates/main/includes/href_button_secondary.html +++ b/main/templates/main/includes/href_button_secondary.html @@ -1,6 +1,6 @@ <a href="{{ btn_link }}" class="btn btn--white btn--to-black btn--hoveractive uppercase {{ extra_classes }}"> - <span class="btn__body-wrap w-36 h-11"> - <span class="btn__body text-lg lg:text-base xl:w-auto w-36 h-11"> + <span class="btn__body-wrap w-40 h-11"> + <span class="btn__body text-lg lg:text-base xl:w-auto w-40 h-11"> {{ btn_text | default_if_none:"Číst dále" }} </span> </span> diff --git a/main/templates/main/includes/newsletter_section.html b/main/templates/main/includes/newsletter_section.html index ee7d8183..a4603c95 100644 --- a/main/templates/main/includes/newsletter_section.html +++ b/main/templates/main/includes/newsletter_section.html @@ -9,13 +9,17 @@ url('{% static 'main/images/background-images/bg-bartos-newsletter.jpg' %}')" > <div class="grid-container mt-20 xl:mt-0 xl:items-center z-10"> - <div class="grid-full newsletter-grid"> + <div> <img src="{% static 'main/images/lahev.svg' %}" alt="newsletter_icon" class="newsletter-grid__icon text-7xl xl:text-9xl w-32"> - <span class="newsletter-grid__additional-text uppercase text-xl xl:text-base font-bold mb-2 xl:w-full"> - Fake news tam nenajdeš, ale dozvíš se co chystáme doopravdy! - </span> - <h5 class="newsletter-grid__main-text font-alt text-6xl xl:text-7xl uppercase">Odebírej náš newsletter</h5> - <div class="newsletter-grid__input flex flex-col items-start"> + </div> + <div> + <h5 class="font-alt mb-2 text-6xl xl:text-7xl uppercase"> + Odebírej náš newsletter + </h5> + <span class="inline-block uppercase text-xl xl:text-base font-bold mb-4 xl:w-full"> + Fake news tam nenajdeš, ale dozvíš se co chystáme doopravdy! + </span> + <div class="flex flex-col items-start"> <form method="post" class="w-full max-w-md" action="{{ page.root_page.newsletter_subscribe_url }}"> {% csrf_token %} <input type="hidden" name="return_page_id" value="{{ page.id }}"> -- GitLab