server side done

This commit is contained in:
Senad Uka
2016-10-29 13:07:08 +02:00
parent d92e208221
commit 7afe902f3f
7 changed files with 61 additions and 16 deletions

View File

@@ -23,5 +23,14 @@ Template.log.events({
Template.sensorData.helpers({
created_at_formatted: function() {
return moment(this.created_at).format("DD.MM.YYYY, HH:mm")
},
all_temperatures: function(temperatures) {
var result = '';
if (temperatures.length > 0) {
for (var i in temperatures) {
result += '' + parseFloat(temperatures[i]).toFixed(1) + ' °C ';
}
}
return result;
}
});

View File

@@ -1,3 +1,3 @@
<template name="sensorData">
<li>{{owner}} / <strong>{{temperatureValue}}°C</strong> / <strong>{{humidityValue}}%</strong> / Bačva puna: <strong>{{tankFull}}</strong> (L0:{{tankLevel0}}-L1:{{tankLevel1}}-L2:{{tankLevel2}}-L3:{{tankLevel3}}-L4:{{tankLevel4}}-full:{{tankFull}}) / {{created_at_formatted}}</li>
<li>{{owner}} / <strong>{{temperatureValue}}°C {{all_temperatures temperatures}}</strong> / <strong>{{humidityValue}}%</strong> / Bačva puna: <strong>{{tankFull}}</strong> (L0:{{tankLevel0}}-L1:{{tankLevel1}}-L2:{{tankLevel2}}-L3:{{tankLevel3}}-L4:{{tankLevel4}}-full:{{tankFull}}) / {{created_at_formatted}}</li>
</template>

View File

@@ -16,5 +16,9 @@ Router.route('/', function() {
});
Router.route('/farmalarm', function() {
if (Meteor.zoblak.client.accessible('alarm')) {
Session.set('templateName', 'alarm');
} else {
Session.set('templateName', 'no_access')
}
});