8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-27 07:02:26 +00:00
This commit is contained in:
Gabriel Detraz 2018-04-16 06:54:34 +02:00 committed by chirac
parent e515360936
commit 5624247487
3 changed files with 29 additions and 55 deletions

View file

@ -31,58 +31,31 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<th>{% include "buttons/sort.html" with prefix='stack' col='id' text='ID' %}</th> <th>{% include "buttons/sort.html" with prefix='stack' col='id' text='ID' %}</th>
<th>Détails</th> <th>Détails</th>
<th>Membres</th> <th>Membres</th>
<th></th>
</tr> </tr>
</thead> </thead>
{% for stack in stack_list %} {% for stack in stack_list %}
{% for switch in stack.switch_set.all %} <tr>
<tbody> <td>{{ stack.name }}</td>
<tr class="active"> <td>{{stack.stack_id}}</td>
{% if forloop.first %} <td>{{stack.details}}</td>
<td rowspan="{{ stack.switch_set.all|length }}">{{stack.name}}</td> <td>{% for switch in stack.switch_set.all %}<a href="{% url 'topologie:index-port' switch.pk %}">{{switch }} </a>{% endfor %}</td>
<td rowspan="{{ stack.switch_set.all|length }}">{{stack.stack_id}}</td> <td class="text-right">
<td rowspan="{{ stack.switch_set.all|length }}" >{{stack.details}}</td> <a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'stack' stack.pk %}">
{% endif %} <i class="fa fa-history"></i>
<td><a href="{% url 'topologie:index-port' switch.pk %}">{{switch}}</a></td> </a>
{% if forloop.first %} {% can_edit stack %}
<td rowspan="{{ stack.switch_set.all|length }}"> <a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-stack' stack.id %}">
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'stack' stack.pk %}"> <i class="fa fa-edit"></i>
<i class="fa fa-history"></i> </a>
</a> {% acl_end %}
{% can_edit stack %} {% can_delete stack %}
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-stack' stack.id %}"> <a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'topologie:del-stack' stack.pk %}">
<i class="fa fa-edit"></i> <i class="fa fa-trash"></i>
</a> </a>
{% acl_end %} {% acl_end %}
{% can_delete stack %} </td>
<a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'topologie:del-stack' stack.pk %}"> </tr>
<i class="fa fa-trash"></i> {% endfor %}
</a>
{% acl_end %}
</td>
{% endif %}
</tr>
{% empty %}
<tr class="active">
<td>{{stack.name}}</td>
<td>{{stack.stack_id}}</td>
<td>{{stack.details}}</td>
<td>Aucun</td>
<td>
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'stack' stack.pk %}">
<i class="fa fa-history"></i>
</a>
{% can_edit stack %}
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-stack' stack.id %}">
<i class="fa fa-edit"></i>
</a>
{% acl_end %}
{% can_delete stack %}
<a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'topologie:del-stack' stack.pk %}">
<i class="fa fa-trash"></i>
</a>
{% acl_end %}
</td>
{% endfor %}
</tbody>
{% endfor %}
</table> </table>

View file

@ -43,7 +43,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{switch_bay.name}}</td> <td>{{switch_bay.name}}</td>
<td>{{switch_bay.building}}</td> <td>{{switch_bay.building}}</td>
<td>{{switch_bay.info}}</td> <td>{{switch_bay.info}}</td>
<td>{{switch_bay.switch_set.all |join:", "}}</td> <td>{% for switch in switch_bay.switch_set.all %}<a href="{% url 'topologie:index-port' switch.pk %}">{{switch }} </a>{% endfor %}</td>
<td class="text-right"> <td class="text-right">
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'switchbay' switch_bay.pk %}"> <a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'switchbay' switch_bay.pk %}">
<i class="fa fa-history"></i> <i class="fa fa-history"></i>

View file

@ -352,6 +352,7 @@ def new_stack(request):
if stack.is_valid(): if stack.is_valid():
stack.save() stack.save()
messages.success(request, "Stack crée") messages.success(request, "Stack crée")
return redirect(reverse('topologie:index-physical-grouping'))
return form( return form(
{'topoform': stack, 'action_name': 'Créer'}, {'topoform': stack, 'action_name': 'Créer'},
'topologie/topo.html', 'topologie/topo.html',
@ -367,7 +368,7 @@ def edit_stack(request, stack, **_kwargs):
if stack.is_valid(): if stack.is_valid():
if stack.changed_data: if stack.changed_data:
stack.save() stack.save()
return redirect(reverse('topologie:index-physical-grouping')) return redirect(reverse('topologie:index-physical-grouping'))
return form( return form(
{'topoform': stack, 'action_name': 'Editer'}, {'topoform': stack, 'action_name': 'Editer'},
'topologie/topo.html', 'topologie/topo.html',