Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added google map to search page. still needs data from db or otherwise.

  • Loading branch information...
commit 266d5b3491b122b074b425ddb666146a7a3d10e7 1 parent fdea10f
@kimballfrank kimballfrank authored
Showing with 60 additions and 60 deletions.
  1. +52 −56 webapp/public/scripts/map.js
  2. +8 −4 webapp/views/search.jade
View
108 webapp/public/scripts/map.js
@@ -1,58 +1,54 @@
-<!DOCTYPE html>
- <html>
- <body>
-
- <div id="map_canvas" style="width:425px; height:550px"></div>
+$(document).ready(function() {
- <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
- <script type="text/javascript">
+ var map;
+ var markers = [];
+ var geocoder;
+
+ $('#map-canvas').attr('style','height:200px; margin-bottom:28px;');
+
+ initialize();
+
+ function initialize() {
+ geocoder = new google.maps.Geocoder();
+
+ var myOptions = {
+ zoom: 10,
+ mapTypeId: google.maps.MapTypeId.ROADMAP
+ }
+ map = new google.maps.Map(document.getElementById("map-canvas"), myOptions);
+ codeAddress("84403");
+ addMarker("253 25th Street, Ogden, UT", "Roosters Brewing");
+ addMarker("2501 Wall Ave, Ogden, UT", "Union Grill");
+ addMarker("195 25th Street, Ogden, UT", "jasoh!");
+ }
+
+ function codeAddress(address) {
+ geocoder.geocode({
+ 'address': address
+ }, function(results, status) {
+ if (status == google.maps.GeocoderStatus.OK) {
+ map.setCenter(results[0].geometry.location);
+ } else {
+ alert("Geocode was not successful for the following reason: " + status);
+ }
+ });
+
+ }
+
+ function addMarker(address, myTitle) {
+ geocoder.geocode({
+ 'address': address
+ }, function(results, status) {
+ if (status == google.maps.GeocoderStatus.OK) {
+ var marker = new google.maps.Marker({
+ map: map,
+ title: myTitle,
+ position: results[0].geometry.location
+ });
+ } else {
+ alert("Geocode was not successful for the following reason: " + status);
+ }
+ });
+ }
- var map;
- var markers = [];
- var geocoder;
- var map;
-
- initialize();
-
- function initialize() {
- geocoder = new google.maps.Geocoder();
-
- var myOptions = {
- zoom: 10,
- mapTypeId: google.maps.MapTypeId.ROADMAP
- }
- map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
- codeAddress("84403");
- addMarker("253 25th Street, Ogden, UT", "Roosters Brewing");
- addMarker("2501 Wall Ave, Ogden, UT","Union Grill");
- addMarker("195 25th Street, Ogden, UT", "jasoh!");
- }
-
- function codeAddress(address) {
- geocoder.geocode( { 'address': address}, function(results, status) {
- if (status == google.maps.GeocoderStatus.OK) {
- map.setCenter(results[0].geometry.location);
- } else {
- alert("Geocode was not successful for the following reason: " + status);
- }
- });
-
- }
-
- function addMarker(address, myTitle) {
- geocoder.geocode( { 'address': address}, function(results, status) {
- if (status == google.maps.GeocoderStatus.OK) {
- var marker = new google.maps.Marker({
- map: map,
- title: myTitle,
- position: results[0].geometry.location
- });
- } else {
- alert("Geocode was not successful for the following reason: " + status);
- }
- });
- }
-
- </script>
- </body>
- </html>
+});
View
12 webapp/views/search.jade
@@ -1,3 +1,7 @@
+block scripts
+ script(src='http://maps.google.com/maps/api/js?sensor=false')
+ script(src='/scripts/map.js')
+
header.site-header
div.container
h1.kitchenly-branding.tk-mic-32-new-web.pull-left
@@ -21,12 +25,12 @@ div.page-contain.container
div.navbar-inner
form.navbar-form.pull-left
div#city-picker.input-append.pull-left
- input#location.typeahead.span4(type="text", placeholder="Ogden, UT")
+ input#location.typeahead.span4(type="text", placeholder="What city do you want to eat in?", value="Ogden, UT")
span.add-on
i.icon-map-marker
div#date-picker.input-append.pull-left
- input#date-time.span4(type="text", rel="popover", data-placement="bottom", placeholder="Saturday, November 3, 2012")
+ input#date-time.span4(type="text", rel="popover", data-placement="bottom", placeholder="When do you want to eat?", value="Saturday, November 3rd 2012")
span.add-on
i.icon-calendar
@@ -56,7 +60,7 @@ div.page-contain.container
button.btn.btn-primary.span2(type="submit") Search for Dinner
div.search-results-contain
- div.map
+ div#map-canvas
div.result-grid.container
div.row.result-row
@@ -107,4 +111,4 @@ div.page-contain.container
i.icon-star
i.icon-star
div.pull-right
- a.btn.btn-primary.btn-large(href="#") Book It!
+ a.btn.btn-primary.btn-large(href="/payment") Book It!
Please sign in to comment.
Something went wrong with that request. Please try again.