From bc32bc7d3f6b27d70a52a7436e6a6a7227a7e597 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Valenta?= <tomas@imaniti.org> Date: Wed, 12 Jun 2024 17:58:26 +0200 Subject: [PATCH] temporary person page attr workaround --- shared/models/main.py | 10 +++++++++- uniweb/templates/uniweb/blocks/people_group_block.html | 6 +++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/shared/models/main.py b/shared/models/main.py index ac8e9e91..42e7f2e6 100644 --- a/shared/models/main.py +++ b/shared/models/main.py @@ -261,7 +261,15 @@ class PageInMenuMixin(Page): return menu.value["title"] elif menu.block_type == "menu_parent": for item in menu.value["menu_items"]: - if item["link"].strip() == instance.full_url.strip(): + if ( + item["link"].strip() + if item["link"] is not None + else "" + ) == ( + instance.full_url.strip() + if instance.full_url + else "" + ): return menu.value["title"] if item["page"] is None: diff --git a/uniweb/templates/uniweb/blocks/people_group_block.html b/uniweb/templates/uniweb/blocks/people_group_block.html index d268139f..b75071db 100644 --- a/uniweb/templates/uniweb/blocks/people_group_block.html +++ b/uniweb/templates/uniweb/blocks/people_group_block.html @@ -5,7 +5,11 @@ <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 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 %} + {% if person_details.position %} + {% include "shared/person_badge_snippet.html" with title=person_details.position %} + {% else %} + {% include "shared/person_badge_snippet.html" with title=person_page.job %} + {% endif %} {% endwith %} {% endfor %} </div> -- GitLab