From fa76b10f73ec76f504acaa9c3bc3c9d056ed7bae Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 8 Sep 2021 17:55:45 +0530 Subject: [PATCH] Show member submenu conditionally on de/fr pages --- publichealth/home/templatetags/navigation.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/publichealth/home/templatetags/navigation.py b/publichealth/home/templatetags/navigation.py index b9b66ba..316e5b5 100644 --- a/publichealth/home/templatetags/navigation.py +++ b/publichealth/home/templatetags/navigation.py @@ -67,13 +67,26 @@ def top_menu(context, parent, calling_page=None): } def menuitems_children(parent): + remove_mitglied = False + remove_devenez = False + if 'Qui sommes-nous' in parent.title: + remove_mitglied = True + if 'Über uns' in parent.title: + remove_devenez = True menuitems_children = parent.get_children().live().in_menu().specific() + out_menuitems_children = [] for menuitem in menuitems_children: try: menuitem.title = menuitem.trans_title + if 'devenez' in menuitem.title.lower() and remove_devenez: + continue + elif 'mitglied werden' in menuitem.title.lower() and remove_mitglied: + continue + else: + out_menuitems_children.append(menuitem) except AttributeError: pass - return menuitems_children + return out_menuitems_children # Retrieves the children of the top menu items for the drop downs @register.inclusion_tag('tags/top_menu_children.html', takes_context=True)