Add new carto init code

This commit is contained in:
Paul Chavard 2018-10-10 19:58:51 +02:00
parent 5a2a18d8f1
commit c63675461a
4 changed files with 28 additions and 0 deletions

View file

@ -241,6 +241,23 @@ class Dossier < ApplicationRecord
end
end
def geo_position
if etablissement.present?
point = Carto::Geocodeur.convert_adresse_to_point(etablissement.geo_adresse)
end
lon = "2.428462"
lat = "46.538192"
zoom = "13"
if point.present?
lon = point.x.to_s
lat = point.y.to_s
end
{ lon: lon, lat: lat, zoom: zoom }
end
def unspecified_attestation_champs
attestation_template = procedure.attestation_template

View file

@ -0,0 +1,9 @@
:javascript
DATA.push({
carto: {
position: #{raw(dossier.geo_position.to_json)},
selection: #{raw(ensure_safe_json(dossier.json_latlngs))},
cadastres: #{raw(dossier.cadastres.to_json)},
quartiersPrioritaires: #{raw(dossier.quartier_prioritaires.to_json)}
}
});

View file

@ -16,3 +16,4 @@
%li
= "Parcelle n° #{p.numero} - Feuille #{p.code_arr} #{p.section} #{p.feuille}"
= render partial: 'shared/champs/carto/init', locals: { dossier: dossier }

View file

@ -11,3 +11,4 @@
.col-md-9.col-lg-9#cadastre.col-md-3.col-lg-3.list
%h3.text-warning Cadastres
%ul
= render partial: 'shared/champs/carto/init', locals: { dossier: dossier }