Skip to content

Commit

Permalink
Added admin to nav bar (#279)
Browse files Browse the repository at this point in the history
* Added admin to nav bar

* bumped chart version

* fixed failing test
  • Loading branch information
jamesstottmoj authored Sep 12, 2024
1 parent 31c988c commit 5d01228
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions ap/core/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ def nav_items(request):
"url": reverse("database_access:list"),
"active": request.get_full_path() == reverse("database_access:list"),
},
{
"name": "Admin",
"url": reverse("admin:index"),
"hide": not request.user.is_staff,
},
]
}

Expand Down
4 changes: 2 additions & 2 deletions chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ apiVersion: v2
name: analytical-platform-ui
description: Analytical Platform UI
type: application
version: 0.2.2
appVersion: 0.2.2
version: 0.2.3
appVersion: 0.2.3
icon: https://upload.wikimedia.org/wikipedia/en/thumb/4/4a/Ministry_of_Justice_logo_%28United_Kingdom%29.svg/611px-Ministry_of_Justice_logo_%28United_Kingdom%29.svg.png
maintainers:
- name: moj-data-platform-robot
Expand Down
4 changes: 3 additions & 1 deletion templates/includes/nav_item.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<li class="{{ level }}item">
<a class="{{ level }}link" {% if item.active %}aria-current="page" {% endif %}href="{{ item.url }}">{{ item.name }}</a>
{% if not item.hide %}
<a class="{{ level }}link" {% if item.active %}aria-current="page" {% endif %}href="{{ item.url }}">{{ item.name }}</a>
{% endif %}
</li>
1 change: 1 addition & 0 deletions tests/core/test_context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def test_nav_items(self, request_obj):
{"name": "Home", "url": "/", "active": True},
{"name": "QuickSight", "url": reverse("quicksight:index"), "active": False},
{"name": "Database access", "url": reverse("database_access:list"), "active": False},
{"name": "Admin", "url": reverse("admin:index"), "hide": not request_obj.user.is_staff},
]
assert nav_items(request=request_obj) == {"nav_items": expected}

Expand Down

0 comments on commit 5d01228

Please sign in to comment.