demarches-normaliennes/app/components/editable_champ/communes_component.rb

18 lines
440 B
Ruby
Raw Normal View History

class EditableChamp::CommunesComponent < EditableChamp::EditableChampBaseComponent
include ApplicationHelper
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