Merge pull request #7188 from betagouv/7131/rgpd/print-empty-form
feat(adminstrateurs#dossier_vide): add button to /dossier_vide so administrateur can have a pdf version of their form to send it in regards to RGPD
This commit is contained in:
commit
937b9c5b0e
3 changed files with 42 additions and 1 deletions
|
@ -4,6 +4,10 @@
|
|||
metadatas: ["Créée le #{@procedure.created_at.strftime('%d/%m/%Y')} - n° #{@procedure.id}", "#{@procedure.close? ? "Close le #{@procedure.closed_at.strftime('%d/%m/%Y')}" : @procedure.locked? ? "Publiée - #{procedure_lien(@procedure)}" : "Brouillon"}"] }
|
||||
|
||||
.container.procedure-admin-container
|
||||
= link_to @procedure.active_revision.draft? ? commencer_dossier_vide_test_path(path: @procedure.path) : commencer_dossier_vide_path(path: @procedure.path), target: "_blank", rel: "noopener", class: 'button', id: "pdf-procedure" do
|
||||
%span.icon.printer
|
||||
PDF
|
||||
|
||||
= link_to apercu_admin_procedure_path(@procedure), target: "_blank", rel: "noopener", class: 'button', id: "preview-procedure" do
|
||||
%span.icon.preview
|
||||
Prévisualiser
|
||||
|
|
|
@ -246,7 +246,7 @@ Rails.application.routes.draw do
|
|||
end
|
||||
|
||||
namespace :commencer do
|
||||
get '/test/:path/dossier_vide', action: 'dossier_vide_pdf_test', as: :dossier_vide_test
|
||||
get '/test/:path/dossier_vide', action: :dossier_vide_pdf_test, as: :dossier_vide_test
|
||||
get '/test/:path', action: 'commencer_test', as: :test
|
||||
get '/:path', action: 'commencer'
|
||||
get '/:path/dossier_vide', action: 'dossier_vide_pdf', as: :dossier_vide
|
||||
|
|
|
@ -160,4 +160,41 @@ describe Users::CommencerController, type: :controller do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#dossier_vide_pdf' do
|
||||
before { get :dossier_vide_pdf, params: { path: procedure.path } }
|
||||
|
||||
context 'published procedure' do
|
||||
let(:procedure) { create(:procedure, :published, :with_service, :with_path) }
|
||||
|
||||
it 'works' do
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
end
|
||||
context 'not published procedure' do
|
||||
let(:procedure) { create(:procedure, :with_service, :with_path) }
|
||||
|
||||
it 'redirects to procedure not found' do
|
||||
expect(response).to have_http_status(302)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#dossier_vide_test_pdf' do
|
||||
before { get :dossier_vide_pdf_test, params: { path: procedure.path } }
|
||||
|
||||
context 'not published procedure' do
|
||||
let(:procedure) { create(:procedure, :with_service, :with_path) }
|
||||
|
||||
it 'works' do
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
end
|
||||
context 'published procedure' do
|
||||
let(:procedure) { create(:procedure, :published, :with_service, :with_path) }
|
||||
it 'redirect to procedure not found' do
|
||||
expect(response).to have_http_status(302)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue