Fixed navbar links not being marked as active. Also improved pjax-nav behaviour allowing certain links to unmark active navigation
Fixes #6
This commit is contained in:
parent
4e9205e5cb
commit
56a471e9f9
|
@ -50,6 +50,9 @@ $ ->
|
|||
nav_element.siblings('.active').removeClass('active')
|
||||
nav_element.addClass('active')
|
||||
|
||||
if elem.is('[data-pjax-unnav]')
|
||||
$('[data-pjax-nav].active').removeClass('active')
|
||||
|
||||
if elem.is('[pjax-nopush]')
|
||||
push = false
|
||||
if not pjax
|
||||
|
|
|
@ -62,6 +62,10 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
.active {
|
||||
color: #fff;
|
||||
background-color: #000;
|
||||
}
|
||||
}
|
||||
|
||||
.alert-error {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" data-pjax href="{% url "homepage" %}">Shelfzilla</a>
|
||||
<a data-pjax-unnav class="navbar-brand" data-pjax href="{% url "homepage" %}">Shelfzilla</a>
|
||||
</div>
|
||||
|
||||
<!-- Collect the nav links, forms, and other content for toggling -->
|
||||
|
@ -40,14 +40,14 @@
|
|||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ user.username }} <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
{% if user.is_superuser %}
|
||||
<li><a href="/admin/">Admin</a></li>
|
||||
<li><a data-pjax-unnav href="/admin/">Admin</a></li>
|
||||
{% endif %}
|
||||
<li><a href="{% url 'profile' %}" data-pjax>{% trans "Profile" %}</a></li>
|
||||
<li><a data-pjax-unnav href="{% url 'profile' %}" data-pjax>{% trans "Profile" %}</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="#">{% trans "My collection" %}</a></li>
|
||||
<li><a href="#">{% trans "My wishlist" %}</a></li>
|
||||
<li><a data-pjax-unnav href="#">{% trans "My collection" %}</a></li>
|
||||
<li><a data-pjax-unnav href="#">{% trans "My wishlist" %}</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="{% url "logout" %}">{% trans "Logout" %}</a></li>
|
||||
<li><a data-pjax-unnav href="{% url "logout" %}">{% trans "Logout" %}</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
{% else %}
|
||||
|
|
Reference in New Issue