From 2e5d5bcc840da18f14871cff71b895efbb4e8735 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 7 Aug 2021 20:50:32 +1000 Subject: [PATCH] Fix part settings page --- .../templates/InvenTree/settings/part.html | 77 ------------------- .../InvenTree/settings/settings.html | 73 ++++++++++++++++++ 2 files changed, 73 insertions(+), 77 deletions(-) diff --git a/InvenTree/templates/InvenTree/settings/part.html b/InvenTree/templates/InvenTree/settings/part.html index 3fa20820b1..14a18a1aa5 100644 --- a/InvenTree/templates/InvenTree/settings/part.html +++ b/InvenTree/templates/InvenTree/settings/part.html @@ -68,80 +68,3 @@ {% endblock %} - -{% block js_ready %} -{{ block.super }} - - $("#param-table").inventreeTable({ - url: "{% url 'api-part-parameter-template-list' %}", - queryParams: { - ordering: 'name', - }, - formatNoMatches: function() { return '{% trans "No part parameter templates found" %}'; }, - columns: [ - { - field: 'pk', - title: 'ID', - visible: false, - switchable: false, - }, - { - field: 'name', - title: 'Name', - sortable: 'true', - }, - { - field: 'units', - title: 'Units', - sortable: 'true', - }, - { - formatter: function(value, row, index, field) { - var bEdit = ""; - var bDel = ""; - - var html = "
" + bEdit + bDel + "
"; - - return html; - } - } - ] - }); - - $("#new-param").click(function() { - launchModalForm("{% url 'part-param-template-create' %}", { - success: function() { - $("#param-table").bootstrapTable('refresh'); - }, - }); - }); - - $("#param-table").on('click', '.template-edit', function() { - var button = $(this); - - var url = "/part/parameter/template/" + button.attr('pk') + "/edit/"; - - launchModalForm(url, { - success: function() { - $("#param-table").bootstrapTable('refresh'); - } - }); - }); - - $("#param-table").on('click', '.template-delete', function() { - var button = $(this); - - var url = "/part/parameter/template/" + button.attr('pk') + "/delete/"; - - launchModalForm(url, { - success: function() { - $("#param-table").bootstrapTable('refresh'); - } - }); - }); - - $("#import-part").click(function() { - launchModalForm("{% url 'api-part-import' %}?reset", {}); - }); - -{% endblock %} \ No newline at end of file diff --git a/InvenTree/templates/InvenTree/settings/settings.html b/InvenTree/templates/InvenTree/settings/settings.html index 9fd069af52..40125019ff 100644 --- a/InvenTree/templates/InvenTree/settings/settings.html +++ b/InvenTree/templates/InvenTree/settings/settings.html @@ -241,6 +241,79 @@ $("#cat-param-table").on('click', '.template-delete', function() { }); }); +$("#param-table").inventreeTable({ + url: "{% url 'api-part-parameter-template-list' %}", + queryParams: { + ordering: 'name', + }, + formatNoMatches: function() { return '{% trans "No part parameter templates found" %}'; }, + columns: [ + { + field: 'pk', + title: 'ID', + visible: false, + switchable: false, + }, + { + field: 'name', + title: 'Name', + sortable: 'true', + }, + { + field: 'units', + title: 'Units', + sortable: 'true', + }, + { + formatter: function(value, row, index, field) { + var bEdit = ""; + var bDel = ""; + + var html = "
" + bEdit + bDel + "
"; + + return html; + } + } + ] +}); + +$("#new-param").click(function() { + launchModalForm("{% url 'part-param-template-create' %}", { + success: function() { + $("#param-table").bootstrapTable('refresh'); + }, + }); +}); + +$("#param-table").on('click', '.template-edit', function() { + var button = $(this); + + var url = "/part/parameter/template/" + button.attr('pk') + "/edit/"; + + launchModalForm(url, { + success: function() { + $("#param-table").bootstrapTable('refresh'); + } + }); +}); + +$("#param-table").on('click', '.template-delete', function() { + var button = $(this); + + var url = "/part/parameter/template/" + button.attr('pk') + "/delete/"; + + launchModalForm(url, { + success: function() { + $("#param-table").bootstrapTable('refresh'); + } + }); +}); + +$("#import-part").click(function() { + launchModalForm("{% url 'api-part-import' %}?reset", {}); +}); + + enableNavbar({ label: 'settings', toggleId: '#item-menu-toggle',