Skip to content

Commit

Permalink
Merge #185 - Fix active state for nested URLs in navigation
Browse files Browse the repository at this point in the history
Pull-request: #185
Signed-off-by: William Desportes <[email protected]>
  • Loading branch information
williamdes committed Jan 6, 2025
2 parents 442b73a + 0c601c2 commit c159149
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pmaweb/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,13 @@ def menu(request):
else:
urlname = 'home'

active = (
request.resolver_match and
urlname == request.resolver_match.url_name
)
if urlname == 'home':
active = request.path == reverse(urlname)
else:
active = (
request.resolver_match and
request.path.startswith(reverse(urlname))
)

result.append({
'title': title,
Expand Down

0 comments on commit c159149

Please sign in to comment.