summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/new_sidebar.js
diff options
context:
space:
mode:
authorAnnabel Dunstone Gray <annabel.dunstone@gmail.com>2017-07-17 17:33:12 -0500
committerAnnabel Dunstone Gray <annabel.dunstone@gmail.com>2017-07-18 13:37:43 -0500
commitcb83c50d4663532b5b1729b27301d22102c17524 (patch)
tree7e13b20323c6317a90851df737b21035003bdcf6 /app/assets/javascripts/new_sidebar.js
parentfe0c3b79d92348f54c61b81635be65f895d2f712 (diff)
downloadgitlab-ce-cb83c50d4663532b5b1729b27301d22102c17524.tar.gz
Add mobile navigation on project page
Diffstat (limited to 'app/assets/javascripts/new_sidebar.js')
-rw-r--r--app/assets/javascripts/new_sidebar.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/app/assets/javascripts/new_sidebar.js b/app/assets/javascripts/new_sidebar.js
new file mode 100644
index 00000000000..4aadeb6b462
--- /dev/null
+++ b/app/assets/javascripts/new_sidebar.js
@@ -0,0 +1,23 @@
+const SIDEBAR_EXPANDED_CLASS = 'nav-sidebar-expanded';
+
+export default class NewNavSidebar {
+ constructor() {
+ this.initDomElements();
+ this.bindEvents();
+ }
+
+ initDomElements() {
+ this.$sidebar = $('.nav-sidebar');
+ this.$openSidebar = $('.toggle-mobile-nav');
+ this.$closeSidebar = $('.close-nav-button');
+ }
+
+ bindEvents() {
+ this.$openSidebar.on('click', e => this.toggleSidebarNav(e, true));
+ this.$closeSidebar.on('click', e => this.toggleSidebarNav(e, false));
+ }
+
+ toggleSidebarNav(show) {
+ this.$sidebar.toggleClass(SIDEBAR_EXPANDED_CLASS, show);
+ }
+}