aboutsummaryrefslogtreecommitdiff
path: root/web/app/controller/Root.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-09-05 10:48:29 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-09-05 10:48:29 -0700
commita16110c76f3d6dfd148714201d6667b95f7210e2 (patch)
treecd925c10bd0caab5f4eb33c97c5e38477abe2935 /web/app/controller/Root.js
parent51fbf463f317174dbaa30abc620aa2a99080f5fe (diff)
downloadtrackermap-web-a16110c76f3d6dfd148714201d6667b95f7210e2.tar.gz
trackermap-web-a16110c76f3d6dfd148714201d6667b95f7210e2.tar.bz2
trackermap-web-a16110c76f3d6dfd148714201d6667b95f7210e2.zip
Implement announcement feature
Diffstat (limited to 'web/app/controller/Root.js')
-rw-r--r--web/app/controller/Root.js20
1 files changed, 19 insertions, 1 deletions
diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js
index 935b1f15..bbfa0845 100644
--- a/web/app/controller/Root.js
+++ b/web/app/controller/Root.js
@@ -66,10 +66,28 @@ Ext.define('Traccar.controller.Root', {
});
},
+ showAnnouncement: function (announcement) {
+ var maxWidth = Ext.getBody().getViewSize().width - 2 * Traccar.Style.normalPadding;
+ if (maxWidth > Traccar.Style.windowWidth) {
+ maxWidth = Traccar.Style.windowWidth;
+ }
+ Ext.Msg.show({
+ msg: announcement,
+ buttons: Ext.Msg.OK,
+ closable: false,
+ modal: false,
+ maxWidth: maxWidth
+ }).alignTo(Ext.getBody(), "t-t", [0, Traccar.Style.normalPadding]);
+ },
+
onServerReturn: function (options, success, response) {
- var token, parameters = {};
+ var announcement, token, parameters = {};
if (success) {
Traccar.app.setServer(Ext.decode(response.responseText));
+ announcement = Traccar.app.getServer().get('announcement');
+ if (announcement) {
+ this.showAnnouncement(announcement);
+ }
token = Ext.Object.fromQueryString(window.location.search).token;
if (token) {
parameters.token = token;