2017-12-14 16:23:15 +01:00
|
|
|
module ChampHelper
|
2018-06-18 11:30:26 +02:00
|
|
|
def has_label?(champ)
|
2018-08-28 16:22:34 +02:00
|
|
|
types_without_label = [TypeDeChamp.type_champs.fetch(:header_section), TypeDeChamp.type_champs.fetch(:explication)]
|
2018-06-18 11:30:26 +02:00
|
|
|
!types_without_label.include?(champ.type_champ)
|
2017-12-14 16:23:15 +01:00
|
|
|
end
|
2018-10-17 12:07:25 +02:00
|
|
|
|
|
|
|
def geo_data(champ)
|
|
|
|
# rubocop:disable Rails/OutputSafety
|
|
|
|
raw({
|
|
|
|
position: champ.position,
|
|
|
|
selection: champ.value.present? ? JSON.parse(champ.value) : [],
|
2018-11-06 14:08:22 +01:00
|
|
|
quartiersPrioritaires: champ.quartiers_prioritaires? ? champ.quartiers_prioritaires.as_json(except: :properties) : [],
|
|
|
|
cadastres: champ.cadastres? ? champ.cadastres.as_json(except: :properties) : [],
|
|
|
|
parcellesAgricoles: champ.parcelles_agricoles? ? champ.parcelles_agricoles.as_json(except: :properties) : []
|
2018-10-17 12:07:25 +02:00
|
|
|
}.to_json)
|
|
|
|
# rubocop:enable Rails/OutputSafety
|
|
|
|
end
|
2017-12-14 16:23:15 +01:00
|
|
|
end
|