harmonize get and post: go to prefilled file
This commit is contained in:
parent
e212055ef8
commit
b3af9108cb
4 changed files with 26 additions and 12 deletions
|
@ -16,15 +16,18 @@
|
|||
- drafts = dossiers.merge(Dossier.state_brouillon)
|
||||
- not_drafts = dossiers.merge(Dossier.state_not_brouillon)
|
||||
|
||||
- if dossiers.empty?
|
||||
= link_to t('views.commencer.show.start_procedure'), url_for_new_dossier(@revision), class: 'fr-btn fr-btn--lg fr-my-2w'
|
||||
|
||||
- elsif @prefilled_dossier
|
||||
- if @prefilled_dossier
|
||||
%h2.huge-title= t('views.commencer.show.prefilled_draft')
|
||||
%p
|
||||
= t('views.commencer.show.prefilled_draft_detail_html', time_ago: time_ago_in_words(@prefilled_dossier.created_at), procedure: @prefilled_dossier.procedure.libelle)
|
||||
= link_to t('views.commencer.show.continue_file'), brouillon_dossier_path(@prefilled_dossier), class: 'fr-btn fr-btn--lg fr-my-2w'
|
||||
= link_to t('views.commencer.show.start_new_file'), url_for_new_dossier(@revision), class: 'fr-btn fr-btn--lg fr-btn--secondary fr-my-2w'
|
||||
%p= t('views.commencer.show.prefilled_draft_detail_html', time_ago: time_ago_in_words(@prefilled_dossier.created_at), procedure: @prefilled_dossier.procedure.libelle)
|
||||
= link_to t('views.commencer.show.go_to_prefilled_file'), brouillon_dossier_path(@prefilled_dossier), class: 'fr-btn fr-btn--lg fr-my-2w'
|
||||
|
||||
- elsif stored_query_params?
|
||||
%h2.huge-title= t('views.commencer.show.prefilled_draft')
|
||||
%p= t('views.commencer.show.prefill_dossier_detail_html')
|
||||
= link_to t('views.commencer.show.go_to_prefilled_file'), url_for_new_dossier(@revision), class: 'fr-btn fr-btn--lg fr-my-2w'
|
||||
|
||||
- elsif dossiers.empty?
|
||||
= link_to t('views.commencer.show.start_procedure'), url_for_new_dossier(@revision), class: 'fr-btn fr-btn--lg fr-my-2w'
|
||||
|
||||
- elsif drafts.size == 1 && not_drafts.empty?
|
||||
- dossier = drafts.first
|
||||
|
|
|
@ -94,10 +94,12 @@ en:
|
|||
show_dossiers: View my current files
|
||||
prefilled_draft: "You have a prefilled file"
|
||||
prefilled_draft_detail_html: "You prefilled a file for the \"%{procedure}\" procedure <strong>%{time_ago} ago</strong>"
|
||||
prefill_dossier_detail_html: "You are ready to continue a prefilled file."
|
||||
already_draft: "You already started to fill a file"
|
||||
already_draft_detail_html: "You started to fill a file for the \"%{procedure}\" procedure <strong>%{time_ago} ago</strong>"
|
||||
already_not_draft: "You already submitted a file"
|
||||
already_not_draft_detail_html: "You submitted a file for the \"%{procedure}\" procedure <strong>%{time_ago} ago</strong>."
|
||||
go_to_prefilled_file: 'Continue to fill my prefilled file'
|
||||
continue_file: "Continue to fill my file"
|
||||
start_new_file: "Start a new file"
|
||||
show_my_submitted_file: 'Show my submitted file'
|
||||
|
|
|
@ -85,10 +85,12 @@ fr:
|
|||
show_dossiers: Voir mes dossiers en cours
|
||||
prefilled_draft: "Vous avez un dossier prérempli"
|
||||
prefilled_draft_detail_html: "Il y a <strong>%{time_ago}</strong>, vous avez prérempli un dossier sur la démarche « %{procedure} »."
|
||||
prefill_dossier_detail_html: "Vous êtes prêt·e à poursuivre un dossier prérempli."
|
||||
already_draft: "Vous avez déjà commencé à remplir un dossier"
|
||||
already_draft_detail_html: "Il y a <strong>%{time_ago}</strong>, vous avez commencé à remplir un dossier sur la démarche « %{procedure} »."
|
||||
already_not_draft: "Vous avez déjà déposé un dossier"
|
||||
already_not_draft_detail_html: "Il y a <strong>%{time_ago}</strong>, vous avez déposé un dossier sur la démarche « %{procedure} »."
|
||||
go_to_prefilled_file: 'Poursuivre mon dossier prérempli'
|
||||
continue_file: 'Continuer à remplir mon dossier'
|
||||
start_new_file: 'Commencer un nouveau dossier'
|
||||
show_my_submitted_file: 'Voir mon dossier déposé'
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
RSpec.describe 'commencer/show.html.haml', type: :view do
|
||||
include Rails.application.routes.url_helpers
|
||||
|
||||
let(:stored_query_params) { false }
|
||||
let(:procedure) { create(:procedure, :published, :for_individual, :with_service) }
|
||||
|
||||
before do
|
||||
|
@ -9,6 +10,8 @@ RSpec.describe 'commencer/show.html.haml', type: :view do
|
|||
if user
|
||||
sign_in user
|
||||
end
|
||||
|
||||
allow(view).to receive(:stored_query_params?).and_return(stored_query_params)
|
||||
end
|
||||
|
||||
subject { render }
|
||||
|
@ -80,13 +83,17 @@ RSpec.describe 'commencer/show.html.haml', type: :view do
|
|||
|
||||
before { assign(:prefilled_dossier, prefilled_dossier) }
|
||||
|
||||
it_behaves_like 'it renders a link to create a new dossier', 'Commencer un nouveau dossier'
|
||||
|
||||
it 'renders a link to resume the pending draft' do
|
||||
it 'renders a link to resume the prefilled dossier' do
|
||||
subject
|
||||
expect(rendered).to have_text(time_ago_in_words(prefilled_dossier.created_at))
|
||||
expect(rendered).to have_link('Continuer à remplir mon dossier', href: brouillon_dossier_path(prefilled_dossier))
|
||||
expect(rendered).to have_link('Poursuivre mon dossier prérempli', href: brouillon_dossier_path(prefilled_dossier))
|
||||
end
|
||||
end
|
||||
|
||||
context 'and they have stored query params in order to prefill a dossier' do
|
||||
let(:stored_query_params) { true }
|
||||
|
||||
it_behaves_like 'it renders a link to create a new dossier', 'Poursuivre mon dossier prérempli'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue