amelioration(instructeurs/dossiers/show): ETQ instructeur, je vois les champs saisi, les champs qui ont ete vidé apres le depot du dossier, je ne vois pas les champs facultatif jamais saisis
This commit is contained in:
parent
8abd632e1f
commit
dfb525892a
3 changed files with 30 additions and 3 deletions
|
@ -28,4 +28,31 @@ class Dossiers::ChampRowShowComponent < ApplicationComponent
|
|||
|
||||
key
|
||||
end
|
||||
|
||||
def each_champ(&block)
|
||||
@champs.filter { show_champ?(_1) }.each(&block)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# champ.blank? is overloaded, disable the cop
|
||||
# rubocop:disable Rails/Present
|
||||
def show_champ?(champ)
|
||||
if view_usager?
|
||||
true
|
||||
elsif champ.blank? && updated_after_deposer?(champ)
|
||||
true
|
||||
else
|
||||
!champ.blank?
|
||||
end
|
||||
end
|
||||
# rubocop:enable Rails/Present
|
||||
|
||||
def view_usager?
|
||||
@profile == 'usager'
|
||||
end
|
||||
|
||||
def view_instructeur?
|
||||
@profile == 'instructeur'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- @champs.each do |champ|
|
||||
- each_champ do |champ|
|
||||
.fr-px-4v.fr-my-2v
|
||||
- if champ.repetition?
|
||||
%p.champ-label= "#{champ.libelle} :"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue