I'm trying to make a reactive menu using meteor session (to persist the view the user was).. but it is not working, the Session.get('currentView') get changed (teste in chrome console), but the page don't render again.
.html
<div class="col-1-1 menu" style="height: 42px;">
<ul>
<li><a class="dashButton" href="#"># Dashboard</a></li>
<li><a class="myJobsButton"href="#">Jobs</a></li>
<li><a class="helpPageButton"href="#">Help</a></li>
</ul>
<br style="clear:left"/>
</div>
{{#if currentViewIs "dashboard"}}
{{> dashboard}}
{{else}}
{{#if currentViewIs "myJobs"}}
{{> myJobs}}
{{else}}
{{#if currentViewIs "helpPage"}}
{{> helpPage}}
{{else}}
{{> dashboard}}
{{/if}}
{{/if}}
{{/if}}
client.js
Template.userPage.currentViewIs = function (view) {
if( Session.get('currentView') == view)
return true;
return false;
};
Template.userPage.events({
'click .dashButton': function (evt) {
Session.set('currentView', 'dashboard');
},
'click .myJobsButton': function (evt) {
Session.set('currentView', 'myJobs');
},
'click .helpPageButton': function (evt) {
Session.set('currentView', 'helpPage');
}
});