Merge pull request #9199 from tchak/fix-optional-champs

fix(dossier): only show optional text on public champs
This commit is contained in:
Paul Chavard 2023-06-14 18:26:03 +00:00 committed by GitHub
commit b551ef2dc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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