Skip to content

Commit

Permalink
Remove geocodeStringAndPan to fix place powertag in javascript (#7159)
Browse files Browse the repository at this point in the history
* fix error reporting in geocodeStringAndPan

* remove special restrictions for place power tags

* remove geocodeStringAndPan
  • Loading branch information
nstjean authored and emilyashley committed Jan 9, 2020
1 parent 2460319 commit 05fbd6d
Showing 1 changed file with 3 additions and 29 deletions.
32 changes: 3 additions & 29 deletions app/assets/javascripts/tagging.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,10 @@ function addTag(tagname, submitTo, responseEl = "") {
}
}
if (tagname.slice(0,5).toLowerCase() === "place") {
place = tagname.split(":")[1];
place.replace("-", " ");
geo = geocodeStringAndPan(place);
}
else {
let data = { name: tagname };
sendFormSubmissionAjax(data, submitTo, responseEl);
tagname = tagname.replace(/ /g, '-');
}
let data = { name: tagname };
sendFormSubmissionAjax(data, submitTo, responseEl);
}

function setupTagDelete(el) {
Expand Down Expand Up @@ -104,28 +100,6 @@ function getDeletionPathId(deletion_path) {
return deletion_path.split("/").pop();
}

function geocodeStringAndPan(string, onComplete) {
var url = "https://maps.googleapis.com/maps/api/geocode/json?address=" + string.split(" ").join("+");
var Blurred = $.ajax({
async: false,
url: url,
complete: function(data) {
geometry = data.responseJSON.results[0].geometry.location;
lat = geometry.lat;
lng = geometry.lng;

var geo = [lat, lng];

if (geo.length > 0) {
var r = confirm("This looks like a location. Is this full description of the location accurate?");
if(r) {
addTag("lat:" + geo[0].toString() + ",lng:" + geo[1].toString()+",place:"+string);
}
}
},
});
}

function promptTag(val) {
var input;
switch(val) {
Expand Down

0 comments on commit 05fbd6d

Please sign in to comment.