Merge pull request #2593 from betagouv/dossier-add-termine-state

Dossier : amélioration des états terminés
This commit is contained in:
gregoirenovel 2018-09-17 16:53:07 +02:00 committed by GitHub
commit 29b47f48ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 74 additions and 27 deletions

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="20" viewBox="0 0 16 20"><g fill="none" fill-rule="evenodd"><path d="M11.5 8H15l-7 7-7-7h3.5V1h7zM1 19h14" stroke="#FFF" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/><path d="M-4-2h24v24H-4z"/></g></svg>

After

Width:  |  Height:  |  Size: 281 B

View file

@ -53,6 +53,10 @@
background-image: image-url("icons/attachment.svg");
}
&.download {
background-image: image-url("icons/download-white.svg");
}
&.lock {
background-image: image-url("icons/lock.svg");
}

View file

@ -1,7 +1,12 @@
@import "placeholders";
@import "colors";
.patron {
p {
margin-bottom: 20px;
}
.icon.download {
background-color: $blue;
box-shadow: 0px 0px 1px 2px $blue;
}
}

View file

@ -55,18 +55,28 @@
margin: auto;
}
h3 {
font-size: 1.1em;
font-weight: bold;
margin-bottom: $default-spacer;
}
p {
margin-bottom: $default-padding;
}
.decision {
font-size: 1.2em;
margin-top: $default-padding * 3;
margin-bottom: $default-padding * 3;
}
.icon {
margin-right: $default-spacer;
}
h3 {
font-weight: bold;
margin-bottom: $default-spacer;
}
blockquote {
quotes: "« " " »" "" "";
margin-bottom: $default-padding * 3;
}
blockquote::before {
@ -77,7 +87,7 @@
content: close-quote;
}
.icon {
margin-right: $default-spacer;
.action {
margin-bottom: $default-padding * 3;
}
}

View file

@ -9,12 +9,5 @@
.container
= render partial: 'new_user/dossiers/show/status_overview', locals: { dossier: @dossier }
- latest_message = @dossier.commentaires.last
- if latest_message.present?
.latest-message-section
%h3.tab-title Dernier message
.message.inverted-background
= render partial: "shared/dossiers/messages/message", locals: { commentaire: latest_message, connected_user: current_user, messagerie_seen_at: nil }
= link_to commentaire_answer_action(latest_message, current_user), messagerie_dossier_url(@dossier, anchor: 'new_commentaire'), class: 'button send'
- if !@dossier.termine?
= render partial: 'new_user/dossiers/show/latest_message', locals: { dossier: @dossier }

View file

@ -0,0 +1,9 @@
- latest_message = dossier.commentaires.last
- if latest_message.present?
.latest-message-section
%h3.tab-title Dernier message
.message.inverted-background
= render partial: "shared/dossiers/messages/message", locals: { commentaire: latest_message, connected_user: current_user, messagerie_seen_at: nil }
= link_to commentaire_answer_action(latest_message, current_user), messagerie_dossier_url(dossier, anchor: 'new_commentaire'), class: 'button send'

View file

@ -28,7 +28,7 @@
- elsif dossier.accepte?
.accepte
%p
%p.decision
%span.icon.accept
Votre dossier a été
= succeed '.' do
@ -38,9 +38,15 @@
%h3 Motif de lacceptation
%blockquote= dossier.motivation
- if dossier.attestation.present?
.action
= link_to attestation_dossier_path(dossier), target: '_blank', class: 'button primary' do
%span.icon.download
Télécharger lattestation
- elsif dossier.refuse?
.refuse
%p
%p.decision
%span.icon.refuse
Nous sommes désolés, votre dossier a malheureusement été
= succeed '.' do
@ -50,9 +56,12 @@
%h3 Motif du refus
%blockquote= dossier.motivation
.action
= link_to 'Envoyer un message à ladministration', messagerie_dossier_url(dossier, anchor: 'new_commentaire'), class: 'button'
- elsif dossier.sans_suite?
.sans-suite
%p
%p.decision
%span.icon.without-continuation
Votre dossier a été classé
= succeed '.' do

View file

@ -23,6 +23,7 @@
%span.icon.search
%span.icon.sign-out
%span.icon.info
%span.icon.download
%span.icon.frown
%span.icon.meh
%span.icon.smile

View file

@ -136,5 +136,14 @@ FactoryBot.define do
end
end
end
trait :with_attestation do
after(:create) do |dossier, _evaluator|
if dossier.procedure.attestation_template.blank?
dossier.procedure.attestation_template = create(:attestation_template)
end
dossier.attestation = dossier.build_attestation
end
end
end
end

View file

@ -67,6 +67,11 @@ describe 'new_user/dossiers/show/_status_overview.html.haml', type: :view do
it { is_expected.not_to have_selector('.status-timeline') }
it { is_expected.to have_selector('.status-explanation .accepte') }
it { is_expected.to have_text(dossier.motivation) }
context 'with attestation' do
let(:dossier) { create :dossier, :accepte, :with_attestation }
it { is_expected.to have_link(nil, href: attestation_dossier_path(dossier)) }
end
end
context 'when refusé' do
@ -75,6 +80,7 @@ describe 'new_user/dossiers/show/_status_overview.html.haml', type: :view do
it { is_expected.not_to have_selector('.status-timeline') }
it { is_expected.to have_selector('.status-explanation .refuse') }
it { is_expected.to have_text(dossier.motivation) }
it { is_expected.to have_link(nil, href: messagerie_dossier_url(dossier, anchor: 'new_commentaire')) }
end
context 'when classé sans suite' do