From 2de480d6e921504e6467bdb7e78ca6fd04788a41 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 17 Sep 2018 12:43:21 +0000 Subject: [PATCH 1/5] dossier: show latest message only when dossier is pending --- app/views/new_user/dossiers/show.html.haml | 11 ++--------- .../new_user/dossiers/show/_latest_message.html.haml | 9 +++++++++ 2 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 app/views/new_user/dossiers/show/_latest_message.html.haml diff --git a/app/views/new_user/dossiers/show.html.haml b/app/views/new_user/dossiers/show.html.haml index d87e4dd0c..57b944251 100644 --- a/app/views/new_user/dossiers/show.html.haml +++ b/app/views/new_user/dossiers/show.html.haml @@ -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 } diff --git a/app/views/new_user/dossiers/show/_latest_message.html.haml b/app/views/new_user/dossiers/show/_latest_message.html.haml new file mode 100644 index 000000000..255e79696 --- /dev/null +++ b/app/views/new_user/dossiers/show/_latest_message.html.haml @@ -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' From fd7f07a2441eb5634d95d954491d4315dd5eee3d Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 17 Sep 2018 12:48:04 +0000 Subject: [PATCH 2/5] dossier: add link to messagerie when rejected --- app/views/new_user/dossiers/show/_status_overview.html.haml | 2 ++ .../new_user/dossiers/show/_status_overview.html.haml_spec.rb | 1 + 2 files changed, 3 insertions(+) diff --git a/app/views/new_user/dossiers/show/_status_overview.html.haml b/app/views/new_user/dossiers/show/_status_overview.html.haml index 026020eec..a59b600a9 100644 --- a/app/views/new_user/dossiers/show/_status_overview.html.haml +++ b/app/views/new_user/dossiers/show/_status_overview.html.haml @@ -50,6 +50,8 @@ %h3 Motif du refus %blockquote= dossier.motivation + = link_to 'Envoyer un message à l’administration', messagerie_dossier_url(dossier, anchor: 'new_commentaire'), class: 'button' + - elsif dossier.sans_suite? .sans-suite %p diff --git a/spec/views/new_user/dossiers/show/_status_overview.html.haml_spec.rb b/spec/views/new_user/dossiers/show/_status_overview.html.haml_spec.rb index e239555ca..4f41c801a 100644 --- a/spec/views/new_user/dossiers/show/_status_overview.html.haml_spec.rb +++ b/spec/views/new_user/dossiers/show/_status_overview.html.haml_spec.rb @@ -75,6 +75,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 From 27727eabf3893121667ccefcb8fa066ff4e74cd1 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 17 Sep 2018 14:45:40 +0200 Subject: [PATCH 3/5] dossier: add link to attestation when accepted --- .../new_user/dossiers/show/_status_overview.html.haml | 3 +++ spec/factories/dossier.rb | 9 +++++++++ .../dossiers/show/_status_overview.html.haml_spec.rb | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/app/views/new_user/dossiers/show/_status_overview.html.haml b/app/views/new_user/dossiers/show/_status_overview.html.haml index a59b600a9..686585731 100644 --- a/app/views/new_user/dossiers/show/_status_overview.html.haml +++ b/app/views/new_user/dossiers/show/_status_overview.html.haml @@ -38,6 +38,9 @@ %h3 Motif de l’acceptation %blockquote= dossier.motivation + - if dossier.attestation.present? + = link_to 'Télécharger l’attestation', attestation_dossier_path(dossier), target: '_blank', class: 'button primary' + - elsif dossier.refuse? .refuse %p diff --git a/spec/factories/dossier.rb b/spec/factories/dossier.rb index cb159e899..ebadac8b2 100644 --- a/spec/factories/dossier.rb +++ b/spec/factories/dossier.rb @@ -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 diff --git a/spec/views/new_user/dossiers/show/_status_overview.html.haml_spec.rb b/spec/views/new_user/dossiers/show/_status_overview.html.haml_spec.rb index 4f41c801a..d98eecc4f 100644 --- a/spec/views/new_user/dossiers/show/_status_overview.html.haml_spec.rb +++ b/spec/views/new_user/dossiers/show/_status_overview.html.haml_spec.rb @@ -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 From a7cb4b65146731f0e00e0be532f296a452f1b96e Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 17 Sep 2018 15:06:50 +0200 Subject: [PATCH 4/5] dossier: add download icon to attestation link --- app/assets/images/icons/download-white.svg | 1 + app/assets/stylesheets/new_design/icons.scss | 4 ++++ app/assets/stylesheets/new_design/patron.scss | 7 ++++++- .../new_user/dossiers/show/_status_overview.html.haml | 5 ++++- app/views/root/patron.html.haml | 1 + 5 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 app/assets/images/icons/download-white.svg diff --git a/app/assets/images/icons/download-white.svg b/app/assets/images/icons/download-white.svg new file mode 100644 index 000000000..9b3f106ad --- /dev/null +++ b/app/assets/images/icons/download-white.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/assets/stylesheets/new_design/icons.scss b/app/assets/stylesheets/new_design/icons.scss index 7962cf268..c2efb749a 100644 --- a/app/assets/stylesheets/new_design/icons.scss +++ b/app/assets/stylesheets/new_design/icons.scss @@ -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"); } diff --git a/app/assets/stylesheets/new_design/patron.scss b/app/assets/stylesheets/new_design/patron.scss index 9c255eb6f..90f4931f4 100644 --- a/app/assets/stylesheets/new_design/patron.scss +++ b/app/assets/stylesheets/new_design/patron.scss @@ -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; + } } diff --git a/app/views/new_user/dossiers/show/_status_overview.html.haml b/app/views/new_user/dossiers/show/_status_overview.html.haml index 686585731..5cc3b2094 100644 --- a/app/views/new_user/dossiers/show/_status_overview.html.haml +++ b/app/views/new_user/dossiers/show/_status_overview.html.haml @@ -39,7 +39,10 @@ %blockquote= dossier.motivation - if dossier.attestation.present? - = link_to 'Télécharger l’attestation', attestation_dossier_path(dossier), target: '_blank', class: 'button primary' + .action + = link_to attestation_dossier_path(dossier), target: '_blank', class: 'button primary' do + %span.icon.download + Télécharger l’attestation - elsif dossier.refuse? .refuse diff --git a/app/views/root/patron.html.haml b/app/views/root/patron.html.haml index f0d8a02a1..35173bda4 100644 --- a/app/views/root/patron.html.haml +++ b/app/views/root/patron.html.haml @@ -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 From de07171acddf27218e213ff1efa365a2db26c09d Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 17 Sep 2018 14:02:58 +0000 Subject: [PATCH 5/5] dossier: improve styling of finished dossier infos --- .../new_design/status_overview.scss | 26 +++++++++++----- .../dossiers/show/_status_overview.html.haml | 31 ++++++++++--------- 2 files changed, 34 insertions(+), 23 deletions(-) diff --git a/app/assets/stylesheets/new_design/status_overview.scss b/app/assets/stylesheets/new_design/status_overview.scss index 55643b1d3..beede684f 100644 --- a/app/assets/stylesheets/new_design/status_overview.scss +++ b/app/assets/stylesheets/new_design/status_overview.scss @@ -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; } } diff --git a/app/views/new_user/dossiers/show/_status_overview.html.haml b/app/views/new_user/dossiers/show/_status_overview.html.haml index 5cc3b2094..2db5da04c 100644 --- a/app/views/new_user/dossiers/show/_status_overview.html.haml +++ b/app/views/new_user/dossiers/show/_status_overview.html.haml @@ -28,25 +28,25 @@ - elsif dossier.accepte? .accepte - %p + %p.decision %span.icon.accept Votre dossier a été = succeed '.' do %strong accepté - - if dossier.motivation.present? - %h3 Motif de l’acceptation - %blockquote= dossier.motivation + - if dossier.motivation.present? + %h3 Motif de l’acceptation + %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 l’attestation + - if dossier.attestation.present? + .action + = link_to attestation_dossier_path(dossier), target: '_blank', class: 'button primary' do + %span.icon.download + Télécharger l’attestation - elsif dossier.refuse? .refuse - %p + %p.decision %span.icon.refuse Nous sommes désolés, votre dossier a malheureusement été = succeed '.' do @@ -56,16 +56,17 @@ %h3 Motif du refus %blockquote= dossier.motivation - = link_to 'Envoyer un message à l’administration', messagerie_dossier_url(dossier, anchor: 'new_commentaire'), class: 'button' + .action + = link_to 'Envoyer un message à l’administration', 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 %strong sans suite - - if dossier.motivation.present? - %h3 Motif du classement sans suite - %blockquote= dossier.motivation + - if dossier.motivation.present? + %h3 Motif du classement sans suite + %blockquote= dossier.motivation