Compare commits

...

2 commits

3 changed files with 44 additions and 5 deletions

View file

@ -1,19 +1,23 @@
from django.contrib.staticfiles.storage import staticfiles_storage from django.contrib.staticfiles.storage import staticfiles_storage
from django.urls import reverse from django.urls import reverse
from jinja2 import Environment from jinja2 import Environment
from compressor.contrib.jinja2ext import CompressorExtension
from compressor.contrib.jinja2ext import CompressorExtension
from django_activeurl.ext.django_jinja import ActiveUrl
from entries.kinds import all as entry_kinds
from .utils import load_package_json from .utils import load_package_json
def environment(**options): def environment(**options):
env = Environment( env = Environment(
extensions=[CompressorExtension], extensions=[ActiveUrl, CompressorExtension],
trim_blocks=True, trim_blocks=True,
lstrip_blocks=True, lstrip_blocks=True,
**options **options
) )
env.globals.update({ env.globals.update({
'entry_kinds': entry_kinds,
'package': load_package_json(), 'package': load_package_json(),
'static': staticfiles_storage.url, 'static': staticfiles_storage.url,
'url': reverse, 'url': reverse,

View file

@ -31,8 +31,43 @@
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
<div class="collapse navbar-collapse" id="navbar"> {% activeurl %}<div class="collapse navbar-collapse" id="navbar">
</div> <ul class="navbar-nav">
{% for kind in entry_kinds %}
<li class="nav-item">
<a class="nav-link" href="{{ kind.index }}">
<i class="{{ kind.icon }} fa-fw" aria-hidden="true"></i>
{{ kind.plural }}
</a>
</li>
{% endfor %}
</ul>
<ul class="navbar-nav">
{% if request.user.is_authenticated %}
<li class="nav-item">
<a class="nav-link" href="{{ url('admin:index') }}">
<i class="fas fa-cog fa-fw" aria-hidden="true"></i>
admin
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ url('lemonauth:logout') }}">
<i class="fas fa-sign-out-alt fa-fw" aria-hidden="true"></i>
log out
</a>
</li>
{% else %}
<li class="nav-item">
<a class="nav-link" href="{{ url('lemonauth:login') }}">
<i class="fas fa-sign-in-alt fa-fw" aria-hidden="true"></i>
log in
</a>
</li>
{% endif %}
</ul>
</div>{% endactiveurl %}
</nav> </nav>
</header> </header>

View file

@ -1,7 +1,7 @@
{ {
"name": "lemoncurry", "name": "lemoncurry",
"version": "1.9.8", "version": "1.9.8",
"repository": "https://gitlab.com/00dani/lemoncurry", "repository": "https://git.00dani.me/00dani/lemoncurry",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"js-yaml": "^3.10.0", "js-yaml": "^3.10.0",