From 2c9b76575ebc2c4bc0bd7aa591e2e24f9ef71fc8 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 2 May 2020 21:55:09 +1000 Subject: [PATCH] Add translation layer for order.js --- InvenTree/InvenTree/urls.py | 1 + InvenTree/templates/base.html | 2 +- .../inventree => templates/js}/order.js | 36 ++++++++++--------- 3 files changed, 21 insertions(+), 18 deletions(-) rename InvenTree/{InvenTree/static/script/inventree => templates/js}/order.js (86%) diff --git a/InvenTree/InvenTree/urls.py b/InvenTree/InvenTree/urls.py index 2cdf6cf598..2da9f140a0 100644 --- a/InvenTree/InvenTree/urls.py +++ b/InvenTree/InvenTree/urls.py @@ -78,6 +78,7 @@ dynamic_javascript_urls = [ url(r'^part.js', DynamicJsView.as_view(template_name='js/part.js'), name='part.js'), url(r'^stock.js', DynamicJsView.as_view(template_name='js/stock.js'), name='stock.js'), url(r'^build.js', DynamicJsView.as_view(template_name='js/build.js'), name='build.js'), + url(r'^order.js', DynamicJsView.as_view(template_name='js/order.js'), name='order.js'), ] urlpatterns = [ diff --git a/InvenTree/templates/base.html b/InvenTree/templates/base.html index ab872d9684..13937eb3ed 100644 --- a/InvenTree/templates/base.html +++ b/InvenTree/templates/base.html @@ -106,7 +106,6 @@ InvenTree - @@ -114,6 +113,7 @@ InvenTree + diff --git a/InvenTree/InvenTree/static/script/inventree/order.js b/InvenTree/templates/js/order.js similarity index 86% rename from InvenTree/InvenTree/static/script/inventree/order.js rename to InvenTree/templates/js/order.js index c4e39d9e1d..17bd67cabb 100644 --- a/InvenTree/InvenTree/static/script/inventree/order.js +++ b/InvenTree/templates/js/order.js @@ -1,3 +1,5 @@ +{% load i18n %} + function removeOrderRowFromOrderWizard(e) { /* Remove a part selection from an order form. */ @@ -121,7 +123,7 @@ function loadPurchaseOrderTable(table, options) { queryParams: filters, groupBy: false, original: options.params, - formatNoMatches: function() { return "No purchase orders found"; }, + formatNoMatches: function() { return "{% trans "No purchase orders found" %}"; }, columns: [ { field: 'pk', @@ -131,7 +133,7 @@ function loadPurchaseOrderTable(table, options) { { sortable: true, field: 'reference', - title: 'Purchase Order', + title: '{% trans "Purchase Order" %}', formatter: function(value, row, index, field) { return renderLink(value, `/order/purchase-order/${row.pk}/`); } @@ -139,25 +141,25 @@ function loadPurchaseOrderTable(table, options) { { sortable: true, field: 'supplier_detail', - title: 'Supplier', + title: '{% trans "Supplier" %}', formatter: function(value, row, index, field) { return imageHoverIcon(row.supplier_detail.image) + renderLink(row.supplier_detail.name, `/company/${row.supplier}/purchase-orders/`); } }, { field: 'supplier_reference', - title: 'Supplier Reference', + title: '{% trans "Supplier Reference" %}', sortable: true, }, { sortable: true, field: 'description', - title: 'Description', + title: '{% trans "Description" %}', }, { sortable: true, field: 'status', - title: 'Status', + title: '{% trans "Status" %}', formatter: function(value, row, index, field) { return purchaseOrderStatusDisplay(row.status, row.status_text); } @@ -165,12 +167,12 @@ function loadPurchaseOrderTable(table, options) { { sortable: true, field: 'creation_date', - title: 'Date', + title: '{% trans "Date" %}', }, { sortable: true, field: 'line_items', - title: 'Items' + title: '{% trans "Items" %}' }, ], }); @@ -194,7 +196,7 @@ function loadSalesOrderTable(table, options) { queryParams: filters, groupBy: false, original: options.params, - formatNoMatches: function() { return "No sales orders found"; }, + formatNoMatches: function() { return "{% trans "No sales orders found" %}"; }, columns: [ { field: 'pk', @@ -204,7 +206,7 @@ function loadSalesOrderTable(table, options) { { sortable: true, field: 'reference', - title: 'Sales Order', + title: '{% trans "Sales Order" %}', formatter: function(value, row, index, field) { return renderLink(value, `/order/sales-order/${row.pk}/`); }, @@ -212,25 +214,25 @@ function loadSalesOrderTable(table, options) { { sortable: true, field: 'customer_detail', - title: 'Customer', + title: '{% trans "Customer" %}', formatter: function(value, row, index, field) { return imageHoverIcon(row.customer_detail.image) + renderLink(row.customer_detail.name, `/company/${row.customer}/sales-orders/`); } }, { field: 'customer_reference', - title: 'Customer Reference', + title: '{% trans "Customer Reference" %}', sotrable: true, }, { sortable: true, field: 'description', - title: 'Description', + title: '{% trans "Description" %}', }, { sortable: true, field: 'status', - title: 'Status', + title: '{% trans "Status" %}', formatter: function(value, row, index, field) { return salesOrderStatusDisplay(row.status, row.status_text); } @@ -238,17 +240,17 @@ function loadSalesOrderTable(table, options) { { sortable: true, field: 'creation_date', - title: 'Creation Date', + title: '{% trans "Creation Date" %}', }, { sortable: true, field: 'shipment_date', - title: "Shipment Date", + title: "{% trans "Shipment Date" %}", }, { sortable: true, field: 'line_items', - title: 'Items' + title: '{% trans "Items" %}' }, ], });