summaryrefslogtreecommitdiffstats
path: root/browser/src/map/handler
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2021-10-12 15:43:19 -0400
committerpedropintosilva <65948705+pedropintosilva@users.noreply.github.com>2022-01-26 16:46:06 +0100
commita6cddca66939a131f9a27bad181fdbd328dc5951 (patch)
treee8ec0aaf1123be7e379feb7096228e41839a19b8 /browser/src/map/handler
parentbrowser: add initial Map.Infobar handler (diff)
downloadonline-a6cddca66939a131f9a27bad181fdbd328dc5951.tar.gz
online-a6cddca66939a131f9a27bad181fdbd328dc5951.zip
browser: show infobar if user is admin
Change-Id: Ie1626752d2d0d05e20d6a68eaa55fefa1d22ca63 Signed-off-by: Henry Castro <hcastro@collabora.com>
Diffstat (limited to 'browser/src/map/handler')
-rw-r--r--browser/src/map/handler/Map.Infobar.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/browser/src/map/handler/Map.Infobar.js b/browser/src/map/handler/Map.Infobar.js
index 2e92001d6e..8bcfbfad8c 100644
--- a/browser/src/map/handler/Map.Infobar.js
+++ b/browser/src/map/handler/Map.Infobar.js
@@ -5,12 +5,31 @@
L.Map.Infobar = L.Handler.extend({
+ initialize: function (map) {
+ L.Handler.prototype.initialize.call(this, map);
+ map.on('updateviewslist', this.onUpdateList, this);
+ },
+
+ onUpdateList: function () {
+ var docLayer = this._map._docLayer || {};
+ var viewInfo = this._map._viewInfo[docLayer._viewId];
+
+ if (viewInfo && !this.enabled() && viewInfo.userextrainfo &&
+ viewInfo.userextrainfo.is_admin) {
+ this.enable();
+ }
+ },
+
addHooks: function () {
+ this._map.off('updateviewslist', this.onUpdateList, this);
L.DomEvent.on(window, 'message', this.onMessage, this);
var url = window.feedbackLocation.replace(/feedback.html/g, 'updatecheck.html');
this.remove();
- this._iframeInfobar = L.iframeDialog(url);
+
+ this._iframeInfobar = L.iframeDialog(url, null,
+ L.DomUtil.get('main-document-content'),
+ options);
},
removeHooks: function () {