Commit f609199094216ec6d02f33ecbd0e9a334bba0851
1 parent
bc2b875f6c
Exists in
master
Testing for A5 final push
Showing 7 changed files with 78 additions and 8 deletions Side-by-side Diff
data.json
View file @
f609199
index.js
View file @
f609199
public/stylesheets/main.css
View file @
f609199
routes/crime.js
View file @
f609199
... | ... | @@ -2,22 +2,25 @@ |
2 | 2 | |
3 | 3 | exports.view = function(req, res){ |
4 | 4 | |
5 | - unirest.get("https://yourmapper2.p.mashape.com/datasetlist?format=json&maxlat=40&maxlon=-70&minlat=30&minlon=-90&num=5&sort=location") | |
6 | - .header("X-Mashape-Key", "gj4g6D3zxKmshys7yyf9KNbuywOxp1ueazFjsn6n2fK4sccIGA") | |
7 | - .header("Accept", "application/json") | |
8 | - .end(function (result) { | |
9 | - // console.log(result.status, result.headers, result.body); | |
5 | + // unirest.get("https://yourmapper2.p.mashape.com/datasetlist?format=json&maxlat=40&maxlon=-70&minlat=30&minlon=-90&num=5&sort=location") | |
6 | + // .header("X-Mashape-Key", "gj4g6D3zxKmshys7yyf9KNbuywOxp1ueazFjsn6n2fK4sccIGA") | |
7 | + // .header("Accept", "application/json") | |
8 | + // .end(function (result) { | |
9 | + // // console.log(result.status, result.headers, result.body); | |
10 | 10 | |
11 | - }); | |
11 | + // }); | |
12 | 12 | |
13 | + //37.782551, -122.445368 | |
13 | 14 | |
14 | - | |
15 | 15 | // These code snippets use an open-source library. http://unirest.io/nodejs |
16 | - unirest.get("https://crimescore.p.mashape.com/crimescore?f=json&id=174&lat=38.08809&lon=-85.679626") | |
16 | + //generate the json file here, for now just one call to demonstrate it works | |
17 | + | |
18 | + unirest.get("https://crimescore.p.mashape.com/crimescore?f=json&id=174&lat=37.782551&lon=-122.445368") | |
17 | 19 | .header("X-Mashape-Key", "gj4g6D3zxKmshys7yyf9KNbuywOxp1ueazFjsn6n2fK4sccIGA") |
18 | 20 | .header("Accept", "application/json") |
19 | 21 | .end(function (result) { |
20 | 22 | res.render('pages/tempcrime', result); |
23 | + console.log(result.status, result.headers, result.body); | |
21 | 24 | }); |
22 | 25 | |
23 | 26 |
views/pages/index.ejs
View file @
f609199
... | ... | @@ -13,6 +13,14 @@ |
13 | 13 | <p>The best way to find the safest routes.</p> |
14 | 14 | </div> |
15 | 15 | |
16 | + <form action="/login"> | |
17 | + | |
18 | + <button type="submit" class="btn btn-primary">Log In</button> | |
19 | + <!-- <input type="submit" value="Submit"> --> | |
20 | + </form> | |
21 | + | |
22 | + | |
23 | + | |
16 | 24 | <!--What are for and type for?--> |
17 | 25 | <!-- current submit button takes you to the landing page --> |
18 | 26 | <form action="/landing"> |
... | ... | @@ -69,6 +77,10 @@ |
69 | 77 | } |
70 | 78 | function bus() { |
71 | 79 | localStorage.setItem("mode", "TRANSIT"); |
80 | + } | |
81 | + | |
82 | + function login(){ | |
83 | + | |
72 | 84 | } |
73 | 85 | </script> |
74 | 86 |
views/pages/landing.ejs
View file @
f609199
... | ... | @@ -108,6 +108,21 @@ |
108 | 108 | } |
109 | 109 | |
110 | 110 | function getPoints() { |
111 | + //read json here from passed in parameters | |
112 | + //loop here that loops through the passed in json values for points along the route | |
113 | + //return the list of objects created from those longitudes and latitudes | |
114 | + | |
115 | + //THIS IS THE CODE TO READ JSON BUT IT'S NOT VIABLE TO CREATE ALL THESE POINTS MANUALLY IN A JSON FILE. | |
116 | + //So instead we copy pasted a sample set of points to demonstrate the functionality | |
117 | + | |
118 | + /*var toReturn = []; | |
119 | + for (i = 0; i < [insert ejs symbols here]spots.length[insert ejs symbols here]; i++) { | |
120 | + toReturn.push(new google.maps.LatLng(insert ejs symbols here spots[i].latutudeinsert ejs symbols here, insert ejs symbols here spots[i].longitudeinsert ejs symbols here)); | |
121 | + } | |
122 | + | |
123 | + return toReturn;*/ | |
124 | + | |
125 | + | |
111 | 126 | return [ |
112 | 127 | new google.maps.LatLng(37.782551, -122.445368), |
113 | 128 | new google.maps.LatLng(37.782745, -122.444586), |
views/pages/login.ejs
View file @
f609199
1 | +<!DOCTYPE html> | |
2 | +<html lang="en"> | |
3 | + <head> | |
4 | + <% include ../partials/header %> | |
5 | + </head> | |
6 | + | |
7 | +<!-- Homepage --> | |
8 | + | |
9 | + <body> | |
10 | + <div class="container-fluid"> | |
11 | + <form action="/"> | |
12 | + <div class="form-group"> | |
13 | + <input type="currentLocation" class="form-control" id="origin" placeholder="Username" onchange="saveFrom()"> | |
14 | + <input type="currentLocation" class="form-control" id="origin" placeholder="Password" onchange="saveFrom()"> | |
15 | + </div> | |
16 | + <button class="btn btn-primary">Log In</button> | |
17 | + </form> | |
18 | + </div> | |
19 | + | |
20 | + <!-- Google Map functionality. --> | |
21 | + <script> | |
22 | + </script> | |
23 | + | |
24 | + </body> | |
25 | +</html> |