mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 03:13:12 +00:00
add custom link to nav bar
This commit is contained in:
parent
ef8bc842df
commit
542ca59d4e
3 changed files with 23 additions and 0 deletions
|
@ -118,6 +118,7 @@ OPTIONNAL_APPS_RE2O = ()
|
|||
# Some Django apps you want to add in you local project
|
||||
OPTIONNAL_APPS = OPTIONNAL_APPS_RE2O + ()
|
||||
|
||||
OPTIONNAL_LINK_RE2O= ()
|
||||
# Add statiffiles dir that were installed using system packaging
|
||||
# Example to reproduce re2o2.9 behavior
|
||||
# SYSTEM_STATICFILES_DIRS = ("/usr/share/fonts-font-awesome/", "/usr/share/javascript/")
|
||||
|
|
18
re2o/templatetags/custom_link.py
Normal file
18
re2o/templatetags/custom_link.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
from django import template
|
||||
from re2o.settings_local import OPTIONNAL_LINK_RE2O
|
||||
|
||||
register = template.Library()
|
||||
|
||||
@register.simple_tag
|
||||
def nav_link_nologin():
|
||||
template = """
|
||||
<li>
|
||||
<a href="{}">
|
||||
<i class="fa {}"></i> {}
|
||||
</a>
|
||||
</li>
|
||||
"""
|
||||
res = ""
|
||||
for link in OPTIONNAL_LINK_RE2O:
|
||||
res += template.format(link[0],link[1],link[2])
|
||||
return res
|
|
@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
|
||||
{% load static %}
|
||||
{% load acl %}
|
||||
{% load custom_link %}
|
||||
{% load i18n %}
|
||||
<nav class="navbar navbar-inverse navbar-fixed-top" id="navbar-header">
|
||||
<div class="container-fluid">
|
||||
|
@ -264,6 +265,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
</ul>
|
||||
</li>
|
||||
{% acl_end %}
|
||||
{% autoescape off %}
|
||||
{% nav_link_nologin %}
|
||||
{% endautoescape %}
|
||||
</ul>
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li><a href="{% url 'contact' %}"><i class="fa fa-at"></i> {% trans "Contact" %}</a>
|
||||
|
|
Loading…
Reference in a new issue