demarches-normaliennes/app/components/editable_champ/departements_component.rb
2024-08-22 09:26:48 +02:00

19 lines
444 B
Ruby
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# frozen_string_literal: true
class EditableChamp::DepartementsComponent < EditableChamp::EditableChampBaseComponent
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
end