mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-28 10:52:16 +00:00
Asset detail view button improvements
This commit is contained in:
@@ -9,23 +9,25 @@
|
|||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h1>
|
<h1>
|
||||||
{% if edit and object %}
|
{% if edit and object %}
|
||||||
Edit Asset | {{ object.asset_id }}
|
Edit Asset: {{ object.asset_id }}
|
||||||
{% elif duplicate %}
|
{% elif duplicate %}
|
||||||
Duplication of Asset | {{ previous_asset_id }}
|
Duplication of Asset: {{ previous_asset_id }}
|
||||||
{% elif not object %}
|
{% elif not object %}
|
||||||
Create Asset
|
Create Asset
|
||||||
{% else %}
|
{% else %}
|
||||||
Asset | {{ object.asset_id }}
|
Asset: {{ object.asset_id }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<div class="pull-right" style="margin-bottom: 100px">
|
||||||
|
{% include 'helpers/asset_buttons.html' %}
|
||||||
|
</div>
|
||||||
|
|
||||||
<form method="post" id="asset_update_form">
|
<form method="post" id="asset_update_form">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="hidden" name="id" value="{{ object.id|default:0 }}">
|
<input type="hidden" name="id" value="{{ object.id|default:0 }}" hidden=true>
|
||||||
|
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
@@ -33,7 +35,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="{{ form.asset_id.id_for_label }}" class="bold-text">Asset ID</label>
|
<label for="{{ form.asset_id.id_for_label }}">Asset ID</label>
|
||||||
{% if edit or duplicate %}
|
{% if edit or duplicate %}
|
||||||
{% if duplicate %}
|
{% if duplicate %}
|
||||||
{% render_field form.asset_id|add_class:'form-control' value=object.asset_id %}
|
{% render_field form.asset_id|add_class:'form-control' value=object.asset_id %}
|
||||||
@@ -46,11 +48,11 @@
|
|||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="{{ form.description.id_for_label }}"
|
<label for="{{ form.description.id_for_label }}"
|
||||||
class="bold-text">Description</label>
|
>Description</label>
|
||||||
{% render_field form.description|add_class:'form-control' value=object.description %}
|
{% render_field form.description|add_class:'form-control' value=object.description %}
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="{{ form.category.id_for_label }}" class="bold-text">Category</label>
|
<label for="{{ form.category.id_for_label }}" >Category</label>
|
||||||
<select name="{{ form.category.name }}" id="{{ form.category.id_for_label }}"
|
<select name="{{ form.category.name }}" id="{{ form.category.id_for_label }}"
|
||||||
required class="form-control">
|
required class="form-control">
|
||||||
{% for id, choice in form.category.field.choices %}
|
{% for id, choice in form.category.field.choices %}
|
||||||
@@ -60,7 +62,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="{{ form.status.id_for_label }}" class="bold-text">Status</label>
|
<label for="{{ form.status.id_for_label }}" >Status</label>
|
||||||
<select class="form-control" name="{{ form.status.name }}" id="{{ form.status.id_for_label }}" required>
|
<select class="form-control" name="{{ form.status.name }}" id="{{ form.status.id_for_label }}" required>
|
||||||
{% for id, choice in form.status.field.choices %}
|
{% for id, choice in form.status.field.choices %}
|
||||||
<option value="{{ id }}"
|
<option value="{{ id }}"
|
||||||
@@ -134,7 +136,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="{{ form.date_acquired.id_for_label }}" class="bold-text">Date
|
<label for="{{ form.date_acquired.id_for_label }}" >Date
|
||||||
Acquired</label>
|
Acquired</label>
|
||||||
{% if object.date_acquired %}
|
{% if object.date_acquired %}
|
||||||
{% render_field form.date_acquired|add_class:'datepicker form-control' value=object.date_acquired|date %}
|
{% render_field form.date_acquired|add_class:'datepicker form-control' value=object.date_acquired|date %}
|
||||||
@@ -258,26 +260,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div class="btn-group">
|
{% include 'helpers/asset_buttons.html' %}
|
||||||
{% if edit and object %}
|
|
||||||
<!--edit-->
|
|
||||||
<button type="button" class="btn btn-success" onclick="updateAsset()">Save</button>
|
|
||||||
<a class="btn btn-default" href="{% url 'asset_update' object.pk %}?duplicate=true">Duplicate</a>
|
|
||||||
<a class="btn btn-danger" href="#confirm_delete_modal">Delete</a>
|
|
||||||
{% elif duplicate %}
|
|
||||||
<!--duplicate-->
|
|
||||||
<button type="button" class="btn btn-default" onclick="updateAsset()">Create Duplicate</button>
|
|
||||||
<a href="{% url 'asset_detail' previous_asset_pk %}" class="btn">Cancel</a>
|
|
||||||
{% elif not object %}
|
|
||||||
<!--create-->
|
|
||||||
<button type="button" class="btn btn-success" onclick="updateAsset()">Save</button>
|
|
||||||
{% else %}
|
|
||||||
<!--detail-->
|
|
||||||
<a href="{% url 'asset_update' object.pk %}" class="btn btn-warning">Edit</a>
|
|
||||||
<a class="btn btn-default" href="{% url 'asset_update' object.pk %}?duplicate=true">Duplicate</a>
|
|
||||||
<a class="btn btn-danger" href="#confirm_delete_modal">Delete</a>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% include 'confirm_delete.html' with object=object %}
|
{% include 'confirm_delete.html' with object=object %}
|
||||||
|
|
||||||
|
|||||||
20
assets/templates/helpers/asset_buttons.html
Normal file
20
assets/templates/helpers/asset_buttons.html
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<div class="btn-group">
|
||||||
|
{% if edit and object %}
|
||||||
|
<!--edit-->
|
||||||
|
<button type="button" class="btn btn-success" onclick="updateAsset()"><i class="glyphicon glyphicon-floppy-disk"></i> Save</button>
|
||||||
|
<a class="btn btn-default" href="{% url 'asset_update' object.pk %}?duplicate=true"><i class="glyphicon glyphicon-duplicate"></i> Duplicate</a>
|
||||||
|
<a class="btn btn-danger" href="#confirm_delete_modal"><i class="glyphicon glyphicon-trash"></i> Delete</a>
|
||||||
|
{% elif duplicate %}
|
||||||
|
<!--duplicate-->
|
||||||
|
<button type="button" class="btn btn-default" onclick="updateAsset()"><i class="glyphicon glyphicon-ok-sign"></i> Create Duplicate</button>
|
||||||
|
<a href="{% url 'asset_detail' previous_asset_pk %}" class="btn btn-warning"><i class="glyphicon glyphicon-remove"></i> Cancel</a>
|
||||||
|
{% elif not object %}
|
||||||
|
<!--create-->
|
||||||
|
<button type="button" class="btn btn-success" onclick="updateAsset()"><i class="glyphicon glyphicon-floppy-disk"></i> Save</button>
|
||||||
|
{% else %}
|
||||||
|
<!--detail view-->
|
||||||
|
<a href="{% url 'asset_update' object.pk %}" class="btn btn-default"><i class="glyphicon glyphicon-edit"></i> Edit</a>
|
||||||
|
<a class="btn btn-default" href="{% url 'asset_update' object.pk %}?duplicate=true"><i class="glyphicon glyphicon-duplicate"></i> Duplicate</a>
|
||||||
|
<a class="btn btn-danger" href="#confirm_delete_modal"><i class="glyphicon glyphicon-trash"></i> Delete</a>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user