weather works
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
var options = {
|
||||
location: 40.7127+','+ 74.0059, // New York
|
||||
unit: 'c',
|
||||
success: function(weather) {
|
||||
html = '<h2><i class="sw icon-'+weather.code+'"></i> '
|
||||
html += weather.temp+'°'+weather.units.temp+'</h2>';
|
||||
html += '<ul><li>'+weather.city+', '+weather.region +'</li>';
|
||||
html += '<li class="currently">'+weather.currently+'</li>';
|
||||
|
||||
$("#weather").html(html);
|
||||
},
|
||||
error: function(error) {
|
||||
$("#weather").html('<p>'+error+'</p>');
|
||||
}
|
||||
}
|
||||
|
||||
Weather.options = options
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<template name="state">
|
||||
<div> </div>
|
||||
<div class="col-md-12">
|
||||
{{#with controller_state}}
|
||||
<img src="{{ bucket_image }}" class="img-responsive center-block" id="bucket_image" />
|
||||
|
||||
@@ -100,6 +100,8 @@ Template.state.helpers({
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
Template.state.events({
|
||||
'click #water_now': function() {
|
||||
var controller_id = Session.get('controller_id');
|
||||
|
||||
9
app/client/weather.html
Normal file
9
app/client/weather.html
Normal file
@@ -0,0 +1,9 @@
|
||||
<template name="weather">
|
||||
|
||||
<div> </div>
|
||||
<div class="col-md-12">
|
||||
<div class="text-center">
|
||||
{{>simpleWeather}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
39
app/client/weather.js
Normal file
39
app/client/weather.js
Normal file
@@ -0,0 +1,39 @@
|
||||
var options = {
|
||||
|
||||
location: 44.0123 + ',' + 18.19455, // New Visoko
|
||||
unit: 'c',
|
||||
success: function(weather) {
|
||||
html = "<h2><i class='sw icon-" + weather.code + "'></i>";
|
||||
html += weather.temp + '°' + weather.units.temp + '</h2>';
|
||||
html += '<ul><li>' + weather.city + ', ' + weather.region + '</li>';
|
||||
html += "<li class='currently'>" + weather.currently + '</li>';
|
||||
html += '<hr />';
|
||||
|
||||
for (var i = 0; i < 5; i++) {
|
||||
var forecast = weather.forecast[i];
|
||||
html += '<div>';
|
||||
html += "<h2><i class='sw icon-" + forecast.code + "'></i>";
|
||||
html += forecast.high + '°' + weather.units.temp + '</h2>';
|
||||
html += "<li class='currently'>" + daysInBosnian[forecast.day] + ': ' + forecast.text + '</li>';
|
||||
html += "</div>";
|
||||
|
||||
}
|
||||
|
||||
$('#weather').html(html);
|
||||
},
|
||||
error: function(error) {
|
||||
$('#weather').html('<p>' + error + '</p>');
|
||||
}
|
||||
}
|
||||
|
||||
var daysInBosnian = {
|
||||
'Sun': 'Nedjelja',
|
||||
'Mon': 'Ponedjeljak',
|
||||
'Tue': 'Utorak',
|
||||
'Wed': 'Srijeda',
|
||||
'Thu': 'Četvrtak',
|
||||
'Fri': 'Petak',
|
||||
'Sat': 'Subota'
|
||||
};
|
||||
|
||||
Weather.options = options
|
||||
Reference in New Issue
Block a user