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

18 lines
413 B
Ruby
Raw Normal View History

class EditableChamp::DepartementsComponent < EditableChamp::EditableChampBaseComponent
2022-08-12 10:45:04 +02:00
include ApplicationHelper
private
def dsfr_input_classname
'fr-select'
end
def options
APIGeoService.departements.map { ["#{_1[:code]} #{_1[:name]}", _1[:code]] }
end
def select_options
{ selected: @champ.selected }.merge(@champ.mandatory? ? { prompt: '' } : { include_blank: '' })
end
2022-08-12 10:45:04 +02:00
end