mirror of
https://github.com/inventree/InvenTree.git
synced 2025-08-14 15:41:10 +00:00
Refactor forms for editing and deleting a PartParameter
- PartParameters now loaded using the API, not pre-rendered
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
{% extends "modal_delete_form.html" %}
|
||||
|
||||
{% block pre_form_content %}
|
||||
Are you sure you want to remove this parameter?
|
||||
{% endblock %}
|
@@ -21,41 +21,23 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table id='param-table' class='table table-condensed table-striped' data-toolbar='#button-toolbar'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-field='name' data-serachable='true'>{% trans "Name" %}</th>
|
||||
<th data-field='value' data-searchable='true'>{% trans "Value" %}</th>
|
||||
<th data-field='units' data-searchable='true'>{% trans "Units" %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for param in part.get_parameters %}
|
||||
<tr>
|
||||
<td>{{ param.template.name }}</td>
|
||||
<td>{{ param.data }}</td>
|
||||
<td>
|
||||
{{ param.template.units }}
|
||||
<div class='btn-group' style='float: right;'>
|
||||
{% if roles.part.change %}
|
||||
<button title='{% trans "Edit" %}' class='btn btn-default btn-glyph param-edit' url="{% url 'part-param-edit' param.id %}" type='button'><span class='fas fa-edit'/></button>
|
||||
{% endif %}
|
||||
{% if roles.part.change %}
|
||||
<button title='{% trans "Delete" %}' class='btn btn-default btn-glyph param-delete' url="{% url 'part-param-delete' param.id %}" type='button'><span class='fas fa-trash-alt icon-red'/></button>
|
||||
{% endif %}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<table id='parameter-table' class='table table-condensed table-striped' data-toolbar="#button-toolbar"></table>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block js_ready %}
|
||||
{{ block.super }}
|
||||
|
||||
loadPartParameterTable(
|
||||
'#parameter-table',
|
||||
'{% url "api-part-parameter-list" %}',
|
||||
{
|
||||
params: {
|
||||
part: {{ part.pk }},
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
$('#param-table').inventreeTable({
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user