Files
old-tfm/app/client/tabs.js

50 lines
1.1 KiB
JavaScript
Raw Normal View History

2016-02-28 10:05:14 +01:00
Template.tabs.helpers({
class_for: function(tab_name) {
var templateName = Session.get('templateName');
2016-02-28 10:05:14 +01:00
if (templateName === tab_name) {
return tab_name + ' active';
} else if (templateName === 'display' && tab_name === 'news') {
return tab_name + ' active'
} else {
return tab_name;
}
},
2016-02-28 10:05:14 +01:00
selected_controller: function() {
return Session.get('controller_id');
},
2016-10-15 15:58:41 +02:00
2016-10-23 15:10:20 +02:00
accessible: Meteor.zoblak.client.accessible
2016-02-28 10:05:14 +01:00
});
2016-10-29 17:01:09 +02:00
2016-02-28 10:05:14 +01:00
Template.tabs.events({
'click .start': function() {
2016-10-29 17:01:09 +02:00
Router.go('/');
2016-02-28 10:05:14 +01:00
},
'click .weather': function() {
2016-10-29 17:01:09 +02:00
Router.go('/weather');
2016-02-28 10:05:14 +01:00
},
'click .log': function() {
2016-10-29 17:01:09 +02:00
Router.go('/log');
2016-02-28 10:05:14 +01:00
},
2016-10-08 16:02:59 +02:00
'click .surveillance': function() {
2016-10-29 17:01:09 +02:00
Router.go('/surveillance');
2016-02-28 10:05:14 +01:00
},
2016-10-15 15:58:41 +02:00
'click .alarm': function() {
2016-10-29 17:01:09 +02:00
Router.go('/alarm');
},
'click .settings': function() {
Session.set('templateName', 'settings');
2016-10-15 15:58:41 +02:00
},
2016-02-28 10:05:14 +01:00
'click #switch': function() {
var instance = Template.instance();
controller_id = instance.$('#controller').val();
Session.setPersistent('controller_id', controller_id);
}
});