fmartingr
/
shelfzilla
Archived
1
0
Fork 0

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:
Felipe Martin 2014-04-25 17:23:50 +02:00
parent 4e9205e5cb
commit 56a471e9f9
3 changed files with 13 additions and 6 deletions

View File

@ -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

View File

@ -62,6 +62,10 @@
}
}
}
.active {
color: #fff;
background-color: #000;
}
}
.alert-error {

View File

@ -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 %}