From 70af2427350970c2c8c56e38779e080dfca27eb5 Mon Sep 17 00:00:00 2001 From: Lukas Weichelt <lukas.weichelt@teckids.org> Date: Sun, 11 Sep 2022 15:07:23 +0200 Subject: [PATCH] Fix group ownership on detail page --- aleksis/core/templates/core/person/full.html | 50 ++++++++++---------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/aleksis/core/templates/core/person/full.html b/aleksis/core/templates/core/person/full.html index 9ac87ed59..6e50d39fa 100644 --- a/aleksis/core/templates/core/person/full.html +++ b/aleksis/core/templates/core/person/full.html @@ -241,35 +241,37 @@ {% endif %} {% has_perm 'core.view_person_groups_rule' user person as can_view_groups %} - {% if can_view_groups and groups %} - {% if groups.count %} - <div class="col s12 m6 l4"> - <h2>{% blocktrans %}Groups{% endblocktrans %}</h2> - <div class="card-panel"> - <div class="collection"> - {% for group in groups %} - <a href="{{ group.get_absolute_url }}" class="collection-item"> - {{ group.name }} ({{ group.school_term }}) - </a> - {% endfor %} + {% if can_view_groups and groups.count or can_view_groups and person.owner_of_recursive.count or can_view_groups and person.owner_of_recursive.count and groups.count %} + <div class="col s12 m6 l4"> + {% if groups.count %} + <div> + <h2>{% blocktrans %}Groups{% endblocktrans %}</h2> + <div class="card-panel"> + <div class="collection"> + {% for group in groups %} + <a href="{{ group.get_absolute_url }}" class="collection-item"> + {{ group.name }} ({{ group.school_term }}) + </a> + {% endfor %} + </div> </div> </div> - </div> - {% endif %} - {% if person.owner_of_recursive.count %} - <div class="col s12 m6 l4"> - <h2>{% blocktrans %}Group ownership{% endblocktrans %}</h2> - <div class="card-panel"> - <div class="collection"> - {% for group in person.owner_of_recursive.all %} - <a href="{{ group.get_absolute_url }}" class="collection-item"> - {{ group.name }} ({{ group.school_term }}) {{ person.owner_of_recursive.count}} + {% endif %} + {% if person.owner_of_recursive.count %} + <div> + <h2>{% blocktrans %}Group ownership{% endblocktrans %}</h2> + <div class="card-panel"> + <div class="collection"> + {% for group in person.owner_of_recursive.all %} + <a href="{{ group.get_absolute_url }}" class="collection-item"> + {{ group.name }} ({{ group.school_term }}) </a> - {% endfor %} + {% endfor %} + </div> </div> </div> - </div> - {% endif %} + {% endif %} + </div> {% endif %} </div> {% endblock %} -- GitLab