Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
As requested on slack
Browse files Browse the repository at this point in the history
One element opens at a time. Note that I don’t think this is going to
function properly for direct links. Unsure.
  • Loading branch information
tangollama committed Jul 8, 2015
1 parent 617e77a commit d8ef551
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
3 changes: 3 additions & 0 deletions app/components/nav-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
5 changes: 5 additions & 0 deletions app/controllers/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default Ember.Controller.extend(ProgressDialog, UserSession, Navigation,
progressTitle: 'Searching',
searchRoute: null,
syncStatus: '',
currentOpenNav: null,

actions: {
search: function() {
Expand All @@ -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);
},

Expand Down
8 changes: 4 additions & 4 deletions app/templates/components/nav-menu.hbs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{{log this}}
{{#if show}}
<div class="category-title">
<a href="#" class="primary-section-link nav-link" {{action 'toggleContent'}}>
<span {{bind-attr class=":mega-octicon nav.iconClass"}}></span>{{nav.title}}
</a>
<div class="category-title" {{action 'toggleContent'}}>
{{#link-to nav.route class="primary-section-link nav-link"}}
<span {{bind-attr class=":mega-octicon nav.iconClass"}}></span>{{nav.title}}
{{/link-to}}
</div>
{{#if isShowing }}
<div class="category-sub-items">
Expand Down

1 comment on commit d8ef551

@jglovier
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jakie-chan-thumbsup

Please sign in to comment.