From c9924470ad6a91f2ae2f543405ca353664e36c06 Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 8 Nov 2021 09:44:45 +1100 Subject: [PATCH] Replace dialog messages with alerts --- InvenTree/templates/js/translated/forms.js | 40 +++++++++++++--------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/InvenTree/templates/js/translated/forms.js b/InvenTree/templates/js/translated/forms.js index a86b64d0e2..f5cf775f4f 100644 --- a/InvenTree/templates/js/translated/forms.js +++ b/InvenTree/templates/js/translated/forms.js @@ -347,10 +347,12 @@ function constructForm(url, options) { constructCreateForm(OPTIONS.actions.POST, options); } else { // User does not have permission to POST to the endpoint - showAlertDialog( - '{% trans "Action Prohibited" %}', - '{% trans "Create operation not allowed" %}' - ); + showMessage('{% trans "Action Prohibited" %}', { + style: 'danger', + details: '{% trans "Create operation not allowed" %}', + icon: 'fas fa-user-times', + }); + console.log(`'POST action unavailable at ${url}`); } break; @@ -360,10 +362,12 @@ function constructForm(url, options) { constructChangeForm(OPTIONS.actions.PUT, options); } else { // User does not have permission to PUT/PATCH to the endpoint - showAlertDialog( - '{% trans "Action Prohibited" %}', - '{% trans "Update operation not allowed" %}' - ); + showMessage('{% trans "Action Prohibited" %}', { + style: 'danger', + details: '{% trans "Update operation not allowed" %}', + icon: 'fas fa-user-times', + }); + console.log(`${options.method} action unavailable at ${url}`); } break; @@ -372,10 +376,12 @@ function constructForm(url, options) { constructDeleteForm(OPTIONS.actions.DELETE, options); } else { // User does not have permission to DELETE to the endpoint - showAlertDialog( - '{% trans "Action Prohibited" %}', - '{% trans "Delete operation not allowed" %}' - ); + showMessage('{% trans "Action Prohibited" %}', { + style: 'danger', + details: '{% trans "Delete operation not allowed" %}', + icon: 'fas fa-user-times', + }); + console.log(`DELETE action unavailable at ${url}`); } break; @@ -384,10 +390,12 @@ function constructForm(url, options) { // TODO? } else { // User does not have permission to GET to the endpoint - showAlertDialog( - '{% trans "Action Prohibited" %}', - '{% trans "View operation not allowed" %}' - ); + showMessage('{% trans "Action Prohibited" %}', { + style: 'danger', + details: '{% trans "View operation not allowed" %}', + icon: 'fas fa-user-times', + }); + console.log(`GET action unavailable at ${url}`); } break;