reasons
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package com.zoblak.farmalarm;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -28,7 +30,9 @@ public class MainScreenFragment extends Fragment {
|
||||
WebSettings webSettings = webView.getSettings();
|
||||
webSettings.setJavaScriptEnabled(true);
|
||||
webSettings.setDomStorageEnabled(true);
|
||||
webView.loadUrl("http://agrar.zoblak.com/alarm");
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this.getContext());
|
||||
String controllers = prefs.getString("controllers", "");
|
||||
webView.loadUrl("http://agrar.zoblak.com/alarm?controller_id=" + controllers);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<div class="jumbotron text-center center-block" >
|
||||
{{#with state}}
|
||||
{{#if alarmTriggered}}
|
||||
<div>{{ pretty_reason alarmReasons }}</div>
|
||||
<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}}
|
||||
|
||||
@@ -39,6 +39,22 @@ Template.alarm.helpers({
|
||||
result += '' + parseFloat(temperatures[i]).toFixed(1) + ' °C ';
|
||||
}
|
||||
return result;
|
||||
},
|
||||
pretty_reasons: function(reasons) {
|
||||
var results = "";
|
||||
if(reasons.tooHot) {
|
||||
results += "Temperatura previsoka!";
|
||||
}
|
||||
if(reasons.tooCold) {
|
||||
results += "Temperatura preniska!";
|
||||
}
|
||||
if(reasons.phoneSilent) {
|
||||
results += "Mobitel nedostupan! Provjerite internet!";
|
||||
}
|
||||
if(reasons.boxSilent) {
|
||||
results += "Zoblak kutija se ne javlja! Provjerite internet!";
|
||||
}
|
||||
return results;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -17,30 +17,37 @@ Template.tabs.helpers({
|
||||
},
|
||||
|
||||
selected_controller: function() {
|
||||
return Session.get('controller_id');
|
||||
return
|
||||
},
|
||||
|
||||
accessible: Meteor.zoblak.client.accessible
|
||||
});
|
||||
|
||||
|
||||
function saveParamsAndGo(where) {
|
||||
var hideControllerSelection = Session.get('hide_controller_selection');
|
||||
if (hideControllerSelection) {
|
||||
Router.go(where + "?controller_id=" + Session.get('controller_id'));
|
||||
} else {
|
||||
Router.go(where);
|
||||
}
|
||||
}
|
||||
|
||||
Template.tabs.events({
|
||||
'click .start': function() {
|
||||
Router.go('/');
|
||||
saveParamsAndGo('/');
|
||||
},
|
||||
'click .weather': function() {
|
||||
Router.go('/weather');
|
||||
saveParamsAndGo('/weather');
|
||||
},
|
||||
'click .log': function() {
|
||||
Router.go('/log');
|
||||
saveParamsAndGo('/log');
|
||||
},
|
||||
'click .surveillance': function() {
|
||||
Router.go('/surveillance');
|
||||
saveParamsAndGo('/surveillance');
|
||||
},
|
||||
|
||||
'click .alarm': function() {
|
||||
Router.go('/alarm');
|
||||
saveParamsAndGo('/alarm');
|
||||
},
|
||||
'click .settings': function() {
|
||||
Session.set('templateName', 'settings');
|
||||
|
||||
Reference in New Issue
Block a user