fix(dossier): only show optional text on public champs

This commit is contained in:
Paul Chavard 2023-06-14 19:00:06 +01:00
parent f675d2d1a7
commit a432323843
3 changed files with 10 additions and 4 deletions

View file

@ -1,7 +1,8 @@
= @champ.libelle = @champ.libelle
- if @champ.mandatory? && @champ.type_champ != "checkbox" - if @champ.public? && !@champ.checkbox?
- if @champ.mandatory?
= render EditableChamp::AsteriskMandatoryComponent.new = render EditableChamp::AsteriskMandatoryComponent.new
- elsif !@champ.mandatory? - else
= "#{t('.optional_champ')}" = "#{t('.optional_champ')}"
- if @champ.forked_with_changes? - if @champ.forked_with_changes?

View file

@ -59,6 +59,7 @@ class Champ < ApplicationRecord
:region?, :region?,
:titre_identite?, :titre_identite?,
:header_section?, :header_section?,
:checkbox?,
:simple_drop_down_list?, :simple_drop_down_list?,
:linked_drop_down_list?, :linked_drop_down_list?,
:non_fillable?, :non_fillable?,

View file

@ -396,6 +396,10 @@ class TypeDeChamp < ApplicationRecord
type_champ == TypeDeChamp.type_champs.fetch(:datetime) type_champ == TypeDeChamp.type_champs.fetch(:datetime)
end end
def checkbox?
type_champ == TypeDeChamp.type_champs.fetch(:checkbox)
end
def public? def public?
!private? !private?
end end