2023-03-21 14:44:03 +01:00
|
|
|
class EditableChamp::CommunesComponent < EditableChamp::EditableChampBaseComponent
|
|
|
|
include ApplicationHelper
|
|
|
|
|
2023-08-21 16:18:31 +02:00
|
|
|
def dsfr_champ_container
|
|
|
|
:fieldset
|
|
|
|
end
|
|
|
|
|
2023-03-21 14:44:03 +01:00
|
|
|
private
|
|
|
|
|
|
|
|
def commune_options
|
|
|
|
@champ.communes.map { ["#{_1[:name]} (#{_1[:postal_code]})", _1[:code]] }
|
|
|
|
end
|
|
|
|
|
|
|
|
def code_postal_input_id
|
|
|
|
"#{@champ.input_id}-code_postal"
|
|
|
|
end
|
|
|
|
|
|
|
|
def commune_select_options
|
|
|
|
{ selected: @champ.selected }.merge(@champ.mandatory? ? { prompt: '' } : { include_blank: '' })
|
|
|
|
end
|
2022-08-12 10:45:04 +02:00
|
|
|
end
|