add type de champs ej bin/rails generate add_champ EngagementJuridique
This commit is contained in:
parent
6ade116a0e
commit
13624f0f7e
13 changed files with 69 additions and 3 deletions
|
@ -0,0 +1,2 @@
|
|||
class EditableChamp::EngagementJuridiqueComponent < EditableChamp::EditableChampBaseComponent
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
en:
|
|
@ -0,0 +1 @@
|
|||
= @form.text_field(:value, input_opts(id: @champ.input_id, required: @champ.required?, aria: { describedby: @champ.describedby_id }))
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
fr:
|
|
@ -116,7 +116,8 @@ class API::V2::Schema < GraphQL::Schema
|
|||
Types::Champs::Descriptor::TextChampDescriptorType,
|
||||
Types::Champs::Descriptor::TitreIdentiteChampDescriptorType,
|
||||
Types::Champs::Descriptor::YesNoChampDescriptorType,
|
||||
Types::Champs::Descriptor::ExpressionReguliereChampDescriptorType
|
||||
Types::Champs::Descriptor::ExpressionReguliereChampDescriptorType,
|
||||
Types::Champs::Descriptor::EngagementJuridiqueChampDescriptorType
|
||||
|
||||
def self.unauthorized_object(error)
|
||||
# Add a top-level error to the response instead of returning nil:
|
||||
|
|
|
@ -2172,6 +2172,34 @@ type EmailChampDescriptor implements ChampDescriptor {
|
|||
type: TypeDeChamp! @deprecated(reason: "Utilisez le champ `__typename` à la place.")
|
||||
}
|
||||
|
||||
type EngagementJuridiqueChampDescriptor implements ChampDescriptor {
|
||||
"""
|
||||
Description des champs d’un bloc répétable.
|
||||
"""
|
||||
champDescriptors: [ChampDescriptor!] @deprecated(reason: "Utilisez le champ `RepetitionChampDescriptor.champ_descriptors` à la place.")
|
||||
|
||||
"""
|
||||
Description du champ.
|
||||
"""
|
||||
description: String
|
||||
id: ID!
|
||||
|
||||
"""
|
||||
Libellé du champ.
|
||||
"""
|
||||
label: String!
|
||||
|
||||
"""
|
||||
Est-ce que le champ est obligatoire ?
|
||||
"""
|
||||
required: Boolean!
|
||||
|
||||
"""
|
||||
Type de la valeur du champ.
|
||||
"""
|
||||
type: TypeDeChamp! @deprecated(reason: "Utilisez le champ `__typename` à la place.")
|
||||
}
|
||||
|
||||
type Entreprise {
|
||||
attestationFiscaleAttachment: File
|
||||
attestationSocialeAttachment: File
|
||||
|
@ -4019,6 +4047,11 @@ enum TypeDeChamp {
|
|||
"""
|
||||
email
|
||||
|
||||
"""
|
||||
Translation missing: fr.activerecord.attributes.type_de_champ.type_champs.engagement_juridique
|
||||
"""
|
||||
engagement_juridique
|
||||
|
||||
"""
|
||||
EPCI
|
||||
"""
|
||||
|
|
|
@ -22,6 +22,9 @@ module Types
|
|||
definition_methods do
|
||||
def resolve_type(object, context)
|
||||
case object.type_champ
|
||||
when TypeDeChamp.type_champs.fetch(:engagement_juridique)
|
||||
Types::Champs::Descriptor::EngagementJuridiqueChampDescriptorType
|
||||
|
||||
when TypeDeChamp.type_champs.fetch(:text)
|
||||
Types::Champs::Descriptor::TextChampDescriptorType
|
||||
when TypeDeChamp.type_champs.fetch(:textarea)
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
module Types::Champs::Descriptor
|
||||
class EngagementJuridiqueChampDescriptorType < Types::BaseObject
|
||||
implements Types::ChampDescriptorType
|
||||
end
|
||||
end
|
2
app/models/champs/engagement_juridique_champ.rb
Normal file
2
app/models/champs/engagement_juridique_champ.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
class Champs::EngagementJuridiqueChamp < Champ
|
||||
end
|
|
@ -3,9 +3,12 @@ class TypeDeChamp < ApplicationRecord
|
|||
|
||||
FILE_MAX_SIZE = 200.megabytes
|
||||
FEATURE_FLAGS = {
|
||||
engagement_juridique: :engagement_juridique_type_de_champ,
|
||||
|
||||
cojo: :cojo_type_de_champ,
|
||||
expression_reguliere: :expression_reguliere_type_de_champ
|
||||
}
|
||||
|
||||
MINIMUM_TEXTAREA_CHARACTER_LIMIT_LENGTH = 400
|
||||
|
||||
STRUCTURE = :structure
|
||||
|
@ -20,6 +23,8 @@ class TypeDeChamp < ApplicationRecord
|
|||
CATEGORIES = [STRUCTURE, ETAT_CIVIL, LOCALISATION, PAIEMENT_IDENTIFICATION, STANDARD, PIECES_JOINTES, CHOICE, REFERENTIEL_EXTERNE]
|
||||
|
||||
TYPE_DE_CHAMP_TO_CATEGORIE = {
|
||||
engagement_juridique: REFERENTIEL_EXTERNE,
|
||||
|
||||
header_section: STRUCTURE,
|
||||
repetition: STRUCTURE,
|
||||
dossier_link: STRUCTURE,
|
||||
|
@ -62,6 +67,8 @@ class TypeDeChamp < ApplicationRecord
|
|||
}
|
||||
|
||||
enum type_champs: {
|
||||
engagement_juridique: 'engagement_juridique',
|
||||
|
||||
header_section: 'header_section',
|
||||
repetition: 'repetition',
|
||||
dossier_link: 'dossier_link',
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
class TypesDeChamp::EngagementJuridiqueTypeDeChamp < TypesDeChamp::TypeDeChampBase
|
||||
end
|
|
@ -238,9 +238,12 @@ FactoryBot.define do
|
|||
value { 'W173847273' }
|
||||
end
|
||||
|
||||
factory :champ_engagement_juridique, class: 'Champs::EngagementJuridiqueChamp' do
|
||||
type_de_champ { association :type_de_champ_engagement_juridique, procedure: dossier.procedure }
|
||||
end
|
||||
factory :champ_cojo, class: 'Champs::COJOChamp' do
|
||||
type_de_champ { association :type_de_champ_cojo, procedure: dossier.procedure }
|
||||
end
|
||||
type_de_champ { association :type_de_champ_cojo, procedure: dossier.procedure }
|
||||
end
|
||||
|
||||
factory :champ_rnf, class: 'Champs::RNFChamp' do
|
||||
type_de_champ { association :type_de_champ_rnf, procedure: dossier.procedure }
|
||||
|
|
|
@ -184,6 +184,9 @@ FactoryBot.define do
|
|||
factory :type_de_champ_epci do
|
||||
type_champ { TypeDeChamp.type_champs.fetch(:epci) }
|
||||
end
|
||||
factory :type_de_champ_engagement_juridique do
|
||||
type_champ { TypeDeChamp.type_champs.fetch(:engagement_juridique) }
|
||||
end
|
||||
factory :type_de_champ_cojo do
|
||||
type_champ { TypeDeChamp.type_champs.fetch(:cojo) }
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue