Commit 85a0dd41121c09ba9cd1a9011fc4a9bbf15acfa2
- Diff rendering mode:
- inline
- side by side
mouchak/static/js/mouchak.js
(56 / 16)
  | |||
54 | 54 | //console.log('rendering custom menu..'); | |
55 | 55 | this.$el.append(this.model.get('html')); | |
56 | 56 | } | |
57 | |||
58 | this.updateNavIcon(); | ||
59 | |||
57 | 60 | this.$links = $('.nav > li'); | |
58 | 61 | if(!this.$links) { | |
59 | 62 | throw new Error('Ill-formed menu! Please check you have <ul> element' + | |
… | … | ||
71 | 71 | $(this.$links[pos]).addClass('active'); | |
72 | 72 | ||
73 | 73 | //$(this.$links[pos]).find('a p.navicon').addClass('active'); | |
74 | //this.updateNavIcon(); | ||
75 | 74 | }, | |
76 | 75 | populate: function() { | |
77 | 76 | var item_template = _.template($('#nav-item-template').html()); | |
… | … | ||
94 | 94 | this.$links.removeClass('active'); | |
95 | 95 | $('#navpos > li > a').find('p.navicon').removeClass('active'); | |
96 | 96 | ||
97 | this.updateNavIcon(); | ||
98 | |||
97 | 99 | if(this.model.get('customMenu') === false) { | |
98 | 100 | if(!event) { | |
99 | 101 | var fragment = location.hash.split('/')[1]; | |
… | … | ||
134 | 134 | $(link).find('p.navicon').addClass('active'); | |
135 | 135 | } | |
136 | 136 | } | |
137 | //this.updateNavIcon(); | ||
138 | 137 | }, | |
139 | navIconPos: { | ||
140 | 'home': '-8px', | ||
141 | 'about': '-8px', | ||
142 | 'global-radio': '-56px', | ||
143 | 'signal-strength': '-90px', | ||
144 | 'research-methodologies': '-80px', | ||
145 | 'news': '-8px', | ||
146 | 'contact': '-8px' | ||
147 | }, | ||
138 | // update the navbar based on the page | ||
148 | 139 | updateNavIcon: function() { | |
149 | 140 | var fragment = location.hash.split('/')[1]; | |
150 | var background = 'url("/static/img/nav-icons/'+fragment+'.svg") no-repeat'; | ||
151 | $('.nav>li.nav-icon').css('background', background); | ||
152 | $('.nav>li.nav-icon').css('top', this.navIconPos[fragment]); | ||
141 | console.log('updating nav icon ', fragment); | ||
142 | if(fragment === 'home') { | ||
143 | $('#navpos').hide(); | ||
144 | return; | ||
145 | } | ||
146 | $('#navpos').show(); | ||
153 | 147 | } | |
154 | 148 | }); | |
155 | 149 | ||
… | … | ||
151 | 151 | routes : { | |
152 | 152 | 'signal-strength': 'showSigViz', //added for maraa CR portal | |
153 | 153 | 'global-radio': 'showGlobalRadio', //added for maraa CR portal | |
154 | 'survey/:x': 'showSurvey', //added for maraa CR portal | ||
155 | 'research': 'showResearch', //added for maraa CR portal | ||
154 | 'frequency-finder': 'showFF', //added for maraa CR portal | ||
155 | 'mobile-usage': 'showMU', //added for maraa CR portal | ||
156 | //'survey/:x': 'showSurvey', //added for maraa CR portal | ||
157 | //'research': 'showResearch', //added for maraa CR portal | ||
156 | 158 | 'news' : 'showNews', //added for maraa CR portal | |
157 | 159 | ':page' : 'showPage', | |
158 | 160 | ':page/:subpage': 'showPage', | |
159 | 161 | ':page/:subpage/:evenmore': 'showPage' | |
162 | }, | ||
163 | showFF: function() { | ||
164 | //bad hack to circumvent plugin loading problems | ||
165 | //not even foolproof. | ||
166 | //TODO: should implement plugin loaders | ||
167 | this.showPage('signal-strength'); | ||
168 | try { | ||
169 | if(CRP.ff.init) { | ||
170 | CRP.ff.init(); | ||
171 | } | ||
172 | else { | ||
173 | setTimeout(function() { | ||
174 | CRP.ff.init(); | ||
175 | }, 2000); | ||
176 | } | ||
177 | } catch(e) { | ||
178 | setTimeout(function() { | ||
179 | CRP.ff.init(); | ||
180 | }, 2000); | ||
181 | } | ||
182 | }, | ||
183 | showMU: function() { | ||
184 | //bad hack to circumvent plugin loading problems | ||
185 | //not even foolproof. | ||
186 | //TODO: should implement plugin loaders | ||
187 | this.showPage('signal-strength'); | ||
188 | try { | ||
189 | if(CRP.mv.init) { | ||
190 | CRP.mv.init(); | ||
191 | } | ||
192 | else { | ||
193 | setTimeout(function() { | ||
194 | CRP.mv.init(); | ||
195 | }, 2000); | ||
196 | } | ||
197 | } catch(e) { | ||
198 | setTimeout(function() { | ||
199 | CRP.mv.init(); | ||
200 | }, 2000); | ||
201 | } | ||
160 | 202 | }, | |
161 | 203 | showSigViz: function() { | |
162 | 204 | //bad hack to circumvent plugin loading problems |
mouchak/templates/base.html
(2 / 2)
  | |||
21 | 21 | ||
22 | 22 | <!--TODO: make this optional, only when there is a map plugin in the site. There | |
23 | 23 | is no need to load this for every site --> | |
24 | <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" /> | ||
24 | <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css" /> | ||
25 | 25 | <!--[if lte IE 8]> | |
26 | 26 | <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.ie.css" /> | |
27 | 27 | <![endif]--> | |
28 | <script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet-src.js"></script> | ||
28 | <script src="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js"></script> | ||
29 | 29 | {% block head %} {% endblock %} | |
30 | 30 | </head> | |
31 | 31 | <body> |