summaryrefslogtreecommitdiffstats
path: root/client/lib/utils.js
diff options
context:
space:
mode:
authorXavier Priour <xavier.priour@bubblyware.com>2015-12-17 11:59:26 +0100
committerXavier Priour <xavier.priour@bubblyware.com>2015-12-17 11:59:26 +0100
commit43b1c4b576b8f0e4c342ec19684000a06809a253 (patch)
treec92938735d6ad7635b2cb9739c2b509829dbbf84 /client/lib/utils.js
parent4cea6fca908b4f9acd8687293041ebee86284883 (diff)
parentce88495d4783d2352bdc277a69496d90c38495ce (diff)
downloadwekan-43b1c4b576b8f0e4c342ec19684000a06809a253.tar.gz
wekan-43b1c4b576b8f0e4c342ec19684000a06809a253.tar.bz2
wekan-43b1c4b576b8f0e4c342ec19684000a06809a253.zip
Merge remote-tracking branch 'upstream/devel' into devel
Diffstat (limited to 'client/lib/utils.js')
-rw-r--r--client/lib/utils.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/client/lib/utils.js b/client/lib/utils.js
index 6bdd5822..4f772a60 100644
--- a/client/lib/utils.js
+++ b/client/lib/utils.js
@@ -22,6 +22,17 @@ Utils = {
return string.charAt(0).toUpperCase() + string.slice(1);
},
+ windowResizeDep: new Tracker.Dependency(),
+
+ // in fact, what we really care is screen size
+ // large mobile device like iPad or android Pad has a big screen, it should also behave like a desktop
+ // in a small window (even on desktop), Wekan run in compact mode.
+ // we can easily debug with a small window of desktop broswer. :-)
+ isMiniScreen() {
+ this.windowResizeDep.depend();
+ return $(window).width() <= 800;
+ },
+
// Determine the new sort index
calculateIndex(prevCardDomElement, nextCardDomElement, nCards = 1) {
let base, increment;
@@ -54,3 +65,9 @@ Utils = {
};
},
};
+
+// A simple tracker dependency that we invalidate every time the window is
+// resized. This is used to reactively re-calculate the popup position in case
+// of a window resize. This is the equivalent of a "Signal" in some other
+// programming environments (eg, elm).
+$(window).on('resize', () => Utils.windowResizeDep.changed());