osem-fcy/app/views/conferences/_venue_map.html.haml
James Mason 8ddcd695f0 Add vendor picture interface; include in splash
Vendor has a picture atrribute, and was displayed in one form of the
splashpage, but it wasn't exposed in the vendor editing form, nor was it
included in the "map view" on the splash page.

Additionally, the map popup was rendered inline.

This commit:
* Adds a from input for editing Venue#picture, consistent with other
  form elements
* Displays the picture on the splash page in either style (map or
  static)
* Moves the splash page map popup from inline HTML to it's own partial
2017-10-17 15:33:04 +03:00

33 lines
1.5 KiB
Text

#map{style: "height: 500px;" }
- content_for(:script_body) do
:javascript
// create a map in the "map" div, set the view to a given place and zoom
var map = L.map('map', { scrollWheelZoom: false }).setView([#{h(@conference.venue.latitude)}, #{h(@conference.venue.longitude)}], 11);
// add an OpenStreetMap tile layer
L.tileLayer('//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://mapbox.com">Mapbox</a>',
maxZoom: 18
}).addTo(map);
// add a marker in the given location, attach some popup content to it and open the popup
L.marker([#{h @conference.venue.latitude}, #{h @conference.venue.longitude}]).addTo(map)
.bindPopup("#{escape_javascript(render '/conferences/venue_map_marker', venue: @conference.venue)}")
.openPopup();
// Turn scrollwheel on when user clicks
map.on('focus', function(e) {
map.scrollWheelZoom.enable();
});
// Turn scrollwheel off once the map isn't in the viewport anymore
$('#map').waypoint({
handler: function(direction) {
map.scrollWheelZoom.disable();
//alert('map');
},
offset: '90%'
});
$('#map').waypoint({
handler: function(direction) {
map.scrollWheelZoom.disable();
//alert('map');
},
offset: '10%'
});