Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions manage_breast_screening/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ def list_env(key):
"APP_DIRS": True,
"OPTIONS": {
"environment": "manage_breast_screening.config.jinja2_env.environment",
"context_processors": [
"manage_breast_screening.core.context_processors.nav_active",
],
"undefined": ChainableUndefined,
},
},
Expand Down
6 changes: 6 additions & 0 deletions manage_breast_screening/core/context_processors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def nav_active(request):
if request.path.startswith("/clinics/"):
active = "clinics"
else:
active = "home"
return {"navActive": active}
4 changes: 2 additions & 2 deletions manage_breast_screening/core/jinja2/layout-app.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{% block header %}
{{ header({
"service": {
"name": "Manage breast screening"
"text": "Manage breast screening"
},
"account": {
"items": header_account_items(request.user)
Expand All @@ -29,7 +29,7 @@
},
{
"href": "/clinics/",
"text": "Clinics",
"text": "Screening",
'current': true if navActive == "clinics"
}
]
Expand Down
3 changes: 3 additions & 0 deletions manage_breast_screening/core/template_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ def _user_name_and_role_item(user):

def header_account_items(user):
items = []
if user.is_authenticated:
if user.current_provider:
items.append({"text": user.current_provider.name, "icon": False})

user_name_and_role = _user_name_and_role_item(user)
if user_name_and_role:
Expand Down