[FIX #492] switch to new attestation download system
This commit is contained in:
parent
4e6a8c5939
commit
b1d96f4a94
4 changed files with 4 additions and 25 deletions
|
@ -7,10 +7,6 @@ class Users::RecapitulatifController < UsersController
|
||||||
create_dossier_facade
|
create_dossier_facade
|
||||||
end
|
end
|
||||||
|
|
||||||
def attestation
|
|
||||||
send_data(current_user_dossier.attestation.pdf.read, filename: 'attestation.pdf', type: 'application/pdf')
|
|
||||||
end
|
|
||||||
|
|
||||||
def initiate
|
def initiate
|
||||||
create_dossier_facade
|
create_dossier_facade
|
||||||
|
|
||||||
|
|
|
@ -11,4 +11,7 @@
|
||||||
= image_tag('pdf.svg', width: '20px')
|
= image_tag('pdf.svg', width: '20px')
|
||||||
%p.title= dossier.attestation.title
|
%p.title= dossier.attestation.title
|
||||||
%p.delivery Délivrée le #{l(dossier.attestation.created_at, format: '%d %B %Y')}
|
%p.delivery Délivrée le #{l(dossier.attestation.created_at, format: '%d %B %Y')}
|
||||||
%a.btn.btn-primary{ href: users_dossier_recapitulatif_attestation_path(dossier), target: '_blank' } Télécharger
|
- if user_signed_in?
|
||||||
|
= link_to 'Télécharger', dossier_attestation_path(dossier), target: '_blank', class: 'btn btn-primary'
|
||||||
|
- else
|
||||||
|
= link_to 'Télécharger', procedure_dossier_attestation_path(dossier.procedure, dossier), target: '_blank', class: 'btn btn-primary'
|
||||||
|
|
|
@ -82,8 +82,6 @@ Rails.application.routes.draw do
|
||||||
get '/recapitulatif' => 'recapitulatif#show'
|
get '/recapitulatif' => 'recapitulatif#show'
|
||||||
post '/recapitulatif/initiate' => 'recapitulatif#initiate'
|
post '/recapitulatif/initiate' => 'recapitulatif#initiate'
|
||||||
|
|
||||||
get '/recapitulatif/attestation' => 'recapitulatif#attestation'
|
|
||||||
|
|
||||||
post '/commentaire' => 'commentaires#create'
|
post '/commentaire' => 'commentaires#create'
|
||||||
resources :commentaires, only: [:index]
|
resources :commentaires, only: [:index]
|
||||||
|
|
||||||
|
|
|
@ -51,22 +51,4 @@ describe Users::RecapitulatifController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'Get #attestation' do
|
|
||||||
context 'when a dossier has an attestation' do
|
|
||||||
let(:fake_pdf) { double(read: 'pdf content') }
|
|
||||||
let!(:dossier) { create(:dossier, attestation: Attestation.new) }
|
|
||||||
|
|
||||||
it 'returns the attestation pdf' do
|
|
||||||
allow_any_instance_of(Attestation).to receive(:pdf).and_return(fake_pdf)
|
|
||||||
|
|
||||||
expect(controller).to receive(:send_data)
|
|
||||||
.with('pdf content', filename: 'attestation.pdf', type: 'application/pdf') do
|
|
||||||
controller.render nothing: true
|
|
||||||
end
|
|
||||||
|
|
||||||
get :attestation, params: { dossier_id: dossier.id }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue