{% extends "part/part_base.html" %} {% load static %} {% load i18n %} {% block menubar %} {% include 'part/navbar.html' with tab='tests' %} {% endblock %} {% block heading %} {% trans "Part Test Templates" %} {% endblock %} {% block details %}
{% endblock %} {% block js_ready %} {{ block.super }} loadPartTestTemplateTable( $("#test-template-table"), { part: {{ part.pk }}, params: { part: {{ part.pk }}, } } ); function reloadTable() { $("#test-template-table").bootstrapTable("refresh"); } $("#add-test-template").click(function() { constructForm('{% url "api-part-test-template-list" %}', { method: 'POST', fields: { test_name: {}, description: {}, required: {}, requires_value: {}, requires_attachment: {}, part: { value: {{ part.pk }}, hidden: true, } }, title: '{% trans "Add Test Result Template" %}', onSuccess: reloadTable }); }); $("#test-template-table").on('click', '.button-test-edit', function() { var pk = $(this).attr('pk'); var url = `/api/part/test-template/${pk}/`; constructForm(url, { fields: { test_name: {}, description: {}, required: {}, requires_value: {}, requires_attachment: {}, }, title: '{% trans "Edit Test Result Template" %}', onSuccess: reloadTable, }); }); $("#test-template-table").on('click', '.button-test-delete', function() { var pk = $(this).attr('pk'); var url = `/api/part/test-template/${pk}/`; constructForm(url, { method: 'DELETE', title: '{% trans "Delete Test Result Template" %}', onSuccess: reloadTable, }); }); {% endblock %}