Add blocks with collapse animation instead of display all

This commit is contained in:
Rida Lali 2020-08-21 08:18:00 +02:00
parent ba636fc401
commit 2672721235
1 changed files with 32 additions and 20 deletions

View File

@ -20,12 +20,23 @@
</label>
</div>
{% endif %}
<ul>
<div class="accordion" id="accordionRoles">
{% regroup active_memberships by roles as memberships_per_role %}
{% for role in roles %}
<li class="{% if not role.clubs %}no-club{% endif %}">
<div class="card {% if not role.clubs %}no-club{% endif %}">
<div class="card-header" id="{{ role|slugify }} ">
<h2 class="mb-0">
<button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#collapse{{ role|slugify }}" aria-expanded="true" aria-controls="collapse{{ role|slugify }}">
{{ role }} {% if role.weirole %}(<em>Pour le WEI</em>){% endif %} {% if role.for_club %}(<em>Pour le club {{ role.for_club }} uniquement</em>){% endif %}
{% if role.clubs %}
<small><span class="badge badge-success">{% trans "Owned" %} : {{ role.clubs|join:", " }}</span></small>
{% endif %}
</button>
</h2>
</div>
<div id="collapse{{ role|slugify }}" class="collapse" aria-labelledby="{{ role|slugify }}" data-parent="#accordionRoles">
<div class="card-body">
{% if role.clubs %}
<div class="alert alert-success">
{% trans "Own this role in the clubs" %} {{ role.clubs|join:", " }}
@ -38,9 +49,10 @@
<em>{% trans "No associated permission" %}</em>
{% endfor %}
</ul>
</li>
</div>
</div>
</div>
{% endfor %}
</ul>
{% endblock %}
{% block extrajavascript %}