Some advances to maps, and translations. Refs #71

This commit is contained in:
echarp 2016-04-17 14:07:39 +02:00
parent a77839e814
commit 50f429784c
6 changed files with 24 additions and 7 deletions

View File

@ -30,7 +30,7 @@ $(document).ready ->
map.addLayer layer map.addLayer layer
controls.addOverlay layer, text + ' - ' + count controls.addOverlay layer, text + ' - ' + count
if (url.contains('maps.json') && layer.getBounds()._northEast && layer.getBounds()._southWest) if (location.href.contains('maps/') || url.contains('maps.json')) && layer.getBounds()._northEast && layer.getBounds()._southWest
# Automatic focus to all displayed events # Automatic focus to all displayed events
map.fitBounds layer.getBounds() map.fitBounds layer.getBounds()

View File

@ -15,10 +15,12 @@ class MapsController < ApplicationController
end end
def show def show
kind = Kind.find_by_name params[:id] @kind = Kind.find_by_name params[:id]
orgas = apply_scopes(Orga.moderated.geo).joins(:kind).where(kind: kind)
respond_to do |format| respond_to do |format|
format.json { render json: orgas } format.html { render layout: 'iframe' if params[:iframe] }
format.json do
render json: apply_scopes(Orga.moderated.geo).where(kind: @kind)
end
end end
end end
end end

View File

@ -10,7 +10,7 @@
%li %li
= link_to maps_path format: :json do = link_to maps_path format: :json do
%em.fa.fa-calendar %em.fa.fa-calendar
= Event.model_name.human.pluralize = Event.model_name.human
- Kind.all.each do |kind| - Kind.all.each do |kind|
%li %li
= link_to map_path kind.name, format: :json do = link_to map_path kind.name, format: :json do

View File

@ -0,0 +1,15 @@
%h2
%em.fa.fa-map-marker
= t 'layouts.application.map'
%em.fa{ class: "fa-#{@kind.icon}" }
= Kind.human_attribute_name("name_#{@kind.name}")
- if params[:tag]
«
%em= params[:tag]
»
%ul#map.list
%li
= link_to map_path @kind.name, format: :json do
%em.fa{ class: "fa-#{@kind.icon}" }
= Kind.human_attribute_name("name_#{@kind.name}")

View File

@ -55,7 +55,7 @@ en:
kind: kind:
name_association: Association name_association: Association
name_enterprise: Enterprise name_enterprise: Enterprise
name_lug: LUG name_lug: GLUG
name_provider: ISP name_provider: ISP
name_institution: Institution name_institution: Institution
name_lab: Lab name_lab: Lab

View File

@ -55,7 +55,7 @@ fr:
kind: kind:
name_association: Association name_association: Association
name_enterprise: Entreprise name_enterprise: Entreprise
name_lug: GUL name_lug: GULL
name_provider: FAI name_provider: FAI
name_institution: Institution name_institution: Institution
name_lab: Lab name_lab: Lab