mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-22 16:02:16 +00:00
Tidy up logic for which links to show, made comments duplicate
This commit is contained in:
@@ -7,14 +7,16 @@
|
|||||||
{% block main %}
|
{% block main %}
|
||||||
|
|
||||||
<h4>
|
<h4>
|
||||||
Asset
|
{% if edit and object %}
|
||||||
{% if object.id %}
|
Edit Asset | {{ object.asset_id }}
|
||||||
| {{ object.asset_id }}
|
|
||||||
{% elif duplicate %}
|
{% elif duplicate %}
|
||||||
Duplication of {{ object.asset_id }}
|
Duplication of Asset | {{ previous_asset_id }}
|
||||||
|
{% elif not object %}
|
||||||
|
Create Asset
|
||||||
{% else %}
|
{% else %}
|
||||||
Create
|
Asset | {{ object.asset_id }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</h4>
|
</h4>
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
|
|
||||||
@@ -27,22 +29,22 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col s12">
|
<div class="col s12">
|
||||||
<div class="button-group right">
|
<div class="button-group right">
|
||||||
{% if edit %}
|
{% if edit and object %}
|
||||||
{# <input type="submit" class="btn" value="Save">#}
|
<!--edit-->
|
||||||
<button type="button" class="btn" onclick="updateAsset()">Save</button>
|
<button type="button" class="btn" onclick="updateAsset()">Save</button>
|
||||||
{% if object.pk %}
|
<a class="waves-effect waves-light btn" href="{% url 'asset_update' object.pk %}?duplicate=true">Duplicate</a>
|
||||||
<a class="waves-effect waves-light btn"
|
<a class="waves-effect waves-light btn modal-trigger" href="#confirm_delete_modal">Delete</a>
|
||||||
href="{% url 'asset_duplicate' object.pk %}">Duplicate</a>
|
|
||||||
{% endif %}
|
|
||||||
{% elif duplicate %}
|
{% elif duplicate %}
|
||||||
|
<!--duplicate-->
|
||||||
<button type="button" class="btn" onclick="updateAsset()">Create Duplicate</button>
|
<button type="button" class="btn" onclick="updateAsset()">Create Duplicate</button>
|
||||||
<a href="{% url 'index' %}" class="btn">Cancel</a>
|
<a href="{% url 'asset_detail' previous_asset_pk %}" class="btn">Cancel</a>
|
||||||
|
{% elif not object %}
|
||||||
|
<!--create-->
|
||||||
|
<button type="button" class="btn" onclick="updateAsset()">Save</button>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
<!--detail-->
|
||||||
<a href="{% url 'asset_update' object.pk %}" class="btn">Edit</a>
|
<a href="{% url 'asset_update' object.pk %}" class="btn">Edit</a>
|
||||||
<a class="waves-effect waves-light btn"
|
<a class="waves-effect waves-light btn" href="{% url 'asset_update' object.pk %}?duplicate=true">Duplicate</a>
|
||||||
href="{% url 'asset_duplicate' object.pk %}">Duplicate</a>
|
|
||||||
{% endif %}
|
|
||||||
{% if object and not duplicate %}
|
|
||||||
<a class="waves-effect waves-light btn modal-trigger" href="#confirm_delete_modal">Delete</a>
|
<a class="waves-effect waves-light btn modal-trigger" href="#confirm_delete_modal">Delete</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
@@ -313,7 +315,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
{% if edit %}
|
{% if edit or duplicate %}
|
||||||
var comments_id = '#{{ form.comments.id_for_label }}';
|
var comments_id = '#{{ form.comments.id_for_label }}';
|
||||||
$(comments_id).val('{{ object.comments|linebreaksn }}');
|
$(comments_id).val('{{ object.comments|linebreaksn }}');
|
||||||
M.textareaAutoResize($(comments_id));
|
M.textareaAutoResize($(comments_id));
|
||||||
|
|||||||
Reference in New Issue
Block a user