WHAT
This commit is contained in:
commit
d7a6e0d3ba
|
@ -117,12 +117,13 @@ class Stop(models.Model):
|
||||||
'road': self.road.name,
|
'road': self.road.name,
|
||||||
'area': self.area.name,
|
'area': self.area.name,
|
||||||
'name_mr': self.name_mr,
|
'name_mr': self.name_mr,
|
||||||
|
'direction': self.dbdirection,
|
||||||
'routes': ", ".join([r.route.alias for r in RouteDetail.objects.filter(stop=self)]),
|
'routes': ", ".join([r.route.alias for r in RouteDetail.objects.filter(stop=self)]),
|
||||||
'alternative_names': ", ".join([a.name for a in self.alt_names.all().filter(typ='common')])
|
'alternative_names': ", ".join([a.name for a in self.alt_names.all().filter(typ='common')])
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_geojson(self, srid=4326):
|
def get_geojson(self, srid=4326):
|
||||||
print srid
|
# print srid
|
||||||
if self.point is not None:
|
if self.point is not None:
|
||||||
geom = json.loads(self.point.transform(srid, True).geojson)
|
geom = json.loads(self.point.transform(srid, True).geojson)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -164,6 +164,7 @@ var API_BASE = "/1.0/",
|
||||||
var $displayName = $('<h2 />').text(stop.display_name).appendTo($div);
|
var $displayName = $('<h2 />').text(stop.display_name).appendTo($div);
|
||||||
var $slug = $('<div />').addClass("stopSlug").text(stop.slug).appendTo($div);
|
var $slug = $('<div />').addClass("stopSlug").text(stop.slug).appendTo($div);
|
||||||
var $road = $("<div />").addClass("stopRoad").text("Road: " + stop.road).appendTo($div);
|
var $road = $("<div />").addClass("stopRoad").text("Road: " + stop.road).appendTo($div);
|
||||||
|
var $direction = $("<div />").addClass("stopDirection").text("Direction: " + stop.direction).appendTo($div);
|
||||||
var $routes = $('<div />').text("Routes: " + stop.routes).appendTo($div);
|
var $routes = $('<div />').text("Routes: " + stop.routes).appendTo($div);
|
||||||
// var $formLabel = $("<div />").text("Edit:").appendTo($div);
|
// var $formLabel = $("<div />").text("Edit:").appendTo($div);
|
||||||
var $form = $('<form />').attr("id", "stopForm").appendTo($div);
|
var $form = $('<form />').attr("id", "stopForm").appendTo($div);
|
||||||
|
@ -222,12 +223,15 @@ var API_BASE = "/1.0/",
|
||||||
var geojsonString = JSON.stringify(geojson);
|
var geojsonString = JSON.stringify(geojson);
|
||||||
//console.log(geojsonString);
|
//console.log(geojsonString);
|
||||||
var url = API_BASE + "stop/" + stop.slug + "?srid=3857";
|
var url = API_BASE + "stop/" + stop.slug + "?srid=3857";
|
||||||
$.post(url, {'geojson': geojsonString}, function(response) {
|
var $postXHR = $.post(url, {'geojson': geojsonString}, function(response) {
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
alert("error saving");
|
alert("error saving");
|
||||||
}
|
}
|
||||||
//console.log(response);
|
//console.log(response);
|
||||||
}, "json");
|
}, "json");
|
||||||
|
$postXHR.fail(function(e) {
|
||||||
|
alert('failed ' + JSON.stringify(e));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
return $div;
|
return $div;
|
||||||
}
|
}
|
||||||
|
@ -296,6 +300,8 @@ var API_BASE = "/1.0/",
|
||||||
clickout: false,
|
clickout: false,
|
||||||
toggle: true
|
toggle: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//map.addControl(new OpenLayers.Control.ZoomPanel());
|
||||||
map.addControl(mapControl);
|
map.addControl(mapControl);
|
||||||
mapControl.activate();
|
mapControl.activate();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user