From d8ef55187899f1924706cd957361ee0d877c0fd1 Mon Sep 17 00:00:00 2001 From: tangollama Date: Tue, 7 Jul 2015 23:19:03 -0400 Subject: [PATCH] As requested on slack MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit One element opens at a time. Note that I don’t think this is going to function properly for direct links. Unsure. --- app/components/nav-menu.js | 3 +++ app/controllers/navigation.js | 5 +++++ app/templates/components/nav-menu.hbs | 8 ++++---- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/components/nav-menu.js b/app/components/nav-menu.js index 40c0c6f80e..86501c16b1 100644 --- a/app/components/nav-menu.js +++ b/app/components/nav-menu.js @@ -14,6 +14,9 @@ export default Ember.Component.extend(UserSession, { _setup: function() { let nav = this.get("nav"); + nav.closeSubnav = function() { + this.set('isShowing', false); + }.bind(this); nav.subnav.forEach(function(item) { item.show = this.currentUserCan(item.capability); }.bind(this)); diff --git a/app/controllers/navigation.js b/app/controllers/navigation.js index a22ee7177f..e028e4a577 100644 --- a/app/controllers/navigation.js +++ b/app/controllers/navigation.js @@ -11,6 +11,7 @@ export default Ember.Controller.extend(ProgressDialog, UserSession, Navigation, progressTitle: 'Searching', searchRoute: null, syncStatus: '', + currentOpenNav: null, actions: { search: function() { @@ -28,6 +29,10 @@ export default Ember.Controller.extend(ProgressDialog, UserSession, Navigation, }, navAction: function(nav) { + if (this.currentOpenNav) { + this.currentOpenNav.closeSubnav(); + } + this.currentOpenNav = nav; this.transitionToRoute(nav.route); }, diff --git a/app/templates/components/nav-menu.hbs b/app/templates/components/nav-menu.hbs index 72baf80d7c..13f6d94e4b 100644 --- a/app/templates/components/nav-menu.hbs +++ b/app/templates/components/nav-menu.hbs @@ -1,9 +1,9 @@ {{log this}} {{#if show}} -
- - {{nav.title}} - +
+ {{#link-to nav.route class="primary-section-link nav-link"}} + {{nav.title}} + {{/link-to}}
{{#if isShowing }}