feat(instructeur/dossier/header/_expiration_banner): split trads and add dedicated expiration banner for instructeur. also enhance wording to include duree conservation + extension_conservation
feat(expiration_banner): enhance wording of expiration feat(dossiers/expiration_banner): enhance wording regarding expiration to include duree_conservation_dossiers_dans_ds + extension_conservation, also add spec on expiration_banner for instructeur
This commit is contained in:
parent
22531560d8
commit
d8a8d1fdab
17 changed files with 182 additions and 47 deletions
|
@ -646,6 +646,10 @@ class Dossier < ApplicationRecord
|
|||
parts.join
|
||||
end
|
||||
|
||||
def duree_totale_conservation_in_months
|
||||
procedure.duree_conservation_dossiers_dans_ds + (conservation_extension / 1.month.to_i)
|
||||
end
|
||||
|
||||
def avis_for_instructeur(instructeur)
|
||||
if instructeur.dossiers.include?(self)
|
||||
avis.order(created_at: :asc)
|
||||
|
|
26
app/views/instructeurs/dossiers/_expiration_banner.html.haml
Normal file
26
app/views/instructeurs/dossiers/_expiration_banner.html.haml
Normal file
|
@ -0,0 +1,26 @@
|
|||
-# small expires mention
|
||||
- if dossier.expirable?
|
||||
%p.expires_at.mb-2
|
||||
|
||||
%small= t("shared.dossiers.header.expires_at.#{dossier.state}", date: safe_expiration_date(dossier), duree_conservation_totale: dossier.duree_totale_conservation_in_months)
|
||||
-# big banner warning
|
||||
- if dossier.close_to_expiration?
|
||||
.card.warning.mb-3
|
||||
.card-title= t('instructeurs.dossiers.header.banner.title')
|
||||
%p
|
||||
- if dossier.brouillon?
|
||||
= t('instructeurs.dossiers.header.banner.states.brouillon')
|
||||
- elsif dossier.en_construction?
|
||||
= t('instructeurs.dossiers.header.banner.states.en_construction')
|
||||
- elsif dossier.termine?
|
||||
= t('instructeurs.dossiers.header.banner.states.termine')
|
||||
|
||||
- if dossier.expiration_can_be_extended?
|
||||
%br
|
||||
= button_to t('instructeurs.dossiers.header.banner.button_delay_expiration'), users_dossier_repousser_expiration_path(dossier), class: 'button secondary mt-2'
|
||||
|
||||
|
||||
- else
|
||||
%p.expires_at_en_instruction
|
||||
%small= t("shared.dossiers.header.expires_at.en_instruction")
|
||||
|
|
@ -9,9 +9,12 @@
|
|||
= dossier.procedure.libelle.truncate_words(10)
|
||||
%li
|
||||
= "Dossier nº #{dossier.id}"
|
||||
|
||||
.header-actions
|
||||
= render partial: 'instructeurs/dossiers/header_actions', locals: { dossier: dossier }
|
||||
|
||||
= render(partial: 'instructeurs/dossiers/expiration_banner', locals: {dossier: dossier})
|
||||
|
||||
%ul.tabs
|
||||
- notifications_summary = current_instructeur.notifications_for_dossier(dossier)
|
||||
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
-# small expires mention
|
||||
- if dossier.expirable?
|
||||
%p.expires_at
|
||||
%small= t("shared.dossiers.header.expires_at.#{dossier.state}", date: safe_expiration_date(dossier))
|
||||
%p.expires_at.mb-2
|
||||
%small= t("shared.dossiers.header.expires_at.#{dossier.state}", date: safe_expiration_date(dossier), duree_conservation_totale: dossier.duree_totale_conservation_in_months)
|
||||
-# big banner warning
|
||||
- if dossier.close_to_expiration?
|
||||
.card.warning.mt-2.mb-3
|
||||
.card-title= t('shared.dossiers.header.banner.title')
|
||||
.card.warning.mb-3
|
||||
.card-title= t('users.dossiers.header.banner.title')
|
||||
%p
|
||||
- if dossier.brouillon?
|
||||
= t('shared.dossiers.header.banner.states.brouillon')
|
||||
= t('users.dossiers.header.banner.states.brouillon')
|
||||
- elsif dossier.en_construction?
|
||||
= t('shared.dossiers.header.banner.states.en_construction')
|
||||
= t('users.dossiers.header.banner.states.en_construction')
|
||||
- elsif dossier.termine?
|
||||
= t('shared.dossiers.header.banner.states.termine')
|
||||
= t('users.dossiers.header.banner.states.termine')
|
||||
|
||||
- if dossier.expiration_can_be_extended?
|
||||
%br
|
||||
= button_to t('shared.dossiers.header.banner.button_delay_expiration'), users_dossier_repousser_expiration_path(dossier), class: 'button secondary mt-2'
|
||||
= button_to t('users.dossiers.header.banner.button_delay_expiration'), users_dossier_repousser_expiration_path(dossier), class: 'button secondary mt-2'
|
||||
|
||||
|
||||
- else
|
||||
|
|
|
@ -134,11 +134,13 @@ en:
|
|||
edit_identity: "Edit identity data"
|
||||
instructeurs:
|
||||
dossiers:
|
||||
archived_dossier: "This file will be kept for an additional month"
|
||||
deleted_by_user: "File deleted by user"
|
||||
avis:
|
||||
introduction_file_explaination: "File attached to the request for advice"
|
||||
users:
|
||||
dossiers:
|
||||
archived_dossier: "Your file will be kept %{duree_conservation_dossiers_dans_ds} more months"
|
||||
autosave:
|
||||
autosave_draft: Your draft is automatically saved.
|
||||
more_infos: More informations
|
||||
|
@ -382,8 +384,6 @@ en:
|
|||
ask_deletion:
|
||||
undergoingreview: "Your file is undergoing review. It is no longer possible to delete your file. To cancel the undergoingreview contact the adminitration via the mailbox."
|
||||
deleted_dossier: "Your file has been successfully deleted"
|
||||
extend_conservation:
|
||||
archived_dossier: "Your file will be archived for an additional month"
|
||||
update_brouillon:
|
||||
draft_saved: "Your draft has been saved."
|
||||
etablissement:
|
||||
|
|
|
@ -130,6 +130,7 @@ fr:
|
|||
edit_identity: "Modifier l’identité"
|
||||
instructeurs:
|
||||
dossiers:
|
||||
archived_dossier: "Le dossier sera conservé 1 mois supplémentaire"
|
||||
deleted_by_user: "Dossier supprimé par l'usager"
|
||||
avis:
|
||||
introduction_file_explaination: "Fichier joint à la demande d’avis"
|
||||
|
@ -389,13 +390,12 @@ fr:
|
|||
test_procedure: "Ce dossier est déposé sur une démarche en test. Toute modification de la démarche par l’administrateur (ajout d'un champ, publication de la démarche...) entraînera sa suppression."
|
||||
no_access: "Vous n’avez pas accès à ce dossier"
|
||||
no_longer_editable: "Votre dossier ne peut plus être modifié"
|
||||
archived_dossier: "Votre dossier sera conservé %{duree_conservation_dossiers_dans_ds} mois supplémentaire"
|
||||
create_commentaire:
|
||||
message_send: "Votre message a bien été envoyé à l’instructeur en charge de votre dossier."
|
||||
ask_deletion:
|
||||
undergoingreview: "L’instruction de votre dossier a commencé, il n’est plus possible de supprimer votre dossier. Si vous souhaitez annuler l’instruction contactez votre administration par la messagerie de votre dossier."
|
||||
deleted_dossier: "Votre dossier a bien été supprimé."
|
||||
extend_conservation:
|
||||
archived_dossier: "Votre dossier sera conservé un mois supplémentaire"
|
||||
update_brouillon:
|
||||
draft_saved: "Votre brouillon a bien été sauvegardé."
|
||||
etablissement:
|
||||
|
|
|
@ -9,19 +9,12 @@ en:
|
|||
code_postal_notice: It is usually composed of 5 digits.
|
||||
header:
|
||||
expires_at:
|
||||
brouillon: "Expires at %{date}"
|
||||
en_construction: "Expires at %{date}"
|
||||
brouillon: "Expires at %{date} (%{duree_conservation_totale} months after the creation of this file)"
|
||||
en_construction: "Expires at %{date} (%{duree_conservation_totale} months after the last la edition of this file)"
|
||||
en_instruction: "This file is being instructed, the administration will answer as soon as possible"
|
||||
accepte: "Expires at %{date}"
|
||||
refuse: "Expires at %{date}"
|
||||
sans_suite: "Expires at %{date}"
|
||||
banner:
|
||||
title: Your file will expire
|
||||
states:
|
||||
brouillon: Your file is still in draft and will soon expire. So it will be deleted soon without being instructed. If you want to pursue your procedure you can submit it now. Otherwise you are able to delay its expiration by clicking on the underneath button.
|
||||
en_construction: Your file is pending for instruction. The maximum delay is 6 months, but your can extend the duration by a month by clicking on the underneath button.
|
||||
termine: Your file had been processed and will soon expire.So it will be deleted soon. If you want to keep it, your can dowload a PDF file of it.
|
||||
button_delay_expiration: "Delay deletion"
|
||||
accepte: "Expires at %{date} (%{duree_conservation_totale} months after the acceptation of this file)"
|
||||
refuse: "Expires at %{date} (%{duree_conservation_totale} months after the rejection of this file)"
|
||||
sans_suite: "Expires at %{date} (%{duree_conservation_totale} months after this file had been closed)"
|
||||
champs:
|
||||
cnaf:
|
||||
show:
|
||||
|
|
|
@ -9,19 +9,13 @@ fr:
|
|||
code_postal_notice: Il est généralement composé de 5 chiffres.
|
||||
header:
|
||||
expires_at:
|
||||
brouillon: "Expirera le %{date}"
|
||||
en_construction: "Expirera le %{date}"
|
||||
brouillon: "Expirera le %{date} (%{duree_conservation_totale} mois après la création du dossier)"
|
||||
en_construction: "Expirera le %{date} (%{duree_conservation_totale} mois après la dernière date d'édition)"
|
||||
en_instruction: "Ce dossier est en instruction, il n'expirera pas"
|
||||
accepte: "Expirera le %{date}"
|
||||
refuse: "Expirera le %{date}"
|
||||
sans_suite: "Expirera le %{date}"
|
||||
banner:
|
||||
title: Votre dossier va expirer
|
||||
states:
|
||||
brouillon: Votre dossier est en brouillon, mais va bientôt expirer. Cela signifie qu’il va bientôt être supprimé sans avoir été déposé. Si vous souhaitez le conserver afin de poursuivre la démarche, vous pouvez le conserver un mois de plus en cliquant sur le bouton ci-dessous.
|
||||
en_construction: Votre dossier est en attente de prise en charge par l'administration. Le delais de prise en charge maximale est de 6 mois. Vous pouvez toutefois entendre cette durée d'un mois en cliquant sur le bouton suivant.
|
||||
termine: Le traitement de votre dossier est terminé, mais il va bientôt expirer. Cela signifie qu’il va bientôt être supprimé. Si vous souhaitez conserver une trace, vous pouvez le télécharger au format PDF.
|
||||
button_delay_expiration: "Repousser sa suppression"
|
||||
accepte: "Expirera le %{date} (%{duree_conservation_totale} mois après l'acceptation du dossier)"
|
||||
refuse: "Expirera le %{date} (%{duree_conservation_totale} mois après le refus du dossier)"
|
||||
sans_suite: "Expirera le %{date} (%{duree_conservation_totale} mois après que le dossier aie été classé sans suite)"
|
||||
|
||||
|
||||
champs:
|
||||
cnaf:
|
||||
|
|
11
config/locales/views/instructeurs/header/en.yml
Normal file
11
config/locales/views/instructeurs/header/en.yml
Normal file
|
@ -0,0 +1,11 @@
|
|||
en:
|
||||
instructeurs:
|
||||
dossiers:
|
||||
header:
|
||||
banner:
|
||||
title: This file will expire
|
||||
states:
|
||||
brouillon: "" # not applicable, instructeur does not see brouillons
|
||||
en_construction: This file is pending for instruction. The maximum delay is 6 months, you can extend the duration by a month by clicking on the underneath button.
|
||||
termine: This file had been processed and will soon expire. So it will be deleted soon. If you want to keep it, you can dowload a PDF file of it.
|
||||
button_delay_expiration: "Delay deletion"
|
11
config/locales/views/instructeurs/header/fr.yml
Normal file
11
config/locales/views/instructeurs/header/fr.yml
Normal file
|
@ -0,0 +1,11 @@
|
|||
fr:
|
||||
instructeurs:
|
||||
dossiers:
|
||||
header:
|
||||
banner:
|
||||
title: Ce dossier va expirer
|
||||
states:
|
||||
brouillon: "" # not applicable, instructeur does not see brouillons
|
||||
en_construction: Ce dossier est en attente de prise en charge. Vous pouvez toutefois entendre cette durée d'un mois en cliquant sur le bouton suivant.
|
||||
termine: Le traitement de ce dossier est terminé, mais il va bientôt expirer. Cela signifie qu’il va bientôt être supprimé. Si vous souhaitez conserver une trace, vous pouvez le télécharger au format PDF.
|
||||
button_delay_expiration: "Repousser sa suppression"
|
11
config/locales/views/users/header/en.yml
Normal file
11
config/locales/views/users/header/en.yml
Normal file
|
@ -0,0 +1,11 @@
|
|||
en:
|
||||
users:
|
||||
dossiers:
|
||||
header:
|
||||
banner:
|
||||
title: Your file will expire
|
||||
states:
|
||||
brouillon: Your file is still in draft and will soon expire. So it will be deleted soon without being instructed. If you want to pursue your procedure you can submit it now. Otherwise you are able to delay its expiration by clicking on the underneath button.
|
||||
en_construction: Your file is pending for instruction. The maximum delay is 6 months, but you can extend the duration by a month by clicking on the underneath button.
|
||||
termine: Your file had been processed and will soon expire. So it will be deleted soon. If you want to keep it, you can dowload a PDF file of it.
|
||||
button_delay_expiration: "Delay deletion"
|
11
config/locales/views/users/header/fr.yml
Normal file
11
config/locales/views/users/header/fr.yml
Normal file
|
@ -0,0 +1,11 @@
|
|||
fr:
|
||||
users:
|
||||
dossiers:
|
||||
header:
|
||||
banner:
|
||||
title: Votre dossier va expirer
|
||||
states:
|
||||
brouillon: Votre dossier est en brouillon, mais va bientôt expirer. Cela signifie qu’il va bientôt être supprimé sans avoir été déposé. Si vous souhaitez le conserver afin de poursuivre la démarche, vous pouvez le conserver un mois de plus en cliquant sur le bouton ci-dessous.
|
||||
en_construction: Votre dossier est en attente de prise en charge par l'administration. Le delais de prise en charge maximale est de 6 mois. Vous pouvez toutefois entendre cette durée d'un mois en cliquant sur le bouton suivant.
|
||||
termine: Le traitement de votre dossier est terminé, mais il va bientôt expirer. Cela signifie qu’il va bientôt être supprimé. Si vous souhaitez conserver une trace, vous pouvez le télécharger au format PDF.
|
||||
button_delay_expiration: "Repousser sa suppression"
|
|
@ -719,8 +719,8 @@ describe Instructeur, type: :model do
|
|||
|
||||
it { expect(subject['a_suivre']).to eq(0) }
|
||||
it { expect(subject['suivis']).to eq(0) }
|
||||
it { expect(subject['traites']).to eq(2) }
|
||||
it { expect(subject['tous']).to eq(2) }
|
||||
it { expect(subject['traites']).to eq(1) }
|
||||
it { expect(subject['tous']).to eq(1) }
|
||||
it { expect(subject['archives']).to eq(0) }
|
||||
it { expect(subject['expirant']).to eq(0) }
|
||||
end
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
describe 'instructeur/dossiers/expiration_banner.html.haml', type: :view do
|
||||
include DossierHelper
|
||||
let(:duree_conservation_dossiers_dans_ds) { 3 }
|
||||
let(:dossier) do
|
||||
create(:dossier, state, attributes.merge(
|
||||
id: 1,
|
||||
state: state,
|
||||
procedure: create(:procedure, procedure_expires_when_termine_enabled: expiration_enabled, duree_conservation_dossiers_dans_ds: duree_conservation_dossiers_dans_ds)
|
||||
))
|
||||
end
|
||||
let(:i18n_key_state) { state }
|
||||
subject do
|
||||
render('instructeurs/dossiers/expiration_banner.html.haml',
|
||||
dossier: dossier,
|
||||
current_user: build(:user))
|
||||
end
|
||||
|
||||
context 'with procedure having procedure_expires_when_termine_enabled not enabled' do
|
||||
let(:expiration_enabled) { false }
|
||||
let(:attributes) { { processed_at: 6.months.ago } }
|
||||
let(:state) { :accepte }
|
||||
|
||||
it 'render estimated expiration date' do
|
||||
expect(subject).not_to have_selector('.expires_at')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with procedure having procedure_expires_when_termine_enabled enabled' do
|
||||
let(:expiration_enabled) { true }
|
||||
|
||||
context 'with dossier.en_construction?' do
|
||||
let(:attributes) { { en_construction_at: 6.months.ago } }
|
||||
let(:state) { :en_construction }
|
||||
|
||||
it 'render estimated expiration date' do
|
||||
expect(subject).to have_selector('.expires_at',
|
||||
text: I18n.t("shared.dossiers.header.expires_at.#{i18n_key_state}",
|
||||
date: safe_expiration_date(dossier),
|
||||
duree_conservation_totale: duree_conservation_dossiers_dans_ds))
|
||||
end
|
||||
end
|
||||
|
||||
context 'with dossier.en_instruction?' do
|
||||
let(:state) { :en_instruction }
|
||||
let(:attributes) { {} }
|
||||
|
||||
it 'render estimated expiration date' do
|
||||
expect(subject).to have_selector('p.expires_at_en_instruction',
|
||||
text: I18n.t("shared.dossiers.header.expires_at.#{i18n_key_state}"))
|
||||
end
|
||||
end
|
||||
|
||||
context 'with dossier.en_processed_at?' do
|
||||
let(:state) { :accepte }
|
||||
let(:attributes) { {} }
|
||||
|
||||
it 'render estimated expiration date' do
|
||||
allow(dossier).to receive(:processed_at).and_return(6.months.ago)
|
||||
expect(subject).to have_selector('.expires_at',
|
||||
text: I18n.t("shared.dossiers.header.expires_at.#{i18n_key_state}",
|
||||
date: safe_expiration_date(dossier),
|
||||
duree_conservation_totale: duree_conservation_dossiers_dans_ds))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,5 +1,7 @@
|
|||
describe 'instructeurs/procedures/_header.html.haml', type: :view do
|
||||
let(:procedure) { create(:procedure, id: 1, procedure_expires_when_termine_enabled: expiration_enabled)}
|
||||
let(:procedure) { create(:procedure, id: 1, procedure_expires_when_termine_enabled: expiration_enabled) }
|
||||
|
||||
before { allow(view).to receive(:current_instructeur).and_return(create(:instructeur)) }
|
||||
|
||||
subject do
|
||||
render('instructeurs/procedures/header.html.haml',
|
||||
|
@ -12,8 +14,7 @@ describe 'instructeurs/procedures/_header.html.haml', type: :view do
|
|||
archives_count: 0,
|
||||
expirant_count: 0,
|
||||
has_en_cours_notifications: false,
|
||||
has_termine_notifications: false,
|
||||
current_instructeur: build_stubbed(:instructeur))
|
||||
has_termine_notifications: false)
|
||||
end
|
||||
|
||||
context 'when procedure_expires_when_termine_enabled is true' do
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
describe 'instructeurs/procedures/_list.html.haml', type: :view do
|
||||
let(:procedure) { create(:procedure, id: 1, procedure_expires_when_termine_enabled: expiration_enabled)}
|
||||
let(:procedure) { create(:procedure, id: 1, procedure_expires_when_termine_enabled: expiration_enabled) }
|
||||
|
||||
subject do
|
||||
render('instructeurs/procedures/list.html.haml',
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
describe 'users/dossiers/expiration_banner.html.haml', type: :view do
|
||||
include DossierHelper
|
||||
|
||||
let(:duree_conservation_dossiers_dans_ds) { 3 }
|
||||
let(:dossier) do
|
||||
create(:dossier, state, attributes.merge(
|
||||
id: 1,
|
||||
state: state,
|
||||
procedure: create(:procedure, procedure_expires_when_termine_enabled: expiration_enabled)
|
||||
conservation_extension: 1,
|
||||
procedure: create(:procedure, procedure_expires_when_termine_enabled: expiration_enabled, duree_conservation_dossiers_dans_ds: duree_conservation_dossiers_dans_ds)
|
||||
))
|
||||
end
|
||||
let(:i18n_key_state) { state }
|
||||
|
@ -35,7 +36,8 @@ describe 'users/dossiers/expiration_banner.html.haml', type: :view do
|
|||
it 'render estimated expiration date' do
|
||||
expect(subject).to have_selector('.expires_at',
|
||||
text: I18n.t("shared.dossiers.header.expires_at.#{i18n_key_state}",
|
||||
date: safe_expiration_date(dossier)))
|
||||
date: safe_expiration_date(dossier),
|
||||
duree_conservation_totale: duree_conservation_dossiers_dans_ds))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -46,7 +48,8 @@ describe 'users/dossiers/expiration_banner.html.haml', type: :view do
|
|||
it 'render estimated expiration date' do
|
||||
expect(subject).to have_selector('.expires_at',
|
||||
text: I18n.t("shared.dossiers.header.expires_at.#{i18n_key_state}",
|
||||
date: safe_expiration_date(dossier)))
|
||||
date: safe_expiration_date(dossier),
|
||||
duree_conservation_totale: duree_conservation_dossiers_dans_ds))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -68,7 +71,8 @@ describe 'users/dossiers/expiration_banner.html.haml', type: :view do
|
|||
allow(dossier).to receive(:processed_at).and_return(6.months.ago)
|
||||
expect(subject).to have_selector('.expires_at',
|
||||
text: I18n.t("shared.dossiers.header.expires_at.#{i18n_key_state}",
|
||||
date: safe_expiration_date(dossier)))
|
||||
date: safe_expiration_date(dossier),
|
||||
duree_conservation_totale: duree_conservation_dossiers_dans_ds))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue