From 6617d6a000c3d3713d50a53bfcbb031bbfd0a8cb Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Fri, 20 Sep 2019 19:56:19 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20affichage=20dans=20le=20dropdown=20adapt?= =?UTF-8?q?=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- multi_op/templates/multi_op/navbar.html | 2 +- multi_op/views.py | 8 ++------ re2o/context_processors.py | 4 ++-- templates/base.html | 13 ++++++++++--- tickets/templates/tickets/navbar.html | 2 +- tickets/views.py | 8 ++++---- 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/multi_op/templates/multi_op/navbar.html b/multi_op/templates/multi_op/navbar.html index d5b6cb51..c5e84c43 100644 --- a/multi_op/templates/multi_op/navbar.html +++ b/multi_op/templates/multi_op/navbar.html @@ -1,2 +1,2 @@ {% load i18n %} -
  • {% trans "Tickets" %}
  • +
  • {% trans "Multi Operators" %}
  • diff --git a/multi_op/views.py b/multi_op/views.py index 41c7e40d..75811a0d 100644 --- a/multi_op/views.py +++ b/multi_op/views.py @@ -161,13 +161,9 @@ def edit_preferences(request): return form({'preferencesform':preferencesform,},'multi_op/form_preferences.html',request) -def navbar_user(request): +def navbar_user(): """View to display the app in user's dropdown in the navbar""" - return render_to_string('multi_op/navbar.html') - -def navbar_logout(request): - """View to display the app in user's dropdown in the navbar""" - return None + return ('topologie', render_to_string('multi_op/navbar.html')) def preferences(request): diff --git a/re2o/context_processors.py b/re2o/context_processors.py index 3ee39073..97f2d4f8 100644 --- a/re2o/context_processors.py +++ b/re2o/context_processors.py @@ -62,8 +62,8 @@ def context_optionnal_apps(request): """Fonction de context pour générer la navbar en fonction des apps optionnels""" optionnal_apps = [import_module(app) for app in OPTIONNAL_APPS_RE2O] - optionnal_templates_navbar_user_list = [app.views.navbar_user(request) for app in optionnal_apps] - optionnal_templates_navbar_logout_list = [app.views.navbar_logout(request) for app in optionnal_apps] + optionnal_templates_navbar_user_list = [app.views.navbar_user() for app in optionnal_apps if hasattr(app.views, 'navbar_user')] + optionnal_templates_navbar_logout_list = [app.views.navbar_logout() for app in optionnal_apps if hasattr(app.views, 'navbar_logout')] return {'optionnal_templates_navbar_user_list':optionnal_templates_navbar_user_list, 'optionnal_templates_navbar_logout_list':optionnal_templates_navbar_logout_list} diff --git a/templates/base.html b/templates/base.html index f116c2be..122c7c3a 100644 --- a/templates/base.html +++ b/templates/base.html @@ -101,9 +101,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
  • {% trans "Manage the subscriptions" %}
  • {% acl_end %} - {% for template in optionnal_templates_navbar_user_list%} - {{ template }} - {% endfor %} + {% for app, template in optionnal_templates_navbar_user_list %} + {% if app != 'topologie' %} + {{ template }} + {% endif %} + {% endfor %} {% acl_end %} @@ -114,6 +116,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
  • {% trans "Switches" %}
  • {% trans "Access points" %}
  • {% trans "Rooms" %}
  • + {% for app, template in optionnal_templates_navbar_user_list %} + {% if app == 'topologie' %} + {{ template }} + {% endif %} + {% endfor %} {% acl_end %} diff --git a/tickets/templates/tickets/navbar.html b/tickets/templates/tickets/navbar.html index 3c4318f7..11473229 100644 --- a/tickets/templates/tickets/navbar.html +++ b/tickets/templates/tickets/navbar.html @@ -1,2 +1,2 @@ {% load i18n %} -
  • {% trans "Tickets" %}
  • +
  • {% trans "Tickets" %}
  • diff --git a/tickets/views.py b/tickets/views.py index 7fb96511..b16e4eea 100644 --- a/tickets/views.py +++ b/tickets/views.py @@ -186,12 +186,12 @@ def preferences(request): def contact(request): """View to display a contact address on the contact page used here to display a link to open a ticket""" - return render_to_string('tickets/contact.html') + return ('users', render_to_string('tickets/contact.html')) -def navbar_user(request): +def navbar_user(): """View to display the ticket link in thet user's dropdown in the navbar""" - return render_to_string('tickets/navbar.html') + return ('users', render_to_string('tickets/navbar.html')) -def navbar_logout(request): +def navbar_logout(): """View to display the ticket link to log out users""" return render_to_string('tickets/navbar_logout.html')