From f44ba1c011c29b9ab56d5cc877ea14476323d4e3 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 13 Apr 2019 21:11:42 +1000 Subject: [PATCH 1/2] Commonized 'submit_label' text option --- InvenTree/InvenTree/views.py | 2 +- InvenTree/static/script/inventree/modals.js | 8 ++++---- InvenTree/static/script/inventree/stock.js | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/InvenTree/InvenTree/views.py b/InvenTree/InvenTree/views.py index bee9274370..d6ee093a6f 100644 --- a/InvenTree/InvenTree/views.py +++ b/InvenTree/InvenTree/views.py @@ -76,7 +76,7 @@ class AjaxMixin(object): data['title'] = self.ajax_form_title - data['submit_text'] = self.ajax_submit_text + data['submit_label'] = self.ajax_submit_text data['html_form'] = render_to_string( self.getAjaxTemplate(), diff --git a/InvenTree/static/script/inventree/modals.js b/InvenTree/static/script/inventree/modals.js index f29ed0919b..80683fe9f8 100644 --- a/InvenTree/static/script/inventree/modals.js +++ b/InvenTree/static/script/inventree/modals.js @@ -102,8 +102,8 @@ function openModal(options) { modalSetContent(modal, options.content); } - if (options.buttonText) { - modalSetButtonText(modal, options.buttonText); + if (options.submit_label) { + modalSetButtonText(modal, options.submit_label); } $(modal).modal({ @@ -256,8 +256,8 @@ function launchModalForm(url, options = {}) { modalSetTitle(modal, response.title); } - if (response.submit_text) { - modalSetButtonText(response.submit_text); + if (response.submit_label) { + modalSetButtonText(response.submit_label); } if (response.html_form) { diff --git a/InvenTree/static/script/inventree/stock.js b/InvenTree/static/script/inventree/stock.js index 5786ac2622..3ad4503b8b 100644 --- a/InvenTree/static/script/inventree/stock.js +++ b/InvenTree/static/script/inventree/stock.js @@ -207,7 +207,7 @@ function moveStockItems(items, options) { openModal({ modal: modal, title: "Move " + items.length + " stock items", - buttonText: "Move" + submit_label: "Move" }); // Extact part row info From 0e7472dabcfe8230d89bd7eea3a1165b0c5ea2d5 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 13 Apr 2019 21:20:02 +1000 Subject: [PATCH 2/2] Fix display of custom button text - Missing first parameter (modal object) to function call --- InvenTree/static/script/inventree/modals.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/InvenTree/static/script/inventree/modals.js b/InvenTree/static/script/inventree/modals.js index 80683fe9f8..72f51d9d5a 100644 --- a/InvenTree/static/script/inventree/modals.js +++ b/InvenTree/static/script/inventree/modals.js @@ -257,7 +257,7 @@ function launchModalForm(url, options = {}) { } if (response.submit_label) { - modalSetButtonText(response.submit_label); + modalSetButtonText(modal, String(response.submit_label)); } if (response.html_form) {