Add 'active' tag to show active page in navs.
This commit is contained in:
parent
57d5b3f131
commit
620796448d
|
@ -1,4 +1,5 @@
|
|||
{% load static %}
|
||||
{% load base_extras %}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html class="h-100" lang="en">
|
||||
|
@ -22,8 +23,9 @@
|
|||
|
||||
<div class="collapse navbar-collapse" id="navbar-collapse">
|
||||
<div class="navbar-nav mr-auto">
|
||||
<a class="nav-item nav-link" href="{% url 'raid_calendar' %}">Raids</a>
|
||||
<a class="nav-item nav-link" href="{% url 'attendance' %}">Attendance</a>
|
||||
<a class="nav-item nav-link {% active 'raid_calendar' %}" href="{% url 'raid_calendar' %}">Raids</a>
|
||||
<a class="nav-item nav-link {% active 'attendance' %}" href="{% url 'attendance' %}">Attendance</a>
|
||||
<a class="nav-item nav-link {% active 'bank' %}" href="{% url 'bank' %}">Bank</a>
|
||||
<!--<a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">DKP</a>-->
|
||||
</div>
|
||||
{% if user.is_authenticated %}
|
||||
|
|
0
drakul/base/templatetags/__init__.py
Normal file
0
drakul/base/templatetags/__init__.py
Normal file
10
drakul/base/templatetags/base_extras.py
Normal file
10
drakul/base/templatetags/base_extras.py
Normal file
|
@ -0,0 +1,10 @@
|
|||
from django import template
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def active(context, url_name):
|
||||
if context["request"].resolver_match.url_name == url_name:
|
||||
return "active"
|
||||
return ""
|
Loading…
Reference in a new issue