1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Introduced clone, edit, and delete buttons

This commit is contained in:
Jeremy Stretch
2019-12-13 15:29:55 -05:00
parent 85563e21db
commit 8acd3d0a72
24 changed files with 153 additions and 184 deletions

View File

@@ -1,4 +1,5 @@
{% extends '_base.html' %}
{% load buttons %}
{% load custom_links %}
{% load helpers %}
@@ -13,14 +14,10 @@
</div>
<div class="pull-right noprint">
{% if perms.dcim.change_cable %}
<a href="{% url 'dcim:cable_edit' pk=cable.pk %}" class="btn btn-warning">
<span class="fa fa-pencil" aria-hidden="true"></span> Edit this cable
</a>
{% edit_button cable %}
{% endif %}
{% if perms.dcim.delete_cable %}
<a href="{% url 'dcim:cable_delete' pk=cable.pk %}" class="btn btn-danger">
<span class="fa fa-trash" aria-hidden="true"></span> Delete this cable
</a>
{% delete_button cable %}
{% endif %}
</div>
<h1>{% block title %}Cable {{ cable }}{% endblock %}</h1>

View File

@@ -60,19 +60,13 @@
</div>
{% endif %}
{% if perms.dcim.add_device %}
{% clone_button 'dcim:device_add' device %}
{% clone_button device %}
{% endif %}
{% if perms.dcim.change_device %}
<a href="{% url 'dcim:device_edit' pk=device.pk %}" class="btn btn-warning">
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
Edit this device
</a>
{% edit_button device %}
{% endif %}
{% if perms.dcim.delete_device %}
<a href="{% url 'dcim:device_delete' pk=device.pk %}" class="btn btn-danger">
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
Delete this device
</a>
{% delete_button device %}
{% endif %}
</div>
<h1>{{ device }}</h1>

View File

@@ -34,19 +34,13 @@
</div>
{% endif %}
{% if perms.dcim.add_devicetype %}
{% clone_button 'dcim:devicetype_add' devicetype %}
{% clone_button devicetype %}
{% endif %}
{% if perms.dcim.change_devicetype %}
<a href="{% url 'dcim:devicetype_edit' pk=devicetype.pk %}" class="btn btn-warning">
<span class="fa fa-pencil" aria-hidden="true"></span>
Edit this device type
</a>
{% edit_button devicetype use_pk=True %}
{% endif %}
{% if perms.dcim.delete_devicetype %}
<a href="{% url 'dcim:devicetype_delete' pk=devicetype.pk %}" class="btn btn-danger">
<span class="fa fa-trash" aria-hidden="true"></span>
Delete this device type
</a>
{% delete_button devicetype use_pk=True %}
{% endif %}
</div>
<h1>{{ devicetype.manufacturer }} {{ devicetype.model }}</h1>

View File

@@ -18,12 +18,12 @@
<div class="pull-right noprint">
{% if perms.dcim.change_interface %}
<a href="{% if interface.device %}{% url 'dcim:interface_edit' pk=interface.pk %}{% else %}{% url 'virtualization:interface_edit' pk=interface.pk %}{% endif %}" class="btn btn-warning">
<span class="fa fa-pencil" aria-hidden="true"></span> Edit this interface
<span class="fa fa-pencil" aria-hidden="true"></span> Edit
</a>
{% endif %}
{% if perms.dcim.delete_interface %}
<a href="{% if interface.device %}{% url 'dcim:interface_delete' pk=interface.pk %}{% else %}{% url 'virtualization:interface_delete' pk=interface.pk %}{% endif %}" class="btn btn-danger">
<span class="fa fa-trash" aria-hidden="true"></span> Delete this interface
<span class="fa fa-trash" aria-hidden="true"></span> Delete
</a>
{% endif %}
</div>

View File

@@ -32,19 +32,13 @@
</div>
<div class="pull-right noprint">
{% if perms.dcim.add_powerfeed %}
{% clone_button 'dcim:powerfeed_add' powerfeed %}
{% clone_button powerfeed %}
{% endif %}
{% if perms.dcim.change_powerfeed %}
<a href="{% url 'dcim:powerfeed_edit' pk=powerfeed.pk %}" class="btn btn-warning">
<span class="fa fa-pencil" aria-hidden="true"></span>
Edit this power feed
</a>
{% edit_button powerfeed %}
{% endif %}
{% if perms.dcim.delete_powerfeed %}
<a href="{% url 'dcim:powerfeed_delete' pk=powerfeed.pk %}" class="btn btn-danger">
<span class="fa fa-trash" aria-hidden="true"></span>
Delete this power feed
</a>
{% delete_button powerfeed %}
{% endif %}
</div>
<h1>{% block title %}{{ powerfeed }}{% endblock %}</h1>

View File

@@ -1,7 +1,8 @@
{% extends '_base.html' %}
{% load static %}
{% load buttons %}
{% load custom_links %}
{% load helpers %}
{% load static %}
{% block header %}
<div class="row noprint">
@@ -30,16 +31,10 @@
</div>
<div class="pull-right noprint">
{% if perms.dcim.change_powerpanel %}
<a href="{% url 'dcim:powerpanel_edit' pk=powerpanel.pk %}" class="btn btn-warning">
<span class="fa fa-pencil" aria-hidden="true"></span>
Edit this power panel
</a>
{% edit_button powerpanel %}
{% endif %}
{% if perms.dcim.delete_powerpanel %}
<a href="{% url 'dcim:powerpanel_delete' pk=powerpanel.pk %}" class="btn btn-danger">
<span class="fa fa-trash" aria-hidden="true"></span>
Delete this power panel
</a>
{% delete_button powerpanel %}
{% endif %}
</div>
<h1>{% block title %}{{ powerpanel }}{% endblock %}</h1>

View File

@@ -33,17 +33,13 @@
<span class="fa fa-chevron-right" aria-hidden="true"></span> Next Rack
</a>
{% if perms.dcim.add_rack %}
{% clone_button 'dcim:rack_add' rack %}
{% clone_button rack %}
{% endif %}
{% if perms.dcim.change_rack %}
<a href="{% url 'dcim:rack_edit' pk=rack.pk %}" class="btn btn-warning">
<span class="fa fa-pencil" aria-hidden="true"></span> Edit this rack
</a>
{% edit_button rack %}
{% endif %}
{% if perms.dcim.delete_rack %}
<a href="{% url 'dcim:rack_delete' pk=rack.pk %}" class="btn btn-danger">
<span class="fa fa-trash" aria-hidden="true"></span> Delete this rack
</a>
{% delete_button rack %}
{% endif %}
</div>
<h1>{% block title %}Rack {{ rack }}{% endblock %}</h1>

View File

@@ -40,19 +40,13 @@
</button>
{% endif %}
{% if perms.dcim.add_site %}
{% clone_button 'dcim:site_add' site %}
{% clone_button site %}
{% endif %}
{% if perms.dcim.change_site %}
<a href="{% url 'dcim:site_edit' slug=site.slug %}" class="btn btn-warning">
<span class="fa fa-pencil" aria-hidden="true"></span>
Edit this site
</a>
{% edit_button site %}
{% endif %}
{% if perms.dcim.delete_site %}
<a href="{% url 'dcim:site_delete' slug=site.slug %}" class="btn btn-danger">
<span class="fa fa-trash" aria-hidden="true"></span>
Delete this site
</a>
{% delete_button site %}
{% endif %}
</div>
<h1>{% block title %}{{ site }}{% endblock %}</h1>