Expose repetitions and options on champ_descriptors
This commit is contained in:
parent
eb6c4b3dd1
commit
86f562e7ea
3 changed files with 34 additions and 2 deletions
|
@ -54,6 +54,11 @@ interface Champ {
|
|||
}
|
||||
|
||||
type ChampDescriptor {
|
||||
"""
|
||||
Description des champs d'un bloc répétable.
|
||||
"""
|
||||
champDescriptors: [ChampDescriptor!]
|
||||
|
||||
"""
|
||||
Description du champ.
|
||||
"""
|
||||
|
@ -65,6 +70,11 @@ type ChampDescriptor {
|
|||
"""
|
||||
label: String!
|
||||
|
||||
"""
|
||||
List des options d'un champ avec selection.
|
||||
"""
|
||||
options: [String!]
|
||||
|
||||
"""
|
||||
Est-ce que le champ est obligatoire ?
|
||||
"""
|
||||
|
@ -1317,4 +1327,4 @@ type ValidationError {
|
|||
A description of the error
|
||||
"""
|
||||
message: String!
|
||||
}
|
||||
}
|
|
@ -13,5 +13,20 @@ module Types
|
|||
field :label, String, "Libellé du champ.", null: false, method: :libelle
|
||||
field :description, String, "Description du champ.", null: true
|
||||
field :required, Boolean, "Est-ce que le champ est obligatoire ?", null: false, method: :mandatory?
|
||||
|
||||
field :champ_descriptors, [Types::ChampDescriptorType], "Description des champs d'un bloc répétable.", null: true
|
||||
field :options, [String], "List des options d'un champ avec selection.", null: true
|
||||
|
||||
def champ_descriptors
|
||||
if object.repetition?
|
||||
Loaders::Association.for(object.class, :types_de_champ).load(object)
|
||||
end
|
||||
end
|
||||
|
||||
def options
|
||||
if object.drop_down_list?
|
||||
object.drop_down_list_options.reject(&:empty?)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue