From 079c08ef7d58edb1a82bab9b80679246cd8f603f Mon Sep 17 00:00:00 2001
From: Oliver
Date: Mon, 8 Nov 2021 09:34:42 +1100
Subject: [PATCH 1/4] Tweaks to account screens css
---
InvenTree/InvenTree/static/css/inventree.css | 3 +--
InvenTree/templates/account/base.html | 7 +++++--
InvenTree/templates/account/login.html | 1 +
InvenTree/templates/account/logout.html | 1 +
4 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/InvenTree/InvenTree/static/css/inventree.css b/InvenTree/InvenTree/static/css/inventree.css
index 632ec2e0e5..d6296f63f9 100644
--- a/InvenTree/InvenTree/static/css/inventree.css
+++ b/InvenTree/InvenTree/static/css/inventree.css
@@ -34,8 +34,7 @@
}
.login-header {
- padding-right: 30px;
- margin-right: 30px;
+ margin-right: 5px;
}
.login-container input {
diff --git a/InvenTree/templates/account/base.html b/InvenTree/templates/account/base.html
index 7f2486bfcc..ea3795e87c 100644
--- a/InvenTree/templates/account/base.html
+++ b/InvenTree/templates/account/base.html
@@ -71,9 +71,12 @@
{% include "spacer.html" %}
{% inventree_title %}
-
- {% block content %}{% endblock %}
+
+
+ {% block content %}
+ {% endblock %}
+
diff --git a/InvenTree/templates/account/login.html b/InvenTree/templates/account/login.html
index 73c49e46c0..fbe48224b4 100644
--- a/InvenTree/templates/account/login.html
+++ b/InvenTree/templates/account/login.html
@@ -32,6 +32,7 @@ for a account and sign in below:{% endblocktrans %}
{% endif %}
+
{% trans "Sign In" %}
diff --git a/InvenTree/templates/account/logout.html b/InvenTree/templates/account/logout.html
index 7268599bb2..df37c76be4 100644
--- a/InvenTree/templates/account/logout.html
+++ b/InvenTree/templates/account/logout.html
@@ -14,6 +14,7 @@
{% if redirect_field_value %}
{% endif %}
+
{% trans "Back to Site" %}
{% trans 'Sign Out' %}
From ef75838ab808bfe4f510c4216b3ac73bd72d66c3 Mon Sep 17 00:00:00 2001
From: Oliver
Date: Mon, 8 Nov 2021 09:34:57 +1100
Subject: [PATCH 2/4] Properly display notifications when logging in
---
InvenTree/templates/base.html | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/InvenTree/templates/base.html b/InvenTree/templates/base.html
index 856deac4be..4321939b6c 100644
--- a/InvenTree/templates/base.html
+++ b/InvenTree/templates/base.html
@@ -190,6 +190,18 @@ $(document).ready(function () {
{% endif %}
moment.locale('{{ request.LANGUAGE_CODE }}');
+
+ // Account notifications
+ {% if messages %}
+ {% for message in messages %}
+ showMessage(
+ '{{ message }}',
+ {
+ style: 'info',
+ }
+ );
+ {% endfor %}
+ {% endif %}
});
From c9924470ad6a91f2ae2f543405ca353664e36c06 Mon Sep 17 00:00:00 2001
From: Oliver
Date: Mon, 8 Nov 2021 09:44:45 +1100
Subject: [PATCH 3/4] 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;
From ac97edd18b8578eff4260f330034e93b59b1ee97 Mon Sep 17 00:00:00 2001
From: Oliver
Date: Mon, 8 Nov 2021 09:58:55 +1100
Subject: [PATCH 4/4] JS linting
---
InvenTree/templates/about.html | 6 +++---
InvenTree/templates/js/translated/forms.js | 1 -
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/InvenTree/templates/about.html b/InvenTree/templates/about.html
index 34d4bf25e4..34884da9d1 100644
--- a/InvenTree/templates/about.html
+++ b/InvenTree/templates/about.html
@@ -22,12 +22,12 @@
{% inventree_version %} {% include "clip.html" %}
{% inventree_is_development as dev %}
{% if dev %}
- {% trans "Development Version" %}
+ {% trans "Development Version" %}
{% else %}
{% if up_to_date %}
- {% trans "Up to Date" %}
+ {% trans "Up to Date" %}
{% else %}
- {% trans "Update Available" %}
+ {% trans "Update Available" %}
{% endif %}
{% endif %}
diff --git a/InvenTree/templates/js/translated/forms.js b/InvenTree/templates/js/translated/forms.js
index f5cf775f4f..18ba08d512 100644
--- a/InvenTree/templates/js/translated/forms.js
+++ b/InvenTree/templates/js/translated/forms.js
@@ -19,7 +19,6 @@
renderStockLocation,
renderSupplierPart,
renderUser,
- showAlertDialog,
showAlertOrCache,
showApiError,
*/