Add champ communes

This commit is contained in:
Paul Chavard 2019-12-18 17:08:42 +01:00
parent 22aa2d4ee0
commit 4bbd16576b
9 changed files with 26 additions and 0 deletions

View file

@ -1012,6 +1012,11 @@ enum TypeDeChamp {
"""
civilite
"""
Communes
"""
communes
"""
Date
"""

View file

@ -0,0 +1,2 @@
class Champs::CommuneChamp < Champs::TextChamp
end

View file

@ -19,6 +19,7 @@ class TypeDeChamp < ApplicationRecord
pays: 'pays',
regions: 'regions',
departements: 'departements',
communes: 'communes',
engagement: 'engagement',
header_section: 'header_section',
explication: 'explication',

View file

@ -0,0 +1,2 @@
class TypesDeChamp::CommuneTypeDeChamp < TypesDeChamp::TypeDeChampBase
end

View file

@ -0,0 +1,4 @@
= form.select :value, [champ.value].compact,
{ include_blank: true },
required: champ.mandatory?,
class: 'select2 communes'

View file

@ -24,6 +24,7 @@ fr:
pays: 'Pays'
regions: 'Régions'
departements: 'Départements'
communes: 'Communes'
engagement: 'Engagement'
header_section: 'Titre de section'
explication: 'Explication'

View file

@ -124,6 +124,11 @@ FactoryBot.define do
value { '971 - Guadeloupe' }
end
factory :champ_communes, class: 'Champs::CommuneChamp' do
type_de_champ { create(:type_de_champ_communes) }
value { 'Paris' }
end
factory :champ_engagement, class: 'Champs::EngagementChamp' do
type_de_champ { create(:type_de_champ_engagement) }
value { 'true' }

View file

@ -71,6 +71,9 @@ FactoryBot.define do
factory :type_de_champ_departements do
type_champ { TypeDeChamp.type_champs.fetch(:departements) }
end
factory :type_de_champ_communes do
type_champ { TypeDeChamp.type_champs.fetch(:communes) }
end
factory :type_de_champ_engagement do
type_champ { TypeDeChamp.type_champs.fetch(:engagement) }
end

View file

@ -69,6 +69,7 @@ describe ProcedureExportService do
"pays",
"regions",
"departements",
"communes",
"engagement",
"dossier_link",
"piece_justificative",
@ -142,6 +143,7 @@ describe ProcedureExportService do
"pays",
"regions",
"departements",
"communes",
"engagement",
"dossier_link",
"piece_justificative",
@ -220,6 +222,7 @@ describe ProcedureExportService do
"pays",
"regions",
"departements",
"communes",
"engagement",
"dossier_link",
"piece_justificative",