Files
old-tfm/app/client/tabs.js
2016-10-08 16:02:59 +02:00

41 lines
1.0 KiB
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 .surveillance': function() {
Session.set('templateName', 'surveillance');
},
'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);
}
});