Preview should reflect revision changes
This commit is contained in:
parent
8b2c2c6466
commit
0ca5e1abe2
5 changed files with 12 additions and 14 deletions
|
@ -44,7 +44,7 @@ module NewAdministrateur
|
||||||
end
|
end
|
||||||
|
|
||||||
def apercu
|
def apercu
|
||||||
@dossier = procedure_without_control.new_dossier
|
@dossier = procedure_without_control.draft_revision.new_dossier
|
||||||
@tab = apercu_tab
|
@tab = apercu_tab
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ module Users
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate_empty_pdf(procedure)
|
def generate_empty_pdf(procedure)
|
||||||
@dossier = procedure.new_dossier
|
@dossier = procedure.active_revision.new_dossier
|
||||||
s = render_to_string(template: 'dossiers/dossier_vide', formats: [:pdf])
|
s = render_to_string(template: 'dossiers/dossier_vide', formats: [:pdf])
|
||||||
send_data(s, :filename => "#{procedure.libelle}.pdf")
|
send_data(s, :filename => "#{procedure.libelle}.pdf")
|
||||||
end
|
end
|
||||||
|
|
|
@ -406,17 +406,6 @@ class Procedure < ApplicationRecord
|
||||||
Flipper.enabled?(feature, self)
|
Flipper.enabled?(feature, self)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Warning: dossier after_save build_default_champs must be removed
|
|
||||||
# to save a dossier created from this method
|
|
||||||
def new_dossier
|
|
||||||
Dossier.new(
|
|
||||||
revision: active_revision,
|
|
||||||
champs: active_revision.build_champs,
|
|
||||||
champs_private: active_revision.build_champs_private,
|
|
||||||
groupe_instructeur: defaut_groupe_instructeur
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
def path_customized?
|
def path_customized?
|
||||||
!path.match?(/[[:xdigit:]]{8}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{12}/)
|
!path.match?(/[[:xdigit:]]{8}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{12}/)
|
||||||
end
|
end
|
||||||
|
|
|
@ -112,6 +112,15 @@ class ProcedureRevision < ApplicationRecord
|
||||||
changes
|
changes
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def new_dossier
|
||||||
|
Dossier.new(
|
||||||
|
revision: self,
|
||||||
|
champs: build_champs,
|
||||||
|
champs_private: build_champs_private,
|
||||||
|
groupe_instructeur: procedure.defaut_groupe_instructeur
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def compare_types_de_champ(from_tdc, to_tdc)
|
def compare_types_de_champ(from_tdc, to_tdc)
|
||||||
|
|
|
@ -927,7 +927,7 @@ describe Procedure do
|
||||||
])
|
])
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:dossier) { procedure.new_dossier }
|
let(:dossier) { procedure.active_revision.new_dossier }
|
||||||
|
|
||||||
it { expect(dossier.procedure).to eq(procedure) }
|
it { expect(dossier.procedure).to eq(procedure) }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue