feat(commune): chose commune by postal code
This commit is contained in:
parent
a4e96d5256
commit
dc605015b3
7 changed files with 121 additions and 25 deletions
|
@ -1,2 +1,17 @@
|
|||
class EditableChamp::CommunesComponent < EditableChamp::ComboSearchComponent
|
||||
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
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue