8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-22 11:23:10 +00:00

add custom link to nav bar

This commit is contained in:
Cyprien de Cerval 2022-07-29 13:00:50 +02:00
parent ef8bc842df
commit 542ca59d4e
3 changed files with 23 additions and 0 deletions

View file

@ -118,6 +118,7 @@ OPTIONNAL_APPS_RE2O = ()
# Some Django apps you want to add in you local project # Some Django apps you want to add in you local project
OPTIONNAL_APPS = OPTIONNAL_APPS_RE2O + () OPTIONNAL_APPS = OPTIONNAL_APPS_RE2O + ()
OPTIONNAL_LINK_RE2O= ()
# Add statiffiles dir that were installed using system packaging # Add statiffiles dir that were installed using system packaging
# Example to reproduce re2o2.9 behavior # Example to reproduce re2o2.9 behavior
# SYSTEM_STATICFILES_DIRS = ("/usr/share/fonts-font-awesome/", "/usr/share/javascript/") # SYSTEM_STATICFILES_DIRS = ("/usr/share/fonts-font-awesome/", "/usr/share/javascript/")

View 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

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load static %} {% load static %}
{% load acl %} {% load acl %}
{% load custom_link %}
{% load i18n %} {% load i18n %}
<nav class="navbar navbar-inverse navbar-fixed-top" id="navbar-header"> <nav class="navbar navbar-inverse navbar-fixed-top" id="navbar-header">
<div class="container-fluid"> <div class="container-fluid">
@ -264,6 +265,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</ul> </ul>
</li> </li>
{% acl_end %} {% acl_end %}
{% autoescape off %}
{% nav_link_nologin %}
{% endautoescape %}
</ul> </ul>
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<li><a href="{% url 'contact' %}"><i class="fa fa-at"></i> {% trans "Contact" %}</a> <li><a href="{% url 'contact' %}"><i class="fa fa-at"></i> {% trans "Contact" %}</a>