summaryrefslogtreecommitdiffstats
path: root/client/components/main/popup.js
diff options
context:
space:
mode:
authorMaxime Quandalle <maxime@quandalle.com>2015-05-22 20:17:40 +0200
committerMaxime Quandalle <maxime@quandalle.com>2015-05-22 20:17:40 +0200
commit6ef9c7e95fd2c85f944db89a746a8457e216403c (patch)
tree11516d9d0446dbd55ab8058edb0bef9a6f831a63 /client/components/main/popup.js
parentd81cad4251ff1d10d38ed47ceea6612395fe0e24 (diff)
downloadwekan-6ef9c7e95fd2c85f944db89a746a8457e216403c.tar.gz
wekan-6ef9c7e95fd2c85f944db89a746a8457e216403c.tar.bz2
wekan-6ef9c7e95fd2c85f944db89a746a8457e216403c.zip
Improve popup animation
When going back wait for the popup transition to end before removing the DOM element.
Diffstat (limited to 'client/components/main/popup.js')
-rw-r--r--client/components/main/popup.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/client/components/main/popup.js b/client/components/main/popup.js
index e6ce8051..dbd99e4d 100644
--- a/client/components/main/popup.js
+++ b/client/components/main/popup.js
@@ -1,3 +1,12 @@
+// XXX This event list should be abstracted somewhere else.
+var endTransitionEvents = [
+ 'webkitTransitionEnd',
+ 'otransitionend',
+ 'oTransitionEnd',
+ 'msTransitionEnd',
+ 'transitionend'
+].join(' ');
+
Popup.template.events({
click: function(evt) {
if (evt.originalEvent) {
@@ -14,3 +23,18 @@ Popup.template.events({
this.__afterConfirmAction.call(this);
}
});
+
+// When a popup content is removed (ie, when the user press the "back" button),
+// we need to wait for the container translation to end before removing the
+// actual DOM element. For that purpose we use the undocumented `_uihooks` API.
+Popup.template.onRendered(function() {
+ var container = this.find('.content-container');
+ container._uihooks = {
+ removeElement: function(node) {
+ $(node).addClass('no-height');
+ $(container).one(endTransitionEvents, function() {
+ node.parentNode.removeChild(node);
+ });
+ }
+ };
+});