39 lines
954 B
JavaScript
39 lines
954 B
JavaScript
Template.tabs.helpers({
|
|
class_for: function(tab_name) {
|
|
var templateName = Session.get('templateName');
|
|
|
|
if (templateName === tab_name) {
|
|
return tab_name + ' active';
|
|
} else if (templateName === 'display' && tab_name === 'news') {
|
|
return tab_name + ' active'
|
|
} else {
|
|
return tab_name;
|
|
}
|
|
},
|
|
|
|
selected_controller: function() {
|
|
return Session.get('controller_id');
|
|
},
|
|
});
|
|
|
|
Template.tabs.events({
|
|
'click .start': function() {
|
|
Session.set('templateName', 'start');
|
|
},
|
|
'click .weather': function() {
|
|
Session.set('templateName', 'weather');
|
|
},
|
|
'click .log': function() {
|
|
Session.set('templateName', 'log');
|
|
},
|
|
'click .settings': function() {
|
|
Session.set('templateName', 'settings');
|
|
},
|
|
|
|
'click #switch': function() {
|
|
var instance = Template.instance();
|
|
controller_id = instance.$('#controller').val();
|
|
Session.setPersistent('controller_id', controller_id);
|
|
}
|
|
});
|