Mark 'active' navbar items accordingly, using django-activeurl

This commit is contained in:
Danielle McLean 2017-10-25 00:40:38 +11:00
parent 3151621acb
commit 9efb167bc9
Signed by: 00dani
GPG key ID: 5A5D2D1AFF12EEC5
6 changed files with 55 additions and 7 deletions

View file

@ -16,6 +16,7 @@ python-memcached = "*"
django-favicon-plus = "*" django-favicon-plus = "*"
django-meta = "*" django-meta = "*"
django-redis-cache = "*" django-redis-cache = "*"
django-activeurl = "*"
[dev-packages] [dev-packages]

48
Pipfile.lock generated
View file

@ -1,7 +1,7 @@
{ {
"_meta": { "_meta": {
"hash": { "hash": {
"sha256": "fa6658473328c969ebdea65f63e97d71b2c184e06918229b969cf0585a9d2a7b" "sha256": "6851dbdc8edfb1aab7ae43bc03ca775af0345e3f94ec032be0fb6f0e33aa2755"
}, },
"host-environment-markers": { "host-environment-markers": {
"implementation_name": "cpython", "implementation_name": "cpython",
@ -34,6 +34,12 @@
], ],
"version": "==1.11.6" "version": "==1.11.6"
}, },
"django-activeurl": {
"hashes": [
"sha256:7ebc4a34f91e18f29eb02bfac503057d69b4e1b6f9e8dd1297798387876e54da"
],
"version": "==0.1.11"
},
"django-appconf": { "django-appconf": {
"hashes": [ "hashes": [
"sha256:ddab987d14b26731352c01ee69c090a4ebfc9141ed223bef039d79587f22acd9", "sha256:ddab987d14b26731352c01ee69c090a4ebfc9141ed223bef039d79587f22acd9",
@ -41,6 +47,13 @@
], ],
"version": "==1.0.2" "version": "==1.0.2"
}, },
"django-classy-tags": {
"hashes": [
"sha256:f6d12f5a4df3e387795a0d9ef2836af389cae9a1fbebda035dac043d4722b1f7",
"sha256:792f9161d0e22d55b4fab6fc297bab8ab072ffaa3075b227613a6d8473624db8"
],
"version": "==0.8.0"
},
"django-compat": { "django-compat": {
"hashes": [ "hashes": [
"sha256:b20fb26d15bbedbf26fb274eb400d6fad2a23655eb5741ae258d39557b5fc5a3" "sha256:b20fb26d15bbedbf26fb274eb400d6fad2a23655eb5741ae258d39557b5fc5a3"
@ -80,6 +93,39 @@
], ],
"version": "==19.7.1" "version": "==19.7.1"
}, },
"lxml": {
"hashes": [
"sha256:7a8715539adb41c78129983ba69d852e0102a3f51d559eeb91dce1f6290c4ad0",
"sha256:d3a98dda9831a37ef7f55c5e69c0d276c278f24978f5b36b9fad7eac05a22bfc",
"sha256:1deacd52638da2d7fcb864c3949f0285638ec10e6aace93ce15c6a2e0ed91b95",
"sha256:1548247ea3b50014a3ea55ad9446108df191b6a6e51aa8f5953c95b663f382ff",
"sha256:5da6f5b31ea2b573cb20e88aefc6b49d849d07588ba60871342cae42f569b0d7",
"sha256:12e348eb57fb79ccf91a49b7b937c49a5bbe1d73ba75589674b76a56d064bda0",
"sha256:b9e1735918fc1e83c522b9f1048e6bc5af38af958e4efc843046e4b0075a021b",
"sha256:fafeb4b190bd63ba2bcee2496d99cb7345fafbace6b999403010abdff8c05b72",
"sha256:9007da6fb1b96fb1c9d7bd65e97bbbad60295abc19833d7e67e05314c1868f58",
"sha256:cfbf0b956f33cda3af2a1438a2541549b69a7a240e71de7d8ca819b8f1547aac",
"sha256:0a103253a94cdad86028d273aaebb8b30c75fdf009c23e52cdc8ce88429fd326",
"sha256:b3d5a0ecf0c2c31c404246b6706b2e477159ee07b73be5102389ab250dd67701",
"sha256:e92af0fd08c7d2176ad4be4a7c47fd800d6ee05046b41e36ed579c01fb106c25",
"sha256:feb2144c2ae4035ad57165dd22bdc93b1389158a985c0497a096d39e2b2cd67b",
"sha256:a4433655219b84a360dbdf2c34d9625c3988a272e6fc028222d528ad5902f6a2",
"sha256:db98287cb1488eb103930a64444542f6ffe83694ef392f801aa56d648d905663",
"sha256:307d325ee143b60b9c82912e96e9f4345200c33c8ae00b04b001e4c85fb5f146",
"sha256:5caec9b174dbf927034d588669c62d2a9d0ce447365b20a3463f4daab1e4f03b",
"sha256:fb816595494ce21191764572215f56edfbc6d9fbebd1491c8466502892989689",
"sha256:10399bececdb67f0d9251ecf2dda2abf6ddeee6096741754356f1a3715c8c830",
"sha256:c263fd15d27f3be93485fcd83a495cbbc35352512d9e31644d49a54504a1be2a",
"sha256:c10ad53216d5af2b3ba63e65db793cb7dd7e598e17826938045e32f38b0e4814",
"sha256:d42a5182d4b0953d02e5f46c9f0dc304be736fbaa1c0d2f11326182b9684b5f4",
"sha256:dd7c22bf890d266e72c5e5c8c44555ffbfe4ca2a329da785e7d8b1972fc3ff74",
"sha256:93df9805146980e83834ea9320baa6a56d8aea45f63d7d3cc721f71eb1a1bac6",
"sha256:7ba1b62fe9414d73d493241011df952b72074808debc3a2d6d8a64fb9944edf6",
"sha256:d2c121f5f77bed1e1eddeee23ee76fee8a3d48fa7a3aab589d12942f87778a9e",
"sha256:be3aaeb5f468a49f523f16736ccff7d82af2b4b303292ba3d052b5b28f3fbe47"
],
"version": "==4.1.0"
},
"olefile": { "olefile": {
"hashes": [ "hashes": [
"sha256:61f2ca0cd0aa77279eb943c07f607438edf374096b66332fae1ee64a6f0f73ad" "sha256:61f2ca0cd0aa77279eb943c07f607438edf374096b66332fae1ee64a6f0f73ad"

View file

@ -65,6 +65,7 @@ INSTALLED_APPS = [
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'compressor', 'compressor',
'django_activeurl',
'favicon', 'favicon',
'meta', 'meta',

View file

@ -25,7 +25,7 @@
</button> </button>
<div class="collapse navbar-collapse" id="navbar"> <div class="collapse navbar-collapse" id="navbar">
{% nav_left %} {% nav_left request %}
{% nav_right request %} {% nav_right request %}
</div> </div>
</nav> </nav>

View file

@ -1,8 +1,8 @@
<ul class="navbar-nav"> {% load activeurl %}{% activeurl %}<ul class="navbar-nav">
{% for item in items %} {% for item in items %}
<li class="nav-item"><a class="nav-link" href="{{ item.url }}"> <li class="nav-item"><a class="nav-link" href="{{ item.url }}">
<i class="{{ item.icon }}"></i> <i class="{{ item.icon }}"></i>
{{ item.label }} {{ item.label }}
</a></li> </a></li>
{% endfor %} {% endfor %}
</ul> </ul>{% endactiveurl %}

View file

@ -35,9 +35,9 @@ def site_name():
@register.inclusion_tag('lemoncurry/tags/nav.html') @register.inclusion_tag('lemoncurry/tags/nav.html')
def nav_left(): def nav_left(request):
items = () items = ()
return {'items': items} return {'items': items, 'request': request}
@register.inclusion_tag('lemoncurry/tags/nav.html') @register.inclusion_tag('lemoncurry/tags/nav.html')
@ -51,7 +51,7 @@ def nav_right(request):
items = ( items = (
MenuItem(label='log in', icon='fa fa-sign-in', url='lemonauth:login'), MenuItem(label='log in', icon='fa fa-sign-in', url='lemonauth:login'),
) )
return {'items': items} return {'items': items, 'request': request}
@register.inclusion_tag('lemoncurry/tags/breadcrumbs.html') @register.inclusion_tag('lemoncurry/tags/breadcrumbs.html')