mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-23 07:23:46 +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
|
# Some Django apps you want to add in you local project
|
||||||
OPTIONNAL_APPS = OPTIONNAL_APPS_RE2O + ()
|
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 = ()
|
NAVBAR_LINKS = ()
|
|
@ -118,7 +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 + ()
|
||||||
|
|
||||||
# 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= ()
|
NAVBAR_LINKS= ()
|
||||||
|
|
||||||
# Add statiffiles dir that were installed using system packaging
|
# Add statiffiles dir that were installed using system packaging
|
||||||
|
|
|
@ -23,7 +23,7 @@ from django.conf import settings
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
@register.simple_tag
|
@register.simple_tag
|
||||||
def nav_link():
|
def nav_link(position):
|
||||||
template = """
|
template = """
|
||||||
<li>
|
<li>
|
||||||
<a href="{}">
|
<a href="{}">
|
||||||
|
@ -33,5 +33,6 @@ def nav_link():
|
||||||
"""
|
"""
|
||||||
res = ""
|
res = ""
|
||||||
for link in settings.NAVBAR_LINKS:
|
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
|
return res
|
|
@ -266,10 +266,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
</li>
|
</li>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% autoescape off %}
|
{% autoescape off %}
|
||||||
{% nav_link %}
|
{% nav_link "left"%}
|
||||||
{% endautoescape %}
|
{% endautoescape %}
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="nav navbar-nav navbar-right">
|
<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>
|
<li><a href="{% url 'contact' %}"><i class="fa fa-at"></i> {% trans "Contact" %}</a>
|
||||||
{% if not request.user.is_authenticated %}
|
{% if not request.user.is_authenticated %}
|
||||||
{% for template in optionnal_templates_navbar_logout_list %}
|
{% for template in optionnal_templates_navbar_logout_list %}
|
||||||
|
|
Loading…
Reference in a new issue