Commit 41e75dfdcda069f01838445d93c7473875d1bf76

Authored by Paul Wallace
1 parent 77ade48c99
Exists in master

Little update

Showing 1 changed file with 0 additions and 11 deletions Inline Diff

views/pages/index.ejs View file @ 41e75df
<!DOCTYPE html> 1 1 <!DOCTYPE html>
<html lang="en"> 2 2 <html lang="en">
<head> 3 3 <head>
<% include ../partials/header %> 4 4 <% include ../partials/header %>
</head> 5 5 </head>
6 6
<!-- Homepage --> 7 7 <!-- Homepage -->
8 8
<body> 9 9 <body>
<div class="container-fluid"> 10 10 <div class="container-fluid">
<div class="jumbotron text-center"> 11 11 <div class="jumbotron text-center">
<h1>Safe Routes</h1> 12 12 <h1>Safe Routes</h1>
<p>The best way to find the safest routes.</p> 13 13 <p>The best way to find the safest routes.</p>
</div> 14 14 </div>
15 15
16 16
17 17
18 18
<% if(!locals.loggedin || (locals.loggedin != "true")){ %> 19 19 <% if(!locals.loggedin || (locals.loggedin != "true")){ %>
20 20
<%console.log(locals.loggedin)%> 21 21 <%console.log(locals.loggedin)%>
<form action="/login"> 22 22 <form action="/login">
23 23
<button type="submit" class="btn btn-primary">Log In</button> 24 24 <button type="submit" class="btn btn-primary">Log In</button>
<!-- <input type="submit" value="Submit"> --> 25 25 <!-- <input type="submit" value="Submit"> -->
</form> 26 26 </form>
<% } %> 27 27 <% } %>
28 28
29 29
30 30
31 31
<!--What are for and type for?--> 32 32 <!--What are for and type for?-->
<!-- current submit button takes you to the landing page --> 33 33 <!-- current submit button takes you to the landing page -->
<form action="/landing"> 34 34 <form action="/landing">
<!-- First text field and label above the text field for current location --> 35 35 <!-- First text field and label above the text field for current location -->
<div class="form-group text-center"> 36 36 <div class="form-group text-center">
<label for="origin">From</label> 37 37 <label for="origin">From</label>
<input type="text" class="form-control" id="origin" placeholder="Enter Current Location" onclick="initFrom()"> 38 38 <input type="text" class="form-control" id="origin" placeholder="Enter Current Location" onclick="initFrom()">
</div> 39 39 </div>
<!-- Second text field and label above the text field for destination --> 40 40 <!-- Second text field and label above the text field for destination -->
<div class="form-group text-center"> 41 41 <div class="form-group text-center">
<label for="dest">To</label> 42 42 <label for="dest">To</label>
<input type="text" class="form-control" id="dest" placeholder="Enter Destination" onclick="initTo()"> 43 43 <input type="text" class="form-control" id="dest" placeholder="Enter Destination" onclick="initTo()">
</div> 44 44 </div>
<!-- First travel option button, walking 45 45 <!-- First travel option button, walking
This contains a row that holds buttons of type button. Buttons are highlighted upon selection. 46 46 This contains a row that holds buttons of type button. Buttons are highlighted upon selection.
--> 47 47 -->
<div class="row"> 48 48 <div class="row">
<button type="button" class="btn-default img-thumbnail col-xs-4" onclick="walk();"> 49 49 <button type="button" class="btn-default img-thumbnail col-xs-4" onclick="walk();">
<img class="img-responsive" src="images/pedestrian-walking.svg" alt="Walking Option" width="40" height="40"> 50 50 <img class="img-responsive" src="images/pedestrian-walking.svg" alt="Walking Option" width="40" height="40">
</button> 51 51 </button>
52 52
<!-- Second travel button, driving --> 53 53 <!-- Second travel button, driving -->
<button type="button" class="btn-default img-thumbnail col-xs-4" onclick="drive();"> 54 54 <button type="button" class="btn-default img-thumbnail col-xs-4" onclick="drive();">
<img class="img-responsive" src="images/car-compact.svg" alt="Walking Option" width="40" height="40"> 55 55 <img class="img-responsive" src="images/car-compact.svg" alt="Walking Option" width="40" height="40">
</button> 56 56 </button>
57 57
<!-- Third travel button, bus --> 58 58 <!-- Third travel button, bus -->
<button type="button" class="btn-default img-thumbnail col-xs-4" onclick="bus();"> 59 59 <button type="button" class="btn-default img-thumbnail col-xs-4" onclick="bus();">
<img class="img-responsive" src="images/bus.svg" alt="Walking Option" width="40" height="40"> 60 60 <img class="img-responsive" src="images/bus.svg" alt="Walking Option" width="40" height="40">
</button> 61 61 </button>
</div> 62 62 </div>
63 63
<div class="text-center"> 64 64 <div class="text-center">
<button type="submit" class="btn btn-primary btn-space">Go</button> 65 65 <button type="submit" class="btn btn-primary btn-space">Go</button>
</div> 66 66 </div>
</form> 67 67 </form>
</div> 68 68 </div>
69 69
<!-- Google Map functionality. --> 70 70 <!-- Google Map functionality. -->
<script> 71 71 <script>
function initFrom() { 72 72 function initFrom() {
var temp = document.getElementById("origin"); 73 73 var temp = document.getElementById("origin");
74 74
var autoOrigin = new google.maps.places.Autocomplete(temp); 75 75 var autoOrigin = new google.maps.places.Autocomplete(temp);
76 76
google.maps.event.addListener(autoOrigin, 'place_changed', function () { 77 77 google.maps.event.addListener(autoOrigin, 'place_changed', function () {
var place = autoOrigin.getPlace(); 78 78 var place = autoOrigin.getPlace();
// Testing. 79 79 // Testing.
console.log(place); 80 80 console.log(place);
<<<<<<< HEAD 81
//localStorage.setItem("from", place.formatted_address); 82 81 //localStorage.setItem("from", place.formatted_address);
localStorage.setItem("fromIn", temp.value); 83 82 localStorage.setItem("fromIn", temp.value);
localStorage.setItem("originLat", place.geometry.location.lat()); 84 83 localStorage.setItem("originLat", place.geometry.location.lat());
localStorage.setItem("originLng", place.geometry.location.lng()); 85 84 localStorage.setItem("originLng", place.geometry.location.lng());
======= 86
localStorage.setItem("from", place.formatted_address); 87
>>>>>>> 044c2fcc67b88e2e59ea2720d1eb8ababb014660 88
}); 89 85 });
} 90 86 }
91 87
function initTo() { 92 88 function initTo() {
var temp = document.getElementById("dest"); 93 89 var temp = document.getElementById("dest");
94 90
var autoDest = new google.maps.places.Autocomplete(temp); 95 91 var autoDest = new google.maps.places.Autocomplete(temp);
96 92
google.maps.event.addListener(autoDest, 'place_changed', function () { 97 93 google.maps.event.addListener(autoDest, 'place_changed', function () {
var place = autoDest.getPlace(); 98 94 var place = autoDest.getPlace();
// Testing. 99 95 // Testing.
console.log(place); 100 96 console.log(place);
<<<<<<< HEAD 101
//localStorage.setItem("to", place.formatted_address); 102 97 //localStorage.setItem("to", place.formatted_address);
localStorage.setItem("toIn", temp.value); 103 98 localStorage.setItem("toIn", temp.value);
localStorage.setItem("destLat", place.geometry.location.lat()); 104 99 localStorage.setItem("destLat", place.geometry.location.lat());
localStorage.setItem("destLng", place.geometry.location.lng()); 105 100 localStorage.setItem("destLng", place.geometry.location.lng());
}); 106 101 });
} 107 102 }
108 103
if (navigator.geolocation) { 109 104 if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(pos) { 110 105 navigator.geolocation.getCurrentPosition(function(pos) {
var geocoder = new google.maps.Geocoder; 111 106 var geocoder = new google.maps.Geocoder;
var point = new google.maps.LatLng( 112 107 var point = new google.maps.LatLng(
pos.coords.latitude, pos.coords.longitude); 113 108 pos.coords.latitude, pos.coords.longitude);
114 109
localStorage.setItem("originLat", pos.coords.latitude); 115 110 localStorage.setItem("originLat", pos.coords.latitude);
localStorage.setItem("originLng", pos.coords.longitude); 116 111 localStorage.setItem("originLng", pos.coords.longitude);
117 112
geocoder.geocode({'latLng': point}, function (locations, status) { 118 113 geocoder.geocode({'latLng': point}, function (locations, status) {
if (status == google.maps.GeocoderStatus.OK) { 119 114 if (status == google.maps.GeocoderStatus.OK) {
for (var location of locations) { 120 115 for (var location of locations) {
if ($.inArray("street_address", location.types) != -1) { 121 116 if ($.inArray("street_address", location.types) != -1) {
console.log('Your location is: ' + location.formatted_address); 122 117 console.log('Your location is: ' + location.formatted_address);
document.getElementById("origin").value = location.formatted_address; 123 118 document.getElementById("origin").value = location.formatted_address;
saveFrom(); 124 119 saveFrom();
break; 125 120 break;
} 126 121 }
}; 127 122 };
} 128 123 }
}); 129 124 });
======= 130
localStorage.setItem("to", place.formatted_address); 131
>>>>>>> 044c2fcc67b88e2e59ea2720d1eb8ababb014660 132
}); 133 125 });
} 134 126 }
135 127
function saveFrom() { 136 128 function saveFrom() {
var fromInput = document.getElementById("origin").value; 137 129 var fromInput = document.getElementById("origin").value;
localStorage.setItem("from", fromInput); 138 130 localStorage.setItem("from", fromInput);
<<<<<<< HEAD 139