Commit b34c4948 authored by Manuel Gauto's avatar Manuel Gauto
Browse files

Start on making tabs work

parent 8638d616
...@@ -8,7 +8,7 @@ meteor-base@1.0.4 # Packages every Meteor app needs to have ...@@ -8,7 +8,7 @@ meteor-base@1.0.4 # Packages every Meteor app needs to have
mobile-experience@1.0.4 # Packages for a great mobile UX mobile-experience@1.0.4 # Packages for a great mobile UX
mongo@1.1.12 # The database Meteor supports right now mongo@1.1.12 # The database Meteor supports right now
blaze-html-templates@1.0.4 # Compile .html files into Meteor Blaze views blaze-html-templates@1.0.4 # Compile .html files into Meteor Blaze views
session@1.1.6 # Client-side reactive dictionary for your app session # Client-side reactive dictionary for your app
jquery@1.11.9 # Helpful client-side library jquery@1.11.9 # Helpful client-side library
tracker@1.1.0 # Meteor's client-side reactive programming library tracker@1.1.0 # Meteor's client-side reactive programming library
......
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="description" content="SRCT Weather beautifully displays live weather and forecasts for Mason's campuses."> <meta name="description" content="SRCT Weather beautifully displays live weather and forecasts for Mason's campuses.">
<title>SRCT Weather &bull; 76&#176; F</title> <title>SRCT Weather</title>
<link rel="stylesheet" href="weather.css"> <link rel="stylesheet" href="weather.css">
<link rel="icon" type="image/x-icon" href="lib/favicon.ico" /> <link rel="icon" type="image/x-icon" href="lib/favicon.ico" />
</head> </head>
......
Template.home.events({ Template.home.events({
'click .locationTab' (event) { 'click' (event) {
console.log(event); console.log(event);
} }
}); });
...@@ -31,9 +31,16 @@ Template.weather.helpers({ ...@@ -31,9 +31,16 @@ Template.weather.helpers({
var weatherData = {}; var weatherData = {};
var weatherDataDependency = new Tracker.Dependency; var weatherDataDependency = new Tracker.Dependency;
Template.weather.onCreated(function(){ Template.weather.onCreated(function(){
Meteor.call('getWeather', 38.830295, -77.307717, function(error, result) { Session.set("locationName", "FAIRFAX");
weatherData = result; Tracker.autorun(function () {
weatherDataDependency.changed(); var locName = Session.get("locationName");
var location = LOCATIONS[locName];
Meteor.call('getWeather', location.lat, location.long, function(error, result) {
weatherData = result;
document.title = "SRCT Weather • "+Math.round(result.data.currently.temperature)+"° F"
weatherDataDependency.changed();
});
}); });
}); });
......
...@@ -33,6 +33,7 @@ function getWeather(latitude, longitude) { ...@@ -33,6 +33,7 @@ function getWeather(latitude, longitude) {
return curWeatherData; return curWeatherData;
} }
} else { } else {
console.log("Returning cached data.")
//The data is still valid, return it //The data is still valid, return it
return curWeatherData; return curWeatherData;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment