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

Added views for DeviceRoles

This commit is contained in:
Jeremy Stretch
2016-05-12 14:38:34 -04:00
parent 1fb2cc4b31
commit 21b3fbd50f
10 changed files with 157 additions and 20 deletions

View File

@@ -0,0 +1,11 @@
{% extends 'utilities/obj_edit.html' %}
{% load form_helpers %}
{% block form %}
<div class="panel panel-default">
<div class="panel-heading"><strong>Device Role</strong></div>
<div class="panel-body">
{% render_form form %}
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,21 @@
{% extends '_base.html' %}
{% load helpers %}
{% block title %}Device Roles{% endblock %}
{% block content %}
<div class="pull-right">
{% if perms.dcim.add_devicerole %}
<a href="{% url 'dcim:devicerole_add' %}" class="btn btn-primary">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
Add a device role
</a>
{% endif %}
</div>
<h1>Device Roles</h1>
<div class="row">
<div class="col-md-12">
{% include 'dcim/inc/devicerole_table.html' %}
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,14 @@
{% load render_table from django_tables2 %}
{% if perms.dcim.delete_devicerole %}
<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 'dcim:devicerole_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 %}

View File

@@ -26,12 +26,11 @@
<div class="col-md-6 col-md-offset-3 text-right">
{% if obj %}
<button type="submit" name="_update" class="btn btn-primary">Update</button>
<a href="{{ obj.get_absolute_url }}" class="btn btn-default">Cancel</a>
{% else %}
<button type="submit" name="_create" class="btn btn-primary">Create</button>
<button type="submit" name="_addanother" class="btn btn-primary">Create and Add Another</button>
<a href="{{ cancel_url }}" class="btn btn-default">Cancel</a>
{% endif %}
<a href="{{ cancel_url }}" class="btn btn-default">Cancel</a>
</div>
</div>
</form>