preparation commit for henni
This commit includes: * sql conversion script * fixes for the column type for lat and lng fields * removes prints / console logs * unneccessary comments * if no home data is available, we center to germany * hide non working brand logos * on closed stations the word "closed" is printed instead of outdated price * updates on filling stations is done in chunks of max 10 * configuration separates between development and testing
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// initially go to Brandenburger Tor
|
||||
var lat = 52.516275,
|
||||
lon = 13.377704,
|
||||
zoom = 13;
|
||||
// initially display germany
|
||||
var lat = 50.75653081787912,
|
||||
lon = 9.262980794432847,
|
||||
zoom = 5;
|
||||
|
||||
var map;
|
||||
|
||||
@@ -13,6 +13,7 @@ query_location = function(updater) {
|
||||
navigator.geolocation.getCurrentPosition(function(position) {
|
||||
lat = position.coords.latitude;
|
||||
lon = position.coords.longitude;
|
||||
zoom = 11;
|
||||
if(updater){
|
||||
updater(lat, lon);
|
||||
}
|
||||
@@ -48,15 +49,12 @@ load_filling_stations = function() {
|
||||
|
||||
clicked_on_filling_station_marker = function(station, marker) {
|
||||
return function(data) {
|
||||
console.log(station);
|
||||
console.log(marker);
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '/filling_stations/favourites/toggle/'+station.id,
|
||||
dataType: 'json',
|
||||
timeout: 1000,
|
||||
success: function(data) {
|
||||
console.log(data);
|
||||
if (data.state == 'favourite') {
|
||||
marker.setUrl('/static/img/filling_station_favourite_marker.png');
|
||||
} else {
|
||||
@@ -70,8 +68,6 @@ clicked_on_filling_station_marker = function(station, marker) {
|
||||
|
||||
display_station_information = function(station) {
|
||||
return function(event) {
|
||||
console.log(station);
|
||||
|
||||
var info = $('#station_info');
|
||||
info.empty();
|
||||
info.addClass('filling_station_info');
|
||||
@@ -80,6 +76,10 @@ display_station_information = function(station) {
|
||||
var cell2 = $('<div>', {'class':'col-md-4'})
|
||||
|
||||
var img = $('<img>', {'src': '/static/logos/'+station.brand.toLowerCase()+'.png'});
|
||||
// hide if the brand icon loads with error
|
||||
img.error(function(){
|
||||
$(this).hide();
|
||||
});
|
||||
|
||||
var name = $('<div>').text(station.name);
|
||||
|
||||
@@ -94,7 +94,6 @@ display_station_information = function(station) {
|
||||
.append(cell2
|
||||
.append(img));
|
||||
|
||||
console.log(cell1.height())
|
||||
cell2.height(cell1.height());
|
||||
};
|
||||
}
|
||||
@@ -103,7 +102,6 @@ update_filling_station_markers = function() {
|
||||
for(id in filling_stations) {
|
||||
var station = filling_stations[id];
|
||||
if(!station.marker) {
|
||||
console.log(station.id);
|
||||
var lonLat = new OpenLayers.LonLat(station.lng, station.lat)
|
||||
.transform(new OpenLayers.Projection('EPSG:4326'), map.getProjectionObject());
|
||||
if (station.state == 'favourite') {
|
||||
@@ -114,7 +112,6 @@ update_filling_station_markers = function() {
|
||||
var marker = new OpenLayers.Marker(lonLat, icon);
|
||||
marker.events.register('click', marker, clicked_on_filling_station_marker(station, marker));
|
||||
marker.events.register('mouseover', null, display_station_information(station));
|
||||
marker.events.register('mouseout', null, function(e){console.log('out');});
|
||||
filling_station_markers.addMarker(marker);
|
||||
station.marker = true;
|
||||
}
|
||||
@@ -150,18 +147,15 @@ activate_map = function(map_div_id, button_ids, home_lat, home_long, home_zoom,
|
||||
lat = home_lat;
|
||||
lon = home_long;
|
||||
zoom = home_zoom;
|
||||
console.log(lat, long);
|
||||
update_map();
|
||||
}
|
||||
|
||||
// get button
|
||||
$('#'+button_ids[0]).click(function(e){
|
||||
console.log('clicked get button');
|
||||
load_filling_stations();
|
||||
});
|
||||
// set home button
|
||||
$('#'+button_ids[1]).click(function(e){
|
||||
console.log('clicked set home');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/account/home',
|
||||
@@ -173,14 +167,12 @@ activate_map = function(map_div_id, button_ids, home_lat, home_long, home_zoom,
|
||||
});
|
||||
// go home button
|
||||
$('#'+button_ids[2]).click(function(e){
|
||||
console.log('clicked the go home button');
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '/account/home',
|
||||
dataType: 'json',
|
||||
timeout: 1000,
|
||||
success: function(data) {
|
||||
console.log(data);
|
||||
lat = data.lat;
|
||||
lon = data.long;
|
||||
zoom = data.zoom;
|
||||
|
||||
Reference in New Issue
Block a user