Template.state_details.helpers({ pretty_valve: function(state) { if (state === 'open') return "Otvoren"; if (state === 'opening') return "Otvara se"; if (state === 'closing') return "Zatvara se"; if (state === 'closed') return "Zatvoren"; }, last_communication_time: function() { return moment(this.time).fromNow(); } }); Template.state_details.events({ });