mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-05 17:36:27 +00:00
feat(custom_link): choose position in the navbar for links
This commit is contained in:
parent
89ba77c528
commit
854accfab0
4 changed files with 9 additions and 5 deletions
|
@ -100,5 +100,5 @@ OPTIONNAL_APPS_RE2O = ()
|
|||
# Some Django apps you want to add in you local project
|
||||
OPTIONNAL_APPS = OPTIONNAL_APPS_RE2O + ()
|
||||
|
||||
# Some optinnal link for the navbar in a tuple (link,icon class,text)
|
||||
# Some optinnal link for the navbar in a tuple (link,icon class,text,position (left or right))
|
||||
NAVBAR_LINKS = ()
|
|
@ -118,7 +118,7 @@ OPTIONNAL_APPS_RE2O = ()
|
|||
# Some Django apps you want to add in you local project
|
||||
OPTIONNAL_APPS = OPTIONNAL_APPS_RE2O + ()
|
||||
|
||||
# Some optinnal link for the navbar in a tuple (link,icon class,text)
|
||||
# Some optinnal link for the navbar in a tuple (link,icon class,text,position (left or right))
|
||||
NAVBAR_LINKS= ()
|
||||
|
||||
# Add statiffiles dir that were installed using system packaging
|
||||
|
|
|
@ -23,7 +23,7 @@ from django.conf import settings
|
|||
register = template.Library()
|
||||
|
||||
@register.simple_tag
|
||||
def nav_link():
|
||||
def nav_link(position):
|
||||
template = """
|
||||
<li>
|
||||
<a href="{}">
|
||||
|
@ -33,5 +33,6 @@ def nav_link():
|
|||
"""
|
||||
res = ""
|
||||
for link in settings.NAVBAR_LINKS:
|
||||
res += template.format(link[0],link[1],link[2])
|
||||
if position == link[3]:
|
||||
res += template.format(link[0],link[1],link[2])
|
||||
return res
|
|
@ -266,10 +266,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
</li>
|
||||
{% acl_end %}
|
||||
{% autoescape off %}
|
||||
{% nav_link %}
|
||||
{% nav_link "left"%}
|
||||
{% endautoescape %}
|
||||
</ul>
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
{% autoescape off %}
|
||||
{% nav_link "right"%}
|
||||
{% endautoescape %}
|
||||
<li><a href="{% url 'contact' %}"><i class="fa fa-at"></i> {% trans "Contact" %}</a>
|
||||
{% if not request.user.is_authenticated %}
|
||||
{% for template in optionnal_templates_navbar_logout_list %}
|
||||
|
|
Loading…
Reference in a new issue