Commit fa43409d3e8abf41a440637d2fba23172bbf0bf2
- Diff rendering mode:
- inline
- side by side
mouchak/static/js/mouchak.js
(25 / 14)
  | |||
67 | 67 | } | |
68 | 68 | $(this.$links[pos]).addClass('active'); | |
69 | 69 | ||
70 | $(this.$links[pos]).find('a p.nav-item-icon').addClass('active'); | ||
71 | this.updateNavIcon(); | ||
70 | //$(this.$links[pos]).find('a p.navicon').addClass('active'); | ||
71 | //this.updateNavIcon(); | ||
72 | 72 | }, | |
73 | 73 | populate: function() { | |
74 | 74 | var item_template = _.template($('#nav-item-template').html()); | |
… | … | ||
90 | 90 | //Fix it always receive the click event. | |
91 | 91 | navClicked: function(event) { | |
92 | 92 | this.$links.removeClass('active'); | |
93 | $('.nav>li>a>p.nav-item-icon').removeClass('active'); | ||
93 | $('#navpos > li > a').find('p.navicon').removeClass('active'); | ||
94 | 94 | ||
95 | 95 | if(this.model.get('customMenu') === false) { | |
96 | 96 | if(!event) { | |
… | … | ||
101 | 101 | pos = 0; | |
102 | 102 | } | |
103 | 103 | $(this.$links[pos]).addClass('active'); | |
104 | $(this.$links[pos]).find('p.nav-item-icon').addClass('active'); | ||
104 | $(this.$links[pos]).find('p.navicon').addClass('active'); | ||
105 | 105 | } | |
106 | 106 | else { | |
107 | 107 | $(event.currentTarget).parent().addClass('active'); | |
108 | 108 | // for maraa custom HTML nav | |
109 | $(event.currentTarget).find('p.nav-item-icon').addClass('active'); | ||
109 | $(event.currentTarget).find('p.navicon').addClass('active'); | ||
110 | 110 | } | |
111 | 111 | } | |
112 | 112 | else if(this.model.get('customMenu') === true) { | |
113 | // get the URL fragment | ||
114 | var fragment = location.hash.split('/')[1]; | ||
115 | // find out where it is in the nav menu | ||
116 | var link = $('.nav').find('a[href="#/'+ fragment +'"]')[0]; | ||
117 | // find its <li> parent all the way up in the main ul.nav | ||
118 | $(link).closest('ul.nav > li').addClass('active'); | ||
119 | // custom nav for maraa | ||
120 | $(link).closest('ul.nav > li > a').find('p.nav-item-icon').addClass('active'); | ||
113 | if(event) { | ||
114 | // TODO: FIX: BAD HACK!! | ||
115 | // Hunt down the bug and fix it! | ||
116 | // Bug is: the following statement doesn't get executed in its normal | ||
117 | // flow; async does!! | ||
118 | setTimeout(function() { | ||
119 | $(event.currentTarget).find('p.navicon').addClass('active'); | ||
120 | }, 100); | ||
121 | } | ||
122 | else { | ||
123 | // get the URL fragment | ||
124 | var fragment = location.hash.split('/')[1]; | ||
125 | // find out where it is in the nav menu | ||
126 | var link = $('.nav').find('a[href="#/'+ fragment +'"]')[0]; | ||
127 | // find its <li> parent all the way up in the main ul.nav | ||
128 | $(link).closest('ul.nav > li').addClass('active'); | ||
129 | // custom nav for maraa | ||
130 | $(link).find('p.navicon').addClass('active'); | ||
131 | } | ||
121 | 132 | } | |
122 | this.updateNavIcon(); | ||
133 | //this.updateNavIcon(); | ||
123 | 134 | }, | |
124 | 135 | navIconPos: { | |
125 | 136 | 'home': '-8px', |