demarches-normaliennes/app/helpers/champ_helper.rb
2019-02-19 16:37:42 +01:00

20 lines
533 B
Ruby

module ChampHelper
def has_label?(champ)
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(champ.to_render_data.to_json)
# rubocop:enable Rails/OutputSafety
end
def champ_carte_params(champ)
if champ.persisted?
{ champ_id: champ.id }
else
{ type_de_champ_id: champ.type_de_champ_id }
end
end
end