Introduced consolidated object table template

This commit is contained in:
Jeremy Stretch
2016-05-16 16:15:37 -04:00
parent e1a0b8fee6
commit 149720d18a
18 changed files with 47 additions and 127 deletions
+1 -1
View File
@@ -71,7 +71,7 @@
</div>
<div class="row">
<div class="col-md-12">
{% include 'ipam/inc/prefix_table.html' with table=prefix_table table_template='panel_table.html' heading='Child Prefixes' %}
{% include 'utilities/obj_table.html' with table=prefix_table table_template='panel_table.html' heading='Child Prefixes' bulk_edit_url='ipam:prefix_bulk_edit' bulk_delete_url='ipam:prefix_bulk_delete' %}
</div>
</div>
{% endblock %}
+1 -1
View File
@@ -28,7 +28,7 @@
<h1>Aggregates</h1>
<div class="row">
<div class="col-md-9">
{% include 'ipam/inc/aggregate_table.html' %}
{% include 'utilities/obj_table.html' with bulk_edit_url='ipam:aggregate_bulk_edit' bulk_delete_url='ipam:aggregate_bulk_delete' %}
</div>
<div class="col-md-3">
{% include 'inc/filter_panel.html' %}
@@ -1,22 +0,0 @@
{% load render_table from django_tables2 %}
{% if perms.ipam.change_aggregate or perms.ipam.delete_aggregate %}
<form method="post" class="form form-horizontal">
{% csrf_token %}
<input type="hidden" name="redirect_url" value="{{ request.path }}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}" />
{% render_table table table_template|default:'table.html' %}
{% if perms.ipam.change_aggregate %}
<button type="submit" name="_edit" formaction="{% url 'ipam:aggregate_bulk_edit' %}" class="btn btn-warning btn-sm">
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
Edit Selected
</button>
{% endif %}
{% if perms.ipam.delete_aggregate %}
<button type="submit" name="_delete" formaction="{% url 'ipam:aggregate_bulk_delete' %}" class="btn btn-danger btn-sm">
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
Delete Selected
</button>
{% endif %}
</form>
{% else %}
{% render_table table table_template|default:'table.html' %}
{% endif %}
@@ -1,22 +0,0 @@
{% load render_table from django_tables2 %}
{% if perms.ipam.change_ipaddress or perms.ipam.delete_ipaddress %}
<form method="post" class="form form-horizontal">
{% csrf_token %}
<input type="hidden" name="redirect_url" value="{{ request.path }}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}" />
{% render_table table table_template|default:'table.html' %}
{% if perms.ipam.change_ipaddress %}
<button type="submit" name="_edit" formaction="{% url 'ipam:ipaddress_bulk_edit' %}" class="btn btn-warning btn-sm">
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
Edit Selected
</button>
{% endif %}
{% if perms.ipam.delete_ipaddress %}
<button type="submit" name="_delete" formaction="{% url 'ipam:ipaddress_bulk_delete' %}" class="btn btn-danger btn-sm">
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
Delete Selected
</button>
{% endif %}
</form>
{% else %}
{% render_table table table_template|default:'table.html' %}
{% endif %}
@@ -1,22 +0,0 @@
{% load render_table from django_tables2 %}
{% if perms.ipam.change_prefix or perms.ipam.delete_prefix %}
<form method="post" class="form form-horizontal">
{% csrf_token %}
<input type="hidden" name="redirect_url" value="{{ request.path }}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}" />
{% render_table table table_template|default:'table.html' %}
{% if perms.ipam.change_prefix %}
<button type="submit" name="_edit" formaction="{% url 'ipam:prefix_bulk_edit' %}" class="btn btn-warning btn-sm">
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
Edit Selected
</button>
{% endif %}
{% if perms.ipam.delete_prefix %}
<button type="submit" name="_delete" formaction="{% url 'ipam:prefix_bulk_delete' %}" class="btn btn-danger btn-sm">
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
Delete Selected
</button>
{% endif %}
</form>
{% else %}
{% render_table table table_template|default:'table.html' %}
{% endif %}
-14
View File
@@ -1,14 +0,0 @@
{% load render_table from django_tables2 %}
{% if perms.ipam.delete_rir %}
<form method="post" class="form form-horizontal">
{% csrf_token %}
<input type="hidden" name="redirect_url" value="{{ request.path }}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}" />
{% render_table table table_template|default:'table.html' %}
<button type="submit" name="_delete" formaction="{% url 'ipam:rir_bulk_delete' %}" class="btn btn-danger btn-sm">
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
Delete Selected
</button>
</form>
{% else %}
{% render_table table table_template|default:'table.html' %}
{% endif %}
-22
View File
@@ -1,22 +0,0 @@
{% load render_table from django_tables2 %}
{% if perms.ipam.change_vlan or perms.ipam.delete_vlan %}
<form method="post" class="form form-horizontal">
{% csrf_token %}
<input type="hidden" name="redirect_url" value="{{ request.path }}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}" />
{% render_table table table_template|default:'table.html' %}
{% if perms.ipam.change_vlan %}
<button type="submit" name="_edit" formaction="{% url 'ipam:vlan_bulk_edit' %}" class="btn btn-warning btn-sm">
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
Edit Selected
</button>
{% endif %}
{% if perms.ipam.delete_vlan %}
<button type="submit" name="_delete" formaction="{% url 'ipam:vlan_bulk_delete' %}" class="btn btn-danger btn-sm">
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
Delete Selected
</button>
{% endif %}
</form>
{% else %}
{% render_table table table_template|default:'table.html' %}
{% endif %}
+1 -1
View File
@@ -33,7 +33,7 @@
<h1>IP Addresses</h1>
<div class="row">
<div class="col-md-9">
{% include 'ipam/inc/ipaddress_table.html' %}
{% include 'utilities/obj_table.html' with bulk_edit_url='ipam:ipaddress_bulk_edit' bulk_delete_url='ipam:ipaddress_bulk_delete' %}
</div>
<div class="col-md-3">
<div class="panel panel-default">
+1 -1
View File
@@ -97,7 +97,7 @@
<div class="row">
<div class="col-md-12">
{% if child_prefix_table.rows %}
{% include 'ipam/inc/prefix_table.html' with table=child_prefix_table table_template='panel_table.html' heading='Child Prefixes' parent=prefix %}
{% include 'utilities/obj_table.html' with table=child_prefix_table table_template='panel_table.html' heading='Child Prefixes' parent=prefix bulk_edit_url='ipam:prefix_bulk_edit' bulk_delete_url='ipam:prefix_bulk_delete' %}
{% elif prefix.new_subnet %}
<a href="{% url 'ipam:prefix_add' %}?prefix={{ prefix.new_subnet }}{% if prefix.vrf %}&vrf={{ prefix.vrf.pk }}{% endif %}{% if prefix.site %}&site={{ prefix.site.pk }}{% endif %}" class="btn btn-success">
<i class="glyphicon glyphicon-plus" aria-hidden="true"></i> Add Child Prefix
@@ -7,7 +7,7 @@
{% include 'ipam/inc/prefix_header.html' with active_tab='ip-addresses' %}
<div class="row">
<div class="col-md-12">
{% include 'ipam/inc/ipaddress_table.html' with table=ip_table table_template='panel_table.html' heading='IP Addresses' %}
{% include 'utilities/obj_table.html' with table=ip_table table_template='panel_table.html' heading='IP Addresses' bulk_edit_url='ipam:ipaddress_bulk_edit' bulk_delete_url='ipam:ipaddress_bulk_delete' %}
</div>
</div>
{% endblock %}
+3 -3
View File
@@ -7,11 +7,11 @@
{% block content %}
<div class="pull-right">
{% if perms.ipam.add_prefix %}
<a href="{% url 'ipam:prefix_add' %}" class="btn btn-primary">
<a href="{{ action_urls.add }}" class="btn btn-primary">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
Add a prefix
</a>
<a href="{% url 'ipam:prefix_import' %}" class="btn btn-info">
<a href="{{ action_urls.import }}" class="btn btn-info">
<span class="glyphicon glyphicon-import" aria-hidden="true"></span>
Import prefixes
</a>
@@ -33,7 +33,7 @@
<h1>Prefixes</h1>
<div class="row">
<div class="col-md-9">
{% include 'ipam/inc/prefix_table.html' %}
{% include 'utilities/obj_table.html' with bulk_edit_url='ipam:prefix_bulk_edit' bulk_delete_url='ipam:prefix_bulk_delete' %}
</div>
<div class="col-md-3">
<div class="panel panel-default">
+1 -1
View File
@@ -15,7 +15,7 @@
<h1>RIRs</h1>
<div class="row">
<div class="col-md-12">
{% include 'ipam/inc/rir_table.html' %}
{% include 'utilities/obj_table.html' with bulk_delete_url='ipam:rir_bulk_delete' %}
</div>
</div>
{% endblock %}
+1 -1
View File
@@ -33,7 +33,7 @@
<h1>VLANs</h1>
<div class="row">
<div class="col-md-9">
{% include 'ipam/inc/vlan_table.html' %}
{% include 'utilities/obj_table.html' with bulk_edit_url='ipam:vlan_bulk_edit' bulk_delete_url='ipam:vlan_bulk_delete' %}
</div>
<div class="col-md-3">
<div class="panel panel-default">
+1 -1
View File
@@ -33,7 +33,7 @@
<h1>VRFs</h1>
<div class="row">
<div class="col-md-9">
{% include 'ipam/inc/vrf_table.html' %}
{% include 'utilities/obj_table.html' with bulk_edit_url='ipam:vrf_bulk_edit' bulk_delete_url='ipam:vrf_bulk_delete' %}
</div>
<div class="col-md-3">
<div class="panel panel-default">
@@ -1,17 +1,18 @@
{% load render_table from django_tables2 %}
{% if perms.ipam.change_vrf or perms.ipam.delete_vrf %}
{% load helpers %}
{% if table.model|user_can_change:request.user or table.model|user_can_delete:request.user %}
<form method="post" class="form form-horizontal">
{% csrf_token %}
<input type="hidden" name="redirect_url" value="{{ request.path }}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}" />
{% render_table table table_template|default:'table.html' %}
{% if perms.ipam.change_vrf %}
<button type="submit" name="_edit" formaction="{% url 'ipam:vrf_bulk_edit' %}" class="btn btn-warning btn-sm">
{% if bulk_edit_url and table.model|user_can_change:request.user %}
<button type="submit" name="_edit" formaction="{% url bulk_edit_url %}" class="btn btn-warning btn-sm">
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
Edit Selected
</button>
{% endif %}
{% if perms.ipam.delete_vrf %}
<button type="submit" name="_delete" formaction="{% url 'ipam:vrf_bulk_delete' %}" class="btn btn-danger btn-sm">
{% if bulk_delete_url and table.model|user_can_delete:request.user %}
<button type="submit" name="_delete" formaction="{% url bulk_delete_url %}" class="btn btn-danger btn-sm">
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
Delete Selected
</button>