Add new carto init code
This commit is contained in:
parent
5a2a18d8f1
commit
c63675461a
4 changed files with 28 additions and 0 deletions
|
@ -241,6 +241,23 @@ class Dossier < ApplicationRecord
|
||||||
end
|
end
|
||||||
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
|
def unspecified_attestation_champs
|
||||||
attestation_template = procedure.attestation_template
|
attestation_template = procedure.attestation_template
|
||||||
|
|
||||||
|
|
9
app/views/shared/champs/carto/_init.html.haml
Normal file
9
app/views/shared/champs/carto/_init.html.haml
Normal 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)}
|
||||||
|
}
|
||||||
|
});
|
|
@ -16,3 +16,4 @@
|
||||||
%li
|
%li
|
||||||
= "Parcelle n° #{p.numero} - Feuille #{p.code_arr} #{p.section} #{p.feuille}"
|
= "Parcelle n° #{p.numero} - Feuille #{p.code_arr} #{p.section} #{p.feuille}"
|
||||||
|
|
||||||
|
= render partial: 'shared/champs/carto/init', locals: { dossier: dossier }
|
||||||
|
|
|
@ -11,3 +11,4 @@
|
||||||
.col-md-9.col-lg-9#cadastre.col-md-3.col-lg-3.list
|
.col-md-9.col-lg-9#cadastre.col-md-3.col-lg-3.list
|
||||||
%h3.text-warning Cadastres
|
%h3.text-warning Cadastres
|
||||||
%ul
|
%ul
|
||||||
|
= render partial: 'shared/champs/carto/init', locals: { dossier: dossier }
|
||||||
|
|
Loading…
Reference in a new issue