Add geo data helper
This commit is contained in:
parent
a541f1fcee
commit
383a14ff06
1 changed files with 11 additions and 0 deletions
|
@ -3,4 +3,15 @@ module ChampHelper
|
|||
types_without_label = [TypeDeChamp.type_champs.fetch(:header_section), TypeDeChamp.type_champs.fetch(:explication)]
|
||||
!types_without_label.include?(champ.type_champ)
|
||||
end
|
||||
|
||||
def geo_data(champ)
|
||||
# rubocop:disable Rails/OutputSafety
|
||||
raw({
|
||||
position: champ.position,
|
||||
selection: champ.value.present? ? JSON.parse(champ.value) : [],
|
||||
quartiersPrioritaires: champ.quartiers_prioritaires? ? champ.quartiers_prioritaires : [],
|
||||
cadastres: champ.cadastres? ? champ.cadastres : []
|
||||
}.to_json)
|
||||
# rubocop:enable Rails/OutputSafety
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue