From 854accfab00299a5d6d5c6ac62ec1a590e32220e Mon Sep 17 00:00:00 2001 From: Cyprien de Cerval Date: Fri, 29 Jul 2022 15:01:22 +0200 Subject: [PATCH] feat(custom_link): choose position in the navbar for links --- docker/settings_local.template.py | 2 +- re2o/settings_local.example.py | 2 +- re2o/templatetags/custom_link.py | 5 +++-- templates/nav.html | 5 ++++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/docker/settings_local.template.py b/docker/settings_local.template.py index a687a35a..42585d63 100644 --- a/docker/settings_local.template.py +++ b/docker/settings_local.template.py @@ -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 = () \ No newline at end of file diff --git a/re2o/settings_local.example.py b/re2o/settings_local.example.py index e1ec3d3e..a23dbd54 100644 --- a/re2o/settings_local.example.py +++ b/re2o/settings_local.example.py @@ -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 diff --git a/re2o/templatetags/custom_link.py b/re2o/templatetags/custom_link.py index 7b51897a..2de28981 100644 --- a/re2o/templatetags/custom_link.py +++ b/re2o/templatetags/custom_link.py @@ -23,7 +23,7 @@ from django.conf import settings register = template.Library() @register.simple_tag -def nav_link(): +def nav_link(position): template = """
  • @@ -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 \ No newline at end of file diff --git a/templates/nav.html b/templates/nav.html index 4ae0d43b..12db8459 100644 --- a/templates/nav.html +++ b/templates/nav.html @@ -266,10 +266,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
  • {% acl_end %} {% autoescape off %} - {% nav_link %} + {% nav_link "left"%} {% endautoescape %}