8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-25 08:23:46 +00:00

Fix affichage dans le dropdown adapté

This commit is contained in:
Gabriel Detraz 2019-09-20 19:56:19 +02:00 committed by klafyvel
parent 6d76d0a5f7
commit 6617d6a000
6 changed files with 20 additions and 17 deletions

View file

@ -1,2 +1,2 @@
{% load i18n %}
<li><a href="{% url 'multi_op:aff-state-global' %}"><i class="fa fa-ticket"></i>{% trans "Tickets" %}</a></li>
<li><a href="{% url 'multi_op:aff-state-global' %}"><i class="fa fa-random"></i> {% trans "Multi Operators" %}</a></li>

View file

@ -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):

View file

@ -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}

View file

@ -101,9 +101,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<li><a href="{% url 'cotisations:index' %}"><i class="fa fa-eur"></i> {% trans "Manage the subscriptions" %}</a></li>
{% 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 %}
</ul>
</li>
{% acl_end %}
@ -114,6 +116,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<li><a href="{% url 'topologie:index' %}"><i class="fa fa-microchip"></i> {% trans "Switches" %}</a></li>
<li><a href="{% url 'topologie:index-ap' %}"><i class="fa fa-wifi"></i> {% trans "Access points" %}</a></li>
<li><a href="{% url 'topologie:index-room' %}"><i class="fa fa-home"></i> {% trans "Rooms" %}</a></li>
{% for app, template in optionnal_templates_navbar_user_list %}
{% if app == 'topologie' %}
{{ template }}
{% endif %}
{% endfor %}
</ul>
</li>
{% acl_end %}

View file

@ -1,2 +1,2 @@
{% load i18n %}
<li><a href="{% url 'tickets:aff-tickets' %}"><i class="fa fa-ticket"></i>{% trans "Tickets" %}</a></li>
<li><a href="{% url 'tickets:aff-tickets' %}"><i class="fa fa-ticket"></i> {% trans "Tickets" %}</a></li>

View file

@ -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')