fix(patron): when rendering “patron” champs should have dossier
This commit is contained in:
parent
31d80d80bd
commit
782af3322a
3 changed files with 10 additions and 4 deletions
|
@ -75,6 +75,12 @@ class RootController < ApplicationController
|
|||
end
|
||||
|
||||
@dossier = Dossier.new(champs: all_champs)
|
||||
all_champs.each do |champ|
|
||||
champ.association(:dossier).target = @dossier
|
||||
champ.champs.each do |champ|
|
||||
champ.association(:dossier).target = @dossier
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def suivi
|
||||
|
|
|
@ -28,7 +28,7 @@ module ChampHelper
|
|||
|
||||
def autosave_available?(champ)
|
||||
# FIXME: enable autosave on champs private? once we figured out how to batch audit events
|
||||
champ.dossier&.brouillon? && !champ.repetition?
|
||||
champ.dossier.brouillon? && !champ.repetition?
|
||||
end
|
||||
|
||||
def editable_champ_controller(champ)
|
||||
|
@ -39,10 +39,10 @@ module ChampHelper
|
|||
# This is a public champ – it can have an autosave controller.
|
||||
if champ.public?
|
||||
# This is a champ on dossier in draft state. Activate autosave.
|
||||
if champ.dossier&.brouillon?
|
||||
if champ.dossier.brouillon?
|
||||
controllers << 'autosave'
|
||||
# This is a champ on a dossier in en_construction state. Enable conditions checker.
|
||||
elsif champ.public? && champ.dossier&.en_construction?
|
||||
elsif champ.public? && champ.dossier.en_construction?
|
||||
controllers << 'check-conditions'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -89,7 +89,7 @@ class Champ < ApplicationRecord
|
|||
end
|
||||
|
||||
def sections
|
||||
@sections ||= dossier&.sections_for(self)
|
||||
@sections ||= dossier.sections_for(self)
|
||||
end
|
||||
|
||||
def mandatory_blank_and_visible?
|
||||
|
|
Loading…
Reference in a new issue