mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Part Edit view now ajaxified
This commit is contained in:
parent
c0902626f4
commit
9fd275ed3e
@ -1,11 +1,14 @@
|
||||
{% extends "part/part_base.html" %}
|
||||
|
||||
{% load static %}
|
||||
{% block details %}
|
||||
|
||||
{% include 'part/tabs.html' with tab='detail' %}
|
||||
|
||||
<h3>Part Details</h3>
|
||||
|
||||
{% include 'modal.html' %}
|
||||
{% include 'modal_delete.html' %}
|
||||
|
||||
<table class='table table-striped'>
|
||||
<tr>
|
||||
<td>Part name</td>
|
||||
@ -15,6 +18,12 @@
|
||||
<td>Description</td>
|
||||
<td>{{ part.decription }}</td>
|
||||
</tr>
|
||||
{% if part.IPN %}
|
||||
<tr>
|
||||
<td>IPN</td>
|
||||
<td>{{ part.IPN }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
<tr>
|
||||
<td>Category</td>
|
||||
<td>
|
||||
@ -73,8 +82,22 @@
|
||||
{% endif %}
|
||||
|
||||
<div class='container-fluid'>
|
||||
<a href="{% url 'part-edit' part.id %}"><button class="btn btn-info">Edit Part</button></a>
|
||||
<a href="{% url 'part-delete' part.id %}"><button class="btn btn-danger">Delete Part</button></a>
|
||||
<button class="btn btn-info" id='edit-part'>Edit Part</button>
|
||||
<button class="btn btn-danger" id='delete-part'>Delete Part</button>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
{% block javascript %}
|
||||
|
||||
<script type='text/javascript' src="{% static 'script/modal_form.js' %}"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$("#edit-part").click(function() {
|
||||
launchModalForm("#modal-form", "{% url 'part-edit' part.id %}");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
@ -84,10 +84,12 @@ class PartDetail(DetailView):
|
||||
template_name = 'part/detail.html'
|
||||
|
||||
|
||||
class PartEdit(UpdateView):
|
||||
class PartEdit(AjaxUpdateView):
|
||||
model = Part
|
||||
form_class = EditPartForm
|
||||
template_name = 'part/edit.html'
|
||||
ajax_template_name = 'modal_form.html'
|
||||
ajax_form_title = 'Edit Part Properties'
|
||||
|
||||
|
||||
class PartDelete(DeleteView):
|
||||
|
Loading…
Reference in New Issue
Block a user