Commit a3e90df2 authored by Alexandre Friquet's avatar Alexandre Friquet

Use leaflet/osm for event show page: refs #12.

parent b9c136ed
......@@ -32,10 +32,12 @@ class EventsController < ApplicationController
def show
@event = Event.find(params[:id])
@json = Gmaps4rails.build_markers(@event) do |event, marker|
marker.lat event.latitude
marker.lng event.longitude
end
marker = {
latlng: [@event.latitude, @event.longitude],
title: @event.title,
icon: :blue
}
@markers = [marker]
end
def new
......
......@@ -52,9 +52,9 @@
<%= @event.location %>
</p>
<% unless @json.empty? %>
<% unless @markers.empty? %>
<div class="map_container map_container-mini">
<div id="map"></div>
<%= tailored_map(@markers) %>
</div>
<% end %>
......@@ -78,15 +78,3 @@
<%= render 'attachments', data: @event.attached_files %>
</article>
<% unless @json.empty? %>
<script type="text/javascript">
handler = Gmaps.build('Google');
handler.buildMap({ provider: {}, internal: {id: 'map'} }, function(){
markers = handler.addMarkers(<%=raw @json.to_json %>);
handler.bounds.extendWith(markers);
handler.fitMapToBounds();
handler.getMap().setZoom(12);
});
</script>
<% end -%>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment