aboutsummaryrefslogtreecommitdiff
path: root/web/app
diff options
context:
space:
mode:
Diffstat (limited to 'web/app')
-rw-r--r--web/app/Application.js9
-rw-r--r--web/app/Style.js1
-rw-r--r--web/app/controller/Root.js4
-rw-r--r--web/app/view/dialog/CommandController.js5
-rw-r--r--web/app/view/dialog/RegisterController.js2
5 files changed, 14 insertions, 7 deletions
diff --git a/web/app/Application.js b/web/app/Application.js
index 0d41fc87..c0a69457 100644
--- a/web/app/Application.js
+++ b/web/app/Application.js
@@ -185,5 +185,14 @@ Ext.define('Traccar.Application', {
} else {
Ext.Msg.alert(Strings.errorTitle, Strings.errorConnection);
}
+ },
+
+ showToast: function (message, title) {
+ Ext.toast({
+ html: message,
+ title: title,
+ width: Traccar.Style.toastWidth,
+ align: 'br'
+ });
}
});
diff --git a/web/app/Style.js b/web/app/Style.js
index 2e646ea8..d1fa6822 100644
--- a/web/app/Style.js
+++ b/web/app/Style.js
@@ -36,6 +36,7 @@ Ext.define('Traccar.Style', {
weekStartDay: 1,
deviceWidth: 400,
+ toastWidth: 300,
reportHeight: 250,
diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js
index 5d22a74a..e389266e 100644
--- a/web/app/controller/Root.js
+++ b/web/app/controller/Root.js
@@ -161,7 +161,7 @@ Ext.define('Traccar.controller.Root', {
socket = new WebSocket(protocol + '//' + window.location.host + pathname + 'api/socket');
socket.onclose = function (event) {
- Ext.toast(Strings.errorSocket, Strings.errorTitle, 'br');
+ Traccar.app.showToast(Strings.errorSocket, Strings.errorTitle);
Ext.Ajax.request({
url: 'api/devices',
@@ -248,7 +248,7 @@ Ext.define('Traccar.controller.Root', {
if (this.soundPressed()) {
this.beep();
}
- Ext.toast(array[i].text, device.get('name'), 'br');
+ Traccar.app.showToast(array[i].text, device.get('name'));
}
}
},
diff --git a/web/app/view/dialog/CommandController.js b/web/app/view/dialog/CommandController.js
index be6245b0..8c566da4 100644
--- a/web/app/view/dialog/CommandController.js
+++ b/web/app/view/dialog/CommandController.js
@@ -121,11 +121,8 @@ Ext.define('Traccar.view.dialog.CommandController', {
onSendResult: function (options, success, response) {
if (success) {
- Ext.toast({
- html: Strings.commandSent,
- align: 'br'
- });
this.closeView();
+ Traccar.app.showToast(Strings.commandSent);
} else {
Traccar.app.showError(response);
}
diff --git a/web/app/view/dialog/RegisterController.js b/web/app/view/dialog/RegisterController.js
index 46ec4b9b..c102581e 100644
--- a/web/app/view/dialog/RegisterController.js
+++ b/web/app/view/dialog/RegisterController.js
@@ -35,7 +35,7 @@ Ext.define('Traccar.view.dialog.RegisterController', {
onCreateReturn: function (options, success, response) {
if (success) {
this.closeView();
- Ext.toast(Strings.loginCreated);
+ Traccar.app.showToast(Strings.loginCreated);
} else {
Traccar.app.showError(response);
}