diff --git a/app/assets/javascripts/maps.js.coffee b/app/assets/javascripts/maps.js.coffee index 91c8f353..0fab8654 100644 --- a/app/assets/javascripts/maps.js.coffee +++ b/app/assets/javascripts/maps.js.coffee @@ -1,5 +1,5 @@ $(document).ready -> - $('.maps #map').each -> + $('#map.events').each -> map = L.map 'map' L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', @@ -14,13 +14,13 @@ $(document).ready -> layer.bindPopup feature.properties.popupContent ) + map.addLayer L.markerClusterGroup().addLayer layer + # Automatic focus to all displayed events map.fitBounds layer.getBounds() - map.addLayer L.markerClusterGroup().addLayer layer - - $('.events #map, .moderations #map').each -> - coord = [$(this).attr('latitude'), $(this).attr('longitude')] + $('#map.event').each -> + coord = [$(this).data('latitude'), $(this).data('longitude')] map = L.map('map').setView [coord[0], coord[1]], 16 diff --git a/app/assets/stylesheets/maps.css.sass b/app/assets/stylesheets/maps.css.sass index 168cd541..d4d591e9 100644 --- a/app/assets/stylesheets/maps.css.sass +++ b/app/assets/stylesheets/maps.css.sass @@ -4,14 +4,18 @@ @import leaflet.markercluster.default #map + height: 60em +box-shadow(0 0 1em SteelBlue) +transition(none) * /* Popup are better displayed with this: */ max-width: initial -.maps #map - height: 60em + &.event + height: 20em -.events #map, .moderations #map - height: 20em +.tags #map + float: left + width: 30% + height: 30em + margin: 1% 5% diff --git a/app/assets/stylesheets/tags.css.sass b/app/assets/stylesheets/tags.css.sass index 7bbc761b..90515d6a 100644 --- a/app/assets/stylesheets/tags.css.sass +++ b/app/assets/stylesheets/tags.css.sass @@ -7,9 +7,6 @@ p.tags a:last-child:after .tag vertical-align: middle - sub - font-size: 8px - &.size_1 font-size: 60% letter-spacing: -1px diff --git a/app/views/events/show.html.haml b/app/views/events/show.html.haml index e33610d9..3b51c2b0 100644 --- a/app/views/events/show.html.haml +++ b/app/views/events/show.html.haml @@ -50,7 +50,10 @@ "http://fr.wikipedia.org/wiki/#{url_encode @event.related_region.try(:name)}" - if @event.latitude && @event.longitude - #map(data-url="#{maps_path format: :json}" latitude="#{@event.latitude}" longitude="#{@event.longitude}") + #map.event{ data: { | + url: "#{maps_path format: :json}", | + latitude: "#{@event.latitude}", | + longitude: "#{@event.longitude}" } } | - elsif controller.action_name != 'show' %em.fa.fa-compress diff --git a/app/views/maps/index.html.haml b/app/views/maps/index.html.haml index f46fa723..7f359ff1 100644 --- a/app/views/maps/index.html.haml +++ b/app/views/maps/index.html.haml @@ -2,4 +2,4 @@ %em.fa.fa-map-marker =title t '.title' -#map(data-url="#{maps_path format: :json}") +#map.events(data-url="#{maps_path format: :json}") diff --git a/app/views/tags/index.html.haml b/app/views/tags/index.html.haml index 07566730..1bbda8ad 100644 --- a/app/views/tags/index.html.haml +++ b/app/views/tags/index.html.haml @@ -5,9 +5,5 @@ - @tags.each do |tag| %span.tag(class="size_#{Math.log2(tag[1]).to_i}") = link_to tag[0], tag_url(tag[0]) - %sub<> - = link_to :rss, events_url(format: :rss, tag: tag[0]) - \/ - = link_to :ical, events_url(format: :ics, tag: tag[0]) %p=t '.limited' diff --git a/app/views/tags/show.html.haml b/app/views/tags/show.html.haml index 0e26156e..4784444e 100644 --- a/app/views/tags/show.html.haml +++ b/app/views/tags/show.html.haml @@ -1,6 +1,14 @@ %h2 =t '.title' + « %em= params[:id] + » + += link_to :rss, events_url(format: :rss, tag: params[:id]) +\/ += link_to :ical, events_url(format: :ics, tag: params[:id]) + +#map.events(data-url="#{maps_path format: :json, tag: params[:id]}") - if @events_future.any? %p=raw t '.future', count: @events_future.count