Projet

Général

Profil

0001-templates-fix-OU-link-in-role-pages-breadcrumb-54201.patch

Valentin Deniaud, 26 mai 2021 15:56

Télécharger (1,78 ko)

Voir les différences:

Subject: [PATCH] templates: fix OU link in role pages breadcrumb (#54201)

 src/authentic2/manager/role_views.py                         | 5 +++++
 .../manager/templates/authentic2/manager/role_common.html    | 5 ++---
 2 files changed, 7 insertions(+), 3 deletions(-)
src/authentic2/manager/role_views.py
144 144
class RoleViewMixin(RolesMixin):
145 145
    model = get_role_model()
146 146

  
147
    def get_context_data(self, **kwargs):
148
        ctx = super().get_context_data(**kwargs)
149
        ctx['ou'] = self.get_object().ou
150
        return ctx
151

  
147 152

  
148 153
class RoleEditView(RoleViewMixin, views.BaseEditView):
149 154
    template_name = 'authentic2/manager/role_edit.html'
src/authentic2/manager/templates/authentic2/manager/role_common.html
6 6
{% block breadcrumb %}
7 7
  {{ block.super }}
8 8
  <a href="{% url 'a2-manager-roles' %}">{% trans 'Roles' %}</a>
9
  {% firstof ou object.ou as current_ou %}
10
  {% if multiple_ou and current_ou %}
11
    <a href="{% url 'a2-manager-roles' %}?search-ou={{ current_ou.id }}">{{ current_ou }}</a>
9
  {% if multiple_ou and ou %}
10
    <a href="{% url 'a2-manager-roles' %}?search-ou={{ ou.pk }}">{{ ou }}</a>
12 11
  {% endif %}
13 12
{% endblock %}
14
-