diff --git a/app/navigation.py b/app/navigation.py index d4faadcdf..cf5b5b715 100644 --- a/app/navigation.py +++ b/app/navigation.py @@ -328,6 +328,12 @@ class HeaderNavigation(Navigation): 'whitelist', } + # header HTML now comes from GOVUK Frontend so requires a boolean, not an attribute + def is_selected(self, navigation_item): + if request.endpoint in self.mapping[navigation_item]: + return True + return False + class MainNavigation(Navigation): diff --git a/app/templates/admin_template.html b/app/templates/admin_template.html index d2d305ac5..24e99e2eb 100644 --- a/app/templates/admin_template.html +++ b/app/templates/admin_template.html @@ -31,38 +31,95 @@

{% endblock %} -{% block header_class %}with-proposition{% endblock %} -{% block proposition_header %} -
-
- Menu - -
-
+{% block header %} + {% if current_user.is_authenticated %} + {% if current_user.platform_admin %} + {% set navigation = [ + { + "href": url_for('main.support'), + "text": "Support", + "active": header_navigation.is_selected('support') + }, + { + "href": url_for('main.documentation'), + "text": "Documentation", + "active": header_navigation.is_selected('documentation') + }, + { + "href": url_for('main.user_profile'), + "text": current_user.name, + "active": header_navigation.is_selected('user-profile') + }, + { + "href": url_for('main.platform_admin'), + "text": "Platform admin", + "active": header_navigation.is_selected('platform-admin') + }, + { + "href": url_for('main.sign_out'), + "text": "Sign out" + } + ] %} + {% else %} + {% set navigation = [ + { + "href": url_for('main.support'), + "text": "Support", + "active": header_navigation.is_selected('support') + }, + { + "href": url_for('main.documentation'), + "text": "Documentation", + "active": header_navigation.is_selected('documentation') + }, + { + "href": url_for('main.user_profile'), + "text": current_user.name, + "active": header_navigation.is_selected('user-profile') + }, + { + "href": url_for('main.sign_out'), + "text": "Sign out" + } + ] %} + {% endif %} + {% else %} + {% set navigation = [ + { + "href": url_for('main.support'), + "text": "Support", + "active": header_navigation.is_selected('support') + }, + { + "href": url_for('main.features'), + "text": "Features", + "active": header_navigation.is_selected('features') + }, + { + "href": url_for('main.pricing'), + "text": "Pricing", + "active": header_navigation.is_selected('pricing') + }, + { + "href": url_for('main.documentation'), + "text": "Documentation", + "active": header_navigation.is_selected('documentation') + }, + { + "href": url_for('main.sign_in'), + "text": "Sign in", + "active": header_navigation.is_selected('sign-in') + } + ] %} + {% endif %} + + {{ govukHeader({ + "homepageUrl": url_for('main.show_accounts_or_dashboard'), + "productName": "Notify", + "navigation": navigation + }) }} {% endblock %} - -{% set global_header_text = "GOV.UK Notify"|safe %} - -{% set homepage_url = url_for('main.show_accounts_or_dashboard') %} - {% block content %} {% block fullwidth_content %}{% endblock %} {% endblock %}