diff --git a/docker/settings_local.template.py b/docker/settings_local.template.py index e8d6f4ae..42585d63 100644 --- a/docker/settings_local.template.py +++ b/docker/settings_local.template.py @@ -99,3 +99,6 @@ 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,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 a70663db..a23dbd54 100644 --- a/re2o/settings_local.example.py +++ b/re2o/settings_local.example.py @@ -118,6 +118,9 @@ 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,position (left or right)) +NAVBAR_LINKS= () + # 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/") diff --git a/re2o/templatetags/custom_link.py b/re2o/templatetags/custom_link.py new file mode 100644 index 00000000..2de28981 --- /dev/null +++ b/re2o/templatetags/custom_link.py @@ -0,0 +1,38 @@ +# Re2o est un logiciel d'administration développé initiallement au Rézo Metz. Il +# se veut agnostique au réseau considéré, de manière à être installable en +# quelques clics. +# +# Copyright © 2022 Cyprien de Cerval +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.from django import template +from django import template +from django.conf import settings + +register = template.Library() + +@register.simple_tag +def nav_link(position): + template = """ +
  • + + {} + +
  • + """ + res = "" + for link in settings.NAVBAR_LINKS: + 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 8efca1c8..12db8459 100644 --- a/templates/nav.html +++ b/templates/nav.html @@ -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 %}