diff --git a/re2o/context_processors.py b/re2o/context_processors.py index ad7194cf..860a5a58 100644 --- a/re2o/context_processors.py +++ b/re2o/context_processors.py @@ -62,8 +62,10 @@ 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] - optionnal_templates_navbar_list = [app.views.navbar_user(request) for app in optionnal_apps] - return {'optionnal_templates_navbar_list':optionnal_templates_navbar_list} + 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] + return {'optionnal_templates_navbar_user_list':optionnal_templates_navbar_user_list, + 'optionnal_templates_navbar_logout_list':optionnal_templates_navbar_logout_list} def date_now(request): diff --git a/re2o/templates/re2o/contact.html b/re2o/templates/re2o/contact.html index b20fe875..05b34655 100644 --- a/re2o/templates/re2o/contact.html +++ b/re2o/templates/re2o/contact.html @@ -31,6 +31,10 @@ with this program; if not, write to the Free Software Foundation, Inc., {% block content %}

{% blocktrans %}Contact the organisation {{asso_name}}{% endblocktrans %}


+ +{% for template in optionnal_templates_contact_list %} + {{template}} +{% endfor %} {% for contact in contacts %} diff --git a/re2o/views.py b/re2o/views.py index aa85e997..c4c8b72e 100644 --- a/re2o/views.py +++ b/re2o/views.py @@ -43,6 +43,8 @@ from preferences.models import ( ) from .contributors import CONTRIBUTORS +from importlib import import_module +from re2o.settings_local import OPTIONNAL_APPS def form(ctx, template, request): @@ -113,12 +115,16 @@ def contact_page(request): """ address = MailContact.objects.all() + optionnal_apps = [import_module(app) for app in OPTIONNAL_APPS] + optionnal_templates_contact_list = [app.views.contact(request) for app in optionnal_apps] + return render( request, "re2o/contact.html", { 'contacts': address, - 'asso_name': AssoOption.objects.first().name + 'asso_name': AssoOption.objects.first().name, + 'optionnal_templates_contact_list':optionnal_templates_contact_list, } ) diff --git a/templates/base.html b/templates/base.html index 67799c28..de6f308c 100644 --- a/templates/base.html +++ b/templates/base.html @@ -101,7 +101,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
  • {% trans "Manage the subscriptions" %}
  • {% acl_end %} - {% for template in optionnal_templates_navbar_list%} + {% for template in optionnal_templates_navbar_user_list%} {{ template }} {% endfor %} @@ -140,6 +140,9 @@ with this program; if not, write to the Free Software Foundation, Inc., {% if not request.user.is_authenticated %} + {% for template in optionnal_templates_navbar_logout_list %} + {{ template }} + {% endfor %} {% if var_sa %}
  • diff --git a/tickets/templates/tickets/contact.html b/tickets/templates/tickets/contact.html new file mode 100644 index 00000000..0a348f01 --- /dev/null +++ b/tickets/templates/tickets/contact.html @@ -0,0 +1,13 @@ +{% load i18n %} + +
    +

    Tickets

    +
    +
    diff --git a/tickets/templates/tickets/navbar_logout.html b/tickets/templates/tickets/navbar_logout.html new file mode 100644 index 00000000..8a7114f3 --- /dev/null +++ b/tickets/templates/tickets/navbar_logout.html @@ -0,0 +1,6 @@ +{% load i18n %} +
  • + + {% trans "Ouvrir un ticket" %} + +
  • diff --git a/tickets/views.py b/tickets/views.py index 52b4f68f..26dce0cd 100644 --- a/tickets/views.py +++ b/tickets/views.py @@ -148,6 +148,16 @@ def preferences(request): context = {'preferences':preferences} return render_to_string('tickets/preferences.html', context=context, request=request, using=None) +def contact(request): + """Vue cannonique d'affichage d'une adresse dans la page contact. + Utilisée ici pour proposer l'ouverture d'un ticket""" + return render_to_string('tickets/contact.html') + def navbar_user(request): """Vue cannonique d'affichage des tickets dans la navbar""" - return render_to_string('tickets/navbar.html') + return render_to_string('tickets/navbar.html') + +def navbar_logout(request): + """Vue cannonique d'affichage du lien de creation de ticket + lorsque l'utilisateur est déconnecté dans la navbar""" + return render_to_string('tickets/navbar_logout.html')