From 23276cb9f95a56785cc33119f64dbd182f4b7389 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 21 Jan 2019 14:19:17 +0000 Subject: [PATCH] commencer: add temporal context about the dossier Ref #2225 --- app/views/commencer/show.html.haml | 12 ++++++++++-- spec/views/commencer/show.html.haml_spec.rb | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/views/commencer/show.html.haml b/app/views/commencer/show.html.haml index 5e71bbd19..df2325d3a 100644 --- a/app/views/commencer/show.html.haml +++ b/app/views/commencer/show.html.haml @@ -15,13 +15,21 @@ = link_to 'Commencer la démarche', url_for_new_dossier(@procedure), class: ['button large expand primary'] - elsif drafts.count == 1 && not_drafts.count == 0 + - dossier = drafts.first %h1 Vous avez déjà commencé à remplir un dossier - = link_to 'Continuer à remplir mon dossier', brouillon_dossier_path(drafts.first), class: ['button large expand primary'] + %p + Il y a #{time_ago_in_words(dossier.created_at)}, + vous avez commencé à remplir un dossier sur la démarche « #{dossier.procedure.libelle} ». + = link_to 'Continuer à remplir mon dossier', brouillon_dossier_path(dossier), class: ['button large expand primary'] = link_to 'Commencer un nouveau dossier', url_for_new_dossier(@procedure), class: ['button large expand'] - elsif not_drafts.count == 1 + - dossier = not_drafts.first %h1 Vous avez déjà déposé un dossier - = link_to 'Voir mon dossier', dossier_path(not_drafts.first), class: ['button large expand primary'] + %p + Il y a #{time_ago_in_words(dossier.en_construction_at)}, + vous avez déposé un dossier sur la démarche « #{dossier.procedure.libelle} ». + = link_to 'Voir mon dossier déposé', dossier_path(dossier), class: ['button large expand primary'] = link_to 'Commencer un nouveau dossier', url_for_new_dossier(@procedure), class: ['button large expand'] - else diff --git a/spec/views/commencer/show.html.haml_spec.rb b/spec/views/commencer/show.html.haml_spec.rb index 274b55f45..b07600502 100644 --- a/spec/views/commencer/show.html.haml_spec.rb +++ b/spec/views/commencer/show.html.haml_spec.rb @@ -45,6 +45,7 @@ RSpec.describe 'commencer/show.html.haml', type: :view do it 'renders a link to resume the pending draft' do subject + expect(rendered).to have_text(time_ago_in_words(brouillon.created_at)) expect(rendered).to have_link('Continuer à remplir mon dossier', href: brouillon_dossier_path(brouillon)) end end @@ -57,6 +58,7 @@ RSpec.describe 'commencer/show.html.haml', type: :view do it 'renders a link to the submitted dossier' do subject + expect(rendered).to have_text(time_ago_in_words(dossier.en_construction_at)) expect(rendered).to have_link('Voir mon dossier', href: dossier_path(dossier)) end end