fix(champ): rewire champ.mandatory? to type_de_champ.mandatory?
it fixes behaviour in drop_down_list_component which add option if not mandatory (!= not required)
This commit is contained in:
parent
528b7ec3f8
commit
7114623285
1 changed files with 1 additions and 4 deletions
|
@ -60,6 +60,7 @@ class Champ < ApplicationRecord
|
||||||
:rna?,
|
:rna?,
|
||||||
:siret?,
|
:siret?,
|
||||||
:stable_id,
|
:stable_id,
|
||||||
|
:mandatory?,
|
||||||
to: :type_de_champ
|
to: :type_de_champ
|
||||||
|
|
||||||
scope :updated_since?, -> (date) { where('champs.updated_at > ?', date) }
|
scope :updated_since?, -> (date) { where('champs.updated_at > ?', date) }
|
||||||
|
@ -93,10 +94,6 @@ class Champ < ApplicationRecord
|
||||||
@sections ||= dossier.sections_for(self)
|
@sections ||= dossier.sections_for(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
def mandatory?
|
|
||||||
type_de_champ.mandatory? && visible?
|
|
||||||
end
|
|
||||||
|
|
||||||
# used for the `required` html attribute
|
# used for the `required` html attribute
|
||||||
# check visibility to avoid hidden required input
|
# check visibility to avoid hidden required input
|
||||||
# which prevent the form from being sent.
|
# which prevent the form from being sent.
|
||||||
|
|
Loading…
Add table
Reference in a new issue