Permalink
Browse files

"$msg"

  • Loading branch information...
2 parents 6e55a02 + 4fdc484 commit 6c886d1117f85c341c108cfb667c9078dfa315ea robengel committed Jul 14, 2011
@@ -51,6 +51,7 @@ var isTapHold = false;
var isiPad = false;
var tapHoldTimeout;
var backIsMap = false;
+var defaultZoom = 15;
$(window).resize(function() {
pageResize();
@@ -75,7 +76,7 @@ $(document).ready(function () {
$('#map_canvas').gmap({
'center': latlng,
'mapTypeId': google.maps.MapTypeId.ROADMAP,
- 'zoom': 12,
+ 'zoom': defaultZoom,
'callback': function (map) {
globalMap = map;
$.getJSON('/geocamCover/places.json', function(data) {
@@ -129,6 +130,7 @@ $(document).ready(function () {
// This is to go back to the map when the back button is pressed.
window.onpopstate = function(event) {
+ backIsMap = false;
showMap();
}
@@ -171,7 +173,7 @@ $(document).ready(function () {
});
$("#address-form-form").submit(function(e) {
- createPlaceFromAddress();
+ searchPlace();
return false;
});
@@ -200,15 +202,32 @@ $(document).ready(function () {
});
});
-function createPlaceFromAddress() {
+function searchPlace() {
$('#map_canvas').gmap('search', { 'address': $('#address-name').val() }, function(isFound, results) {
if (isFound) {
- $('#map_canvas').gmap('getMap').panTo(results[0].geometry.location);
- var place = new Place();
- place.position = results[0].geometry.location;
- savePlace(place, 'address');
+
+ $('#address-name').val("");
+ $('#map_canvas').gmap('getMap').panTo(results[0].geometry.location);
+ $('#map_canvas').gmap('getMap').setZoom(defaultZoom);
+ // var place = new Place();
+ // place.position = results[0].geometry.location;
+ // savePlace(place, 'address');
+ $("#map_canvas").gmap('addMarker', {
+ 'position': results[0].geometry.location,
+ 'title': $('#address-name').val()
+ }, function(map, marker) {
+ myMarker = marker;
+ });
+
+ $(myMarker).click(function() {
+ // WTF? Why is $(this) an array?
+ clickedPosition = $(this)[0].position;
+ showPage('#place-form');
+ });
+
+ showMap();
} else {
- alert("not found"); //Need another way to display to the user that the address wasn't found
+ alert("Location Not Found."); //Need another way to display to the user that the address wasn't found
}
});
}
@@ -609,6 +628,12 @@ function handleGeolocationQuery(position) {
}, function(map, marker) {
myMarker = marker;
});
+
+ $(myMarker).click(function() {
+ clickedPosition = myLocation;
+ showPage('#place-form');
+ });
+
$('#map_canvas').gmap({
'center': myLocation
});
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -45,10 +45,9 @@ <h1 class='ui-title' style="margin-left: 0px;margin-right: 0px;">GeoCam Cover</h
<h1 class='ui-title' style="margin-left: 0px;margin-right: 0px;">Add Place</h1>
</div>
<form id="address-form-form">
- <h1 class="page-h1">Please enter an address:</h1>
- <input style='width:95%' id="address-name" type="text" placeholder="Enter Address..."/>
- <select id="address-categories-select" class="categories"></select>
- <input class="submit-button big-button" type="submit" value="Add Place"/>
+ <h1 class="page-h1">Search By Location</h1>
+ <input style='width:95%' id="address-name" type="text" placeholder="Address or location name"/>
+ <input class="submit-button big-button" type="submit" value="Search for Place"/>
<input class="big-button" type="button" value="Back to Map" onclick="showMap();"/>
</form>
<input class="big-button" type="button" value="Load Fusion Table" onclick="loadFusionData();"/>

0 comments on commit 6c886d1

Please sign in to comment.