summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2018-11-19 07:46:34 +0100
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2018-11-19 07:46:34 +0100
commit932bb827aed72ecc172a7a78d600effe579a067a (patch)
tree9ea4eb475056730b1775f6b879c79ce8d7103d0e
parent238ec4669c314dd72a69be65211e3d7512da70c8 (diff)
Trigger events when the sidebar is opened or closed
The calls to the default methods from the server to open and close the sidebar had to be replaced by their implementation to be able to also trigger an event when the animation ends. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
-rw-r--r--js/views/sidebarview.js26
1 files changed, 21 insertions, 5 deletions
diff --git a/js/views/sidebarview.js b/js/views/sidebarview.js
index 528a63241..6807eb767 100644
--- a/js/views/sidebarview.js
+++ b/js/views/sidebarview.js
@@ -49,9 +49,13 @@
* removed through "removeTab()".
*
* The SidebarView can be opened or closed programatically using "open()"
- * and "close()". It will delegate on "OC.Apps.showAppSidebar()" and
- * "OC.Apps.hideAppSidebar()", so it must be used along an "#app-content"
- * that takes into account the "with-app-sidebar" CSS class.
+ * and "close()".
+ *
+ * No matter if it is done programatically or by the user, opening the
+ * sidebar triggers the "open" and "opened" events, and closing
+ * the sidebar triggers the "close" and "closed" events; in both cases the
+ * first event is triggered when the animation starts and the second one
+ * when the animation ends.
*
* In order for the user to be able to open the sidebar when it is closed,
* the SidebarView shows a small icon ("#app-sidebar-trigger") on the right
@@ -139,13 +143,25 @@
return;
}
- OC.Apps.showAppSidebar();
+ this.trigger('open');
+
+ this.getUI('sidebar').removeClass('disappear')
+ .show('slide', { direction: 'right' }, 300, function() {
+ this.trigger('opened');
+ }.bind(this));
this._open = true;
},
close: function() {
- OC.Apps.hideAppSidebar();
+ this.trigger('close');
+
+ this.getUI('sidebar')
+ .hide('slide', { direction: 'right' }, 300, function() {
+ this.getUI('sidebar').addClass('disappear');
+
+ this.trigger('closed');
+ }.bind(this));
this._open = false;
},