sign_in: remove hack for displaying the procedure context
Before there was no way to display the informations about a procedure without having a dossier. Thus an empty dossier was created. Now we can display the informations of a procedure using a @procedure instance variable, so we can move this hack away.
This commit is contained in:
parent
5d6005dbe9
commit
62ee710382
4 changed files with 41 additions and 8 deletions
|
@ -6,8 +6,8 @@ class Users::SessionsController < Sessions::SessionsController
|
||||||
|
|
||||||
# GET /resource/sign_in
|
# GET /resource/sign_in
|
||||||
def new
|
def new
|
||||||
if user_return_to_procedure_id.present? # WTF ?
|
if user_return_to_procedure_id.present?
|
||||||
@dossier = Dossier.new(procedure: Procedure.active(user_return_to_procedure_id))
|
@procedure = Procedure.active(user_return_to_procedure_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
@user = User.new
|
@user = User.new
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
|
- procedure = @procedure || @dossier&.procedure || nil
|
||||||
|
|
||||||
- content_for :content do
|
- content_for :content do
|
||||||
.two-columns.procedure-context
|
.two-columns.procedure-context
|
||||||
.columns-container
|
.columns-container
|
||||||
|
|
||||||
.column.procedure-preview
|
.column.procedure-preview
|
||||||
- if @dossier
|
- if procedure
|
||||||
= render partial: 'layouts/commencer/procedure_description', locals: { procedure: @dossier.procedure }
|
= render partial: 'layouts/commencer/procedure_description', locals: { procedure: procedure }
|
||||||
- else
|
- else
|
||||||
= render partial: 'layouts/commencer/no_procedure'
|
= render partial: 'layouts/commencer/no_procedure'
|
||||||
|
|
||||||
|
@ -12,8 +14,9 @@
|
||||||
= yield
|
= yield
|
||||||
|
|
||||||
- content_for :footer do
|
- content_for :footer do
|
||||||
/ TODO: display the procedure footer even if there is no dossier yet
|
- if procedure
|
||||||
- if @dossier
|
= render partial: 'new_user/procedure_footer', locals: { procedure: procedure, dossier: @dossier }
|
||||||
= render partial: 'new_user/procedure_footer', locals: { procedure: @dossier.procedure, dossier: @dossier }
|
- else
|
||||||
|
= render partial: 'new_user/dossiers/index_footer'
|
||||||
|
|
||||||
= render template: 'layouts/application'
|
= render template: 'layouts/application'
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
%li.footer-column
|
%li.footer-column
|
||||||
%h3.footer-header Poser une question sur votre dossier :
|
%h3.footer-header Poser une question sur votre dossier :
|
||||||
%p
|
%p
|
||||||
- if dossier.id && !dossier.brouillon?
|
- if dossier.present? && !dossier.brouillon?
|
||||||
Directement
|
Directement
|
||||||
= link_to "par la messagerie", messagerie_dossier_path(dossier)
|
= link_to "par la messagerie", messagerie_dossier_path(dossier)
|
||||||
- else
|
- else
|
||||||
|
|
|
@ -8,6 +8,24 @@ describe 'layouts/procedure_context.html.haml', type: :view do
|
||||||
render html: 'Column content', layout: 'layouts/procedure_context.html.haml'
|
render html: 'Column content', layout: 'layouts/procedure_context.html.haml'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when a procedure is assigned' do
|
||||||
|
before do
|
||||||
|
assign(:procedure, procedure)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'renders a description of the procedure' do
|
||||||
|
expect(subject).to have_text(procedure.libelle)
|
||||||
|
expect(subject).to have_text(procedure.description)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'renders the inner content' do
|
||||||
|
expect(subject).to have_text('Column content')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'renders the procedure footer' do
|
||||||
|
expect(subject).to have_text(procedure.service.nom)
|
||||||
|
expect(subject).to have_text(procedure.service.email)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when a dossier is assigned' do
|
context 'when a dossier is assigned' do
|
||||||
|
@ -30,5 +48,17 @@ describe 'layouts/procedure_context.html.haml', type: :view do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when neither procedure or dossier are assigned' do
|
||||||
|
it 'renders a placeholder for the procedure' do
|
||||||
|
expect(subject).to have_selector('.no-procedure')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'renders the inner content' do
|
||||||
|
expect(subject).to have_text('Column content')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'renders a generic footer' do
|
||||||
|
expect(subject).to have_text('Mentions légales')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue