alarm triggering / silencing works
This commit is contained in:
@@ -3,6 +3,12 @@
|
||||
<div class="hello">
|
||||
<h1> Temperatura </h1>
|
||||
<div class="jumbotron text-center center-block" >
|
||||
{{#with state}}
|
||||
{{#if alarmTriggered}}
|
||||
<img src="/images/alarm.gif" class="img-responsive center-block" id="alarm_image" />
|
||||
<button id="stop_alarm" class="btn btn-danger"> <i class="fa fa-ban"></i> Prekini </button>
|
||||
{{/if}}
|
||||
{{/with}}
|
||||
{{#with last_reading}}
|
||||
<div class="huge_text"> {{ all_temperatures }}</div>
|
||||
<div>{{pretty_time created_at}}</div>
|
||||
|
||||
@@ -25,14 +25,17 @@ function last_sensor_reading() {
|
||||
|
||||
Template.alarm.helpers({
|
||||
last_reading: last_sensor_reading,
|
||||
state: function() {
|
||||
return Meteor.zoblak.client.controller_state().state;
|
||||
},
|
||||
pretty_time: function(time) {
|
||||
return moment(time).format("DD.MM.YYYY, HH:mm")
|
||||
},
|
||||
all_temperatures: function() {
|
||||
var result="";
|
||||
var result = "";
|
||||
var temperatures = last_sensor_reading().temperatures;
|
||||
|
||||
for(var i in temperatures) {
|
||||
for (var i in temperatures) {
|
||||
result += '' + parseFloat(temperatures[i]).toFixed(1) + ' °C ';
|
||||
}
|
||||
return result;
|
||||
@@ -42,6 +45,10 @@ Template.alarm.helpers({
|
||||
Template.alarm.events({
|
||||
'click #run_alarm_settings': function() {
|
||||
Modal.show('alarm_settings');
|
||||
},
|
||||
'click #stop_alarm': function() {
|
||||
let controller_id = Meteor.zoblak.client.controller_state().controller_id;
|
||||
Meteor.call('stopTheAlarm', controller_id);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -23,3 +23,19 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@media all and (orientation: portrait) {
|
||||
#alarm_image {
|
||||
width: 90%;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
@media all and (orientation: landscape) {
|
||||
#alarm_image {
|
||||
width: 40%;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user