Navigation Menu

Skip to content
This repository has been archived by the owner on Aug 2, 2019. It is now read-only.

Show OpenStreetMap maps on event pages. #554

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/inc/css/event_detail.css
@@ -0,0 +1,12 @@
#map {
height: 200px;
width: 350px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On my browser, the "Powered by Leaflet — Map data © 2012 OpenStreetMap contributors" text wraps onto a second line. If you make the width 360px, this doesn't happen.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Mon, 19 Nov 2012, Rob Allen wrote:

@@ -0,0 +1,12 @@
+#map {

  • height: 200px;
  • width: 350px;

On my browser, the "Powered by Leaflet — Map data © 2012 OpenStreetMap
contributors" text wraps onto a second line. If you make the width
360px, this doesn't happen.

Shouldn't be necessairy now, as the "2012" is gone.

cheers,
Derick

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It no longer wraps for me.

}

div.desc-normal {
float: left;
}

div#desc-map {
float: right;
}
2 changes: 0 additions & 2 deletions src/inc/css/site.css
Expand Up @@ -699,8 +699,6 @@ a {

#ctn .main .detail .links,
#ctn .main .detail .hashtags {
float: left;
width: 40%;
padding-right: 10px;
font-size: 85%;
}
Expand Down
73 changes: 0 additions & 73 deletions src/inc/js/event_google_map.js

This file was deleted.

65 changes: 65 additions & 0 deletions src/inc/js/event_osm_map.js
@@ -0,0 +1,65 @@
var map;
var marker;

function load_map() {
var lat = $('#map_latitude').val();
var lon = $('#map_longitude').val();
var zoomLevel = parseInt($('#map_zoom').val());

map = new L.Map('map_canvas', {zoomControl: true});

var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
osmAttribution = 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors',
osm = new L.TileLayer(osmUrl, {maxZoom: 18, attribution: osmAttribution});

map.setView(new L.LatLng(lat, lon), zoomLevel).addLayer(osm);

placeMarker(new L.LatLng(lat, lon));
}

function placeMarker(location) {
if (!marker) {
marker = L.marker(location, { draggable: true } ).addTo(map);
marker.on('dragend', function() { location = marker.getLatLng(); placeMarker(location)} );
} else {
marker.setLatLng(location);
}

$('#event_lat').val(location.lat);
$('#event_long').val(location.lng);

$('#output_latitude').html(location.lat);
$('#output_longitude').html(location.lng);
}

function chooseAddr(lat, lng) {
var location = new L.LatLng(lat, lng);
map.panTo(location);
placeMarker(location);
}

function addr_search() {
var inp = document.getElementById("addr");

$.getJSON('http://nominatim.openstreetmap.org/search?format=json&limit=5&q=' + inp.value, function(data) {
var items = [];

$.each(data, function(key, val) {
items.push("<li><a href='#' onclick='chooseAddr(" + val.lat + ", " + val.lon + ");return false;'>" + val.display_name + '</a></li>');
});

if (items.length != 0) {
$('#results').empty();
$('<p>', { html: "Search results:" }).appendTo('#results');
$('<ul/>', {
'class': 'my-new-list',
html: items.join('')
}).appendTo('#results');
} else {
$('#results').empty();
$('<p>', { html: "No results found" }).appendTo('#results');
}
});
}

window.onload = load_map;
28 changes: 26 additions & 2 deletions src/inc/js/jq.joindIn.js
Expand Up @@ -12,7 +12,31 @@

$tp.siblings('.ui-tabs-selected').removeClass('ui-tabs-selected ui-state-active ui-state-focus');
$tp.addClass('ui-tabs-selected ui-state-active ui-state-focus');
});
});
},
'joindIn_map': function() {
var mapDiv = this;
if (mapDiv.length > 1) {
mapDiv = mapDiv.first();
}
var lat = mapDiv.attr('data-lat');
var lon = mapDiv.attr('data-lon');
var zoomLevel = mapDiv.attr('data-zoom');
if (zoomLevel > 18) {
zoomLevel = 18;
}
var map = new L.Map(this.attr('id'), {zoomControl: true});

var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
osmAttribution = 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors',
osm = new L.TileLayer(osmUrl, {maxZoom: 18, attribution: osmAttribution});

map.setView(new L.LatLng(lat, lon), zoomLevel).addLayer(osm);
var marker = L.marker([lat, lon]).addTo(map);

function moveMap(lat, lon) {
map.setView(new L.LatLng(lat, lon), map.getZoom());
}
}
});
})(jQuery, window, document)
})(jQuery, window, document)
Binary file added src/inc/leaflet/images/layers.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/inc/leaflet/images/marker-icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/inc/leaflet/images/marker-shadow.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/inc/leaflet/images/marker.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/inc/leaflet/images/popup-close.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/inc/leaflet/images/zoom-in.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/inc/leaflet/images/zoom-out.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.