Let's get serious about linting, folks.
This commit is contained in:
parent
8f43da79b5
commit
27f6d8ad73
26 changed files with 341 additions and 235 deletions
46
app/views/conferences/_venue_map.haml
Normal file
46
app/views/conferences/_venue_map.haml
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#map{ style: "height: 500px;" }
|
||||
- content_for(:script_body) do
|
||||
- marker = escape_javascript(render '/conferences/venue_map_marker',
|
||||
venue: conference.venue)
|
||||
: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(
|
||||
[
|
||||
#{conference.venue.latitude.to_f + 0.05},
|
||||
#{h(conference.venue.longitude)}
|
||||
], 11);
|
||||
// add an OpenStreetMap tile layer
|
||||
L.tileLayer('//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: 'Map data © \
|
||||
<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("#{marker}")
|
||||
.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%'
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue