8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-23 20:03:11 +00:00

Better display of permissions

This commit is contained in:
Maël Kervella 2018-01-01 20:06:02 +00:00 committed by root
parent 2da16662df
commit 3c455a6f82

View file

@ -22,7 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %} {% endcomment %}
<table id="listRights_table" class="table table-striped"> <table id="listRights_table" class="table">
<thead> <thead>
<tr> <tr>
<th>Droit</th> <th>Droit</th>
@ -33,23 +33,18 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</tr> </tr>
</thead> </thead>
{% for listright in listright_list %} {% for listright in listright_list %}
<tr> <tr class="active">
<td> <td>
<a data-toggle="collapse" href="#collapseListRight_{{listright.gid}}" aria-expanded="true" aria-controls="collapseListRight_{{listright.gid}}"> <a data-toggle="collapse" data-parent="#accordion_{{listright.gid}}" href="#collapseListRight_user_{{listright.gid}}" aria-expanded="true" aria-controls="collapseListRight_user_{{listright.gid}}">
{{ listright.name }} ({{listright.user_set.all|length}} users) {{ listright.name }} ({{listright.user_set.all|length}} users)
</a> </a>
</td> </td>
<td>{{ listright.gid }}</td> <td>{{ listright.gid }}</td>
<td> <td>
<div class="dropdown"> <div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="listpermissions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> <button class="btn btn-default" data-parent="#accordion_{{listright.gid}}" type="button" data-toggle="collapse" data-target="#collapseListRight_perm_{{listright.gid}}" aria-expanded="true" aria-controls="collapseListRight_perm_{{listright.gid}}">
Ensemble des permissions <span class="caret"></span> Ensemble des permissions
</button> </button>
<ul class="dropdown-menu" aria-labelledby="listpermissions">
{% for perm in listright.permissions.all %}
<li>{{ perm.name }}</li>
{% endfor %}
</ul>
</div> </div>
</td> </td>
<td>{{ listright.details }}</td> <td>{{ listright.details }}</td>
@ -60,7 +55,20 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</tr> </tr>
<tr> <tr>
<td colspan=5> <td colspan=5>
<div class="collapse in" id="collapseListRight_{{listright.gid}}"> <div class="panel-group" id="accordion_{{listright.gid}}" role="tablist" aria-multiselectable="true" style="margin-bottom: 0px;">
<div class="panel" style="border: none;">
<div class="panel-collapse collapse in" id="collapseListRight_perm_{{listright.gid}}" role="tabpanel">
<ul class="list-group" style="margin-bottom: 0px">
{% for perm in listright.permissions.all %}
<li class="list-group-item col-xs-6 col-sm-4 col-md-3" style="border:none;">
{{perm.name}}
</li>
{% endfor %}
</ul>
</div>
</div>
<div class="panel" style="border: none;">
<div class="panel-collapse collapse in" id="collapseListRight_user_{{listright.gid}}" role="tabpanel">
<ul class="list-group" style="margin-bottom: 0px"> <ul class="list-group" style="margin-bottom: 0px">
{% for user in listright.user_set.all %} {% for user in listright.user_set.all %}
<li class="list-group-item col-xs-12 col-sm-6 col-md-4" style="border:none;"> <li class="list-group-item col-xs-12 col-sm-6 col-md-4" style="border:none;">
@ -72,6 +80,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>
</div>
</div>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
@ -79,9 +89,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<script> <script>
$("#listRights_table").ready( function () { $("#listRights_table").ready( function () {
var listRights_div = [{% for listright in listright_list %}$("#collapseListRight_{{listright.gid}}"), {% endfor %}]; var listRights_div = [{% for listright in listright_list %}[$("#accordion_{{listright.gid}}"), $("#collapseListRight_user_{{listright.gid}}"), $("#collapseListRight_perm_{{listright.gid}}")], {% endfor %}];
for (var i=0 ; i<listRights_div.length ; i++) { for (var i=0 ; i<listRights_div.length ; i++) {
listRights_div[i].collapse('hide'); listRights_div[i][1].collapse({ toggle: true, parent: listRights_div[i][0] });
listRights_div[i][2].collapse({ toggle: true, parent: listRights_div[i][0] });
} }
} ); } );
</script> </script>