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,8 +1,9 @@
= @champ.libelle
- if @champ.mandatory? && @champ.type_champ != "checkbox"
= render EditableChamp::AsteriskMandatoryComponent.new
- elsif !@champ.mandatory?
= "#{t('.optional_champ')}"
- if @champ.public? && !@champ.checkbox?
- if @champ.mandatory?
= render EditableChamp::AsteriskMandatoryComponent.new
- else
= "#{t('.optional_champ')}"
- if @champ.forked_with_changes?
%span.updated-at.highlighted

View file

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

View file

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