From 81e94ca631f3514d18b45b0ed7ff6bd23b886002 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 29 Aug 2018 16:33:52 +0200 Subject: [PATCH 01/15] Improve _status.html.haml --- app/views/shared/dossiers/_status.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/shared/dossiers/_status.html.haml b/app/views/shared/dossiers/_status.html.haml index 6afc81dc6..775a93b0f 100644 --- a/app/views/shared/dossiers/_status.html.haml +++ b/app/views/shared/dossiers/_status.html.haml @@ -2,7 +2,7 @@ %span.label.brouillon brouillon - elsif dossier.en_construction? %span.label.construction en construction -- if dossier.en_instruction? +- elsif dossier.en_instruction? %span.label.instruction en instruction - elsif dossier.accepte? %span.label.accepted accepté From b9a32633bb6b388ac24115d2ba488ea22f9e6411 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 29 Aug 2018 16:51:40 +0200 Subject: [PATCH 02/15] Rename a file with a more explicit filename --- app/views/new_gestionnaire/avis/show.html.haml | 2 +- app/views/new_gestionnaire/dossiers/show.html.haml | 2 +- app/views/new_user/dossiers/formulaire.html.haml | 2 +- .../shared/dossiers/{_show.html.haml => _demande.html.haml} | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename app/views/shared/dossiers/{_show.html.haml => _demande.html.haml} (100%) diff --git a/app/views/new_gestionnaire/avis/show.html.haml b/app/views/new_gestionnaire/avis/show.html.haml index d008c0536..225e0c6f3 100644 --- a/app/views/new_gestionnaire/avis/show.html.haml +++ b/app/views/new_gestionnaire/avis/show.html.haml @@ -2,4 +2,4 @@ = render partial: 'header', locals: { avis: @avis, dossier: @dossier } -= render partial: 'shared/dossiers/show', locals: { dossier: @dossier, demande_seen_at: nil } += render partial: 'shared/dossiers/demande', locals: { dossier: @dossier, demande_seen_at: nil } diff --git a/app/views/new_gestionnaire/dossiers/show.html.haml b/app/views/new_gestionnaire/dossiers/show.html.haml index 378bfcdc3..694aea923 100644 --- a/app/views/new_gestionnaire/dossiers/show.html.haml +++ b/app/views/new_gestionnaire/dossiers/show.html.haml @@ -2,4 +2,4 @@ = render partial: "header", locals: { dossier: @dossier } -= render partial: "shared/dossiers/show", locals: { dossier: @dossier, demande_seen_at: @demande_seen_at } += render partial: "shared/dossiers/demande", locals: { dossier: @dossier, demande_seen_at: @demande_seen_at } diff --git a/app/views/new_user/dossiers/formulaire.html.haml b/app/views/new_user/dossiers/formulaire.html.haml index 986935c40..773cd38f1 100644 --- a/app/views/new_user/dossiers/formulaire.html.haml +++ b/app/views/new_user/dossiers/formulaire.html.haml @@ -1,7 +1,7 @@ #dossier-show = render partial: 'new_user/dossiers/show/header', locals: { dossier: @dossier } - = render partial: 'shared/dossiers/show', locals: { dossier: @dossier, demande_seen_at: nil } + = render partial: 'shared/dossiers/demande', locals: { dossier: @dossier, demande_seen_at: nil } .container - if !@dossier.read_only? diff --git a/app/views/shared/dossiers/_show.html.haml b/app/views/shared/dossiers/_demande.html.haml similarity index 100% rename from app/views/shared/dossiers/_show.html.haml rename to app/views/shared/dossiers/_demande.html.haml From 6b8896888952fc030ac280576f1b51825f32e297 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 29 Aug 2018 16:57:01 +0200 Subject: [PATCH 03/15] =?UTF-8?q?Formulaire=20=E2=86=92=20demande,=20when?= =?UTF-8?q?=20not=20editable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/new_user/dossiers_controller.rb | 8 ++++---- .../dossiers/{formulaire.html.haml => demande.html.haml} | 0 app/views/new_user/dossiers/show/_header.html.haml | 2 +- config/routes.rb | 2 +- spec/controllers/new_user/dossiers_controller_spec.rb | 4 ++-- spec/features/new_user/dossier_details_spec.rb | 6 +++--- ...ulaire.html.haml_spec.rb => demande.html.haml_spec.rb} | 4 ++-- .../new_user/dossiers/show/_header.html.haml_spec.rb | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) rename app/views/new_user/dossiers/{formulaire.html.haml => demande.html.haml} (100%) rename spec/views/new_user/dossiers/{formulaire.html.haml_spec.rb => demande.html.haml_spec.rb} (89%) diff --git a/app/controllers/new_user/dossiers_controller.rb b/app/controllers/new_user/dossiers_controller.rb index 138ee6848..0f8fcfc4e 100644 --- a/app/controllers/new_user/dossiers_controller.rb +++ b/app/controllers/new_user/dossiers_controller.rb @@ -4,8 +4,8 @@ module NewUser helper_method :new_demarche_url - before_action :ensure_ownership!, except: [:index, :show, :formulaire, :modifier, :update, :recherche] - before_action :ensure_ownership_or_invitation!, only: [:show, :formulaire, :modifier, :update] + before_action :ensure_ownership!, except: [:index, :show, :demande, :modifier, :update, :recherche] + before_action :ensure_ownership_or_invitation!, only: [:show, :demande, :modifier, :update] before_action :ensure_dossier_can_be_updated, only: [:update_identite, :update] before_action :forbid_invite_submission!, only: [:update] @@ -34,7 +34,7 @@ module NewUser @dossier = dossier end - def formulaire + def demande @dossier = dossier end @@ -109,7 +109,7 @@ module NewUser redirect_to merci_dossier_path(@dossier) elsif current_user.owns?(dossier) if Flipflop.new_dossier_details? - redirect_to formulaire_dossier_path(@dossier) + redirect_to demande_dossier_path(@dossier) else redirect_to users_dossier_recapitulatif_path(@dossier) end diff --git a/app/views/new_user/dossiers/formulaire.html.haml b/app/views/new_user/dossiers/demande.html.haml similarity index 100% rename from app/views/new_user/dossiers/formulaire.html.haml rename to app/views/new_user/dossiers/demande.html.haml diff --git a/app/views/new_user/dossiers/show/_header.html.haml b/app/views/new_user/dossiers/show/_header.html.haml index ebb2445de..bc9d94dd7 100644 --- a/app/views/new_user/dossiers/show/_header.html.haml +++ b/app/views/new_user/dossiers/show/_header.html.haml @@ -9,4 +9,4 @@ %ul.tabs = active_tab_item('Résumé', dossier_path(dossier)) - = active_tab_item('Formulaire', formulaire_dossier_path(dossier)) + = active_tab_item('Demande', demande_dossier_path(dossier)) diff --git a/config/routes.rb b/config/routes.rb index 0b6e8a877..7f34ca76e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -278,7 +278,7 @@ Rails.application.routes.draw do get 'modifier' patch 'modifier', to: 'dossiers#update' get 'merci' - get 'formulaire' + get 'demande' post 'ask_deletion' get 'attestation' end diff --git a/spec/controllers/new_user/dossiers_controller_spec.rb b/spec/controllers/new_user/dossiers_controller_spec.rb index 3889b974e..33cfd3566 100644 --- a/spec/controllers/new_user/dossiers_controller_spec.rb +++ b/spec/controllers/new_user/dossiers_controller_spec.rb @@ -517,10 +517,10 @@ describe NewUser::DossiersController, type: :controller do sign_in(user) end - subject! { get(:formulaire, params: { id: dossier.id }) } + subject! { get(:demande, params: { id: dossier.id }) } it { expect(assigns(:dossier)).to eq(dossier) } - it { is_expected.to render_template(:formulaire) } + it { is_expected.to render_template(:demande) } end describe '#ask_deletion' do diff --git a/spec/features/new_user/dossier_details_spec.rb b/spec/features/new_user/dossier_details_spec.rb index 6ddc49e11..4fc026e95 100644 --- a/spec/features/new_user/dossier_details_spec.rb +++ b/spec/features/new_user/dossier_details_spec.rb @@ -20,16 +20,16 @@ describe 'Dossier details:' do scenario 'the user can see and edit dossier before instruction' do visit_dossier dossier - click_on 'Formulaire' + click_on 'Demande' - expect(page).to have_current_path(formulaire_dossier_path(dossier)) + expect(page).to have_current_path(demande_dossier_path(dossier)) click_on 'Modifier le dossier' expect(page).to have_current_path(modifier_dossier_path(dossier)) fill_in('texte obligatoire', with: 'Nouveau texte') click_on 'Enregistrer les modifications du dossier' - expect(page).to have_current_path(formulaire_dossier_path(dossier)) + expect(page).to have_current_path(demande_dossier_path(dossier)) expect(page).to have_content('Nouveau texte') end diff --git a/spec/views/new_user/dossiers/formulaire.html.haml_spec.rb b/spec/views/new_user/dossiers/demande.html.haml_spec.rb similarity index 89% rename from spec/views/new_user/dossiers/formulaire.html.haml_spec.rb rename to spec/views/new_user/dossiers/demande.html.haml_spec.rb index 81bce7907..0dff42b3d 100644 --- a/spec/views/new_user/dossiers/formulaire.html.haml_spec.rb +++ b/spec/views/new_user/dossiers/demande.html.haml_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'new_user/dossiers/formulaire.html.haml', type: :view do +describe 'new_user/dossiers/demande.html.haml', type: :view do let(:procedure) { create(:procedure, :published, :with_two_type_de_piece_justificative, :with_type_de_champ, :with_type_de_champ_private) } let(:dossier) { create(:dossier, :en_construction, :with_entreprise, procedure: procedure) } @@ -16,7 +16,7 @@ describe 'new_user/dossiers/formulaire.html.haml', type: :view do it 'renders the dossier infos' do expect(rendered).to have_text('Identité') - expect(rendered).to have_text('Formulaire') + expect(rendered).to have_text('Demande') expect(rendered).to have_text('Pièces jointes') end diff --git a/spec/views/new_user/dossiers/show/_header.html.haml_spec.rb b/spec/views/new_user/dossiers/show/_header.html.haml_spec.rb index ece6e94fe..8c37b55f4 100644 --- a/spec/views/new_user/dossiers/show/_header.html.haml_spec.rb +++ b/spec/views/new_user/dossiers/show/_header.html.haml_spec.rb @@ -10,6 +10,6 @@ describe 'new_user/dossiers/show/header.html.haml', type: :view do expect(rendered).to have_selector("ul.tabs") expect(rendered).to have_link("Résumé", href: dossier_path(dossier)) - expect(rendered).to have_link("Formulaire", href: formulaire_dossier_path(dossier)) + expect(rendered).to have_link("Demande", href: demande_dossier_path(dossier)) end end From 37c0552c646663c4f760701d8bbd3cb2374a06f3 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 29 Aug 2018 17:09:48 +0200 Subject: [PATCH 04/15] Add titles --- app/views/new_user/dossiers/demande.html.haml | 2 ++ app/views/new_user/dossiers/identite.html.haml | 2 ++ app/views/new_user/dossiers/index.html.haml | 2 ++ app/views/new_user/dossiers/merci.html.haml | 2 ++ app/views/new_user/dossiers/modifier.html.haml | 2 ++ app/views/new_user/dossiers/show.html.haml | 2 ++ 6 files changed, 12 insertions(+) diff --git a/app/views/new_user/dossiers/demande.html.haml b/app/views/new_user/dossiers/demande.html.haml index 773cd38f1..f5be19d48 100644 --- a/app/views/new_user/dossiers/demande.html.haml +++ b/app/views/new_user/dossiers/demande.html.haml @@ -1,3 +1,5 @@ +- content_for(:title, "Demande · Dossier nº #{@dossier.id} (#{@dossier.procedure.libelle})") + #dossier-show = render partial: 'new_user/dossiers/show/header', locals: { dossier: @dossier } diff --git a/app/views/new_user/dossiers/identite.html.haml b/app/views/new_user/dossiers/identite.html.haml index cef41586f..920184db9 100644 --- a/app/views/new_user/dossiers/identite.html.haml +++ b/app/views/new_user/dossiers/identite.html.haml @@ -1,3 +1,5 @@ +- content_for(:title, "Nouveau dossier (#{@dossier.procedure.libelle})") + - content_for :footer do = render partial: "new_user/dossiers/footer", locals: { dossier: @dossier } diff --git a/app/views/new_user/dossiers/index.html.haml b/app/views/new_user/dossiers/index.html.haml index e878a79fb..10a5d6a78 100644 --- a/app/views/new_user/dossiers/index.html.haml +++ b/app/views/new_user/dossiers/index.html.haml @@ -1,3 +1,5 @@ +- content_for(:title, "Dossiers") + .dossiers-headers.sub-header .container = link_to "Commencer une nouvelle démarche", new_demarche_url, class: "button secondary new-demarche" diff --git a/app/views/new_user/dossiers/merci.html.haml b/app/views/new_user/dossiers/merci.html.haml index 7fddc5696..1e3344109 100644 --- a/app/views/new_user/dossiers/merci.html.haml +++ b/app/views/new_user/dossiers/merci.html.haml @@ -1,3 +1,5 @@ +- content_for(:title, "Dossier bien envoyé (#{@dossier.procedure.libelle})") + .merci .container = image_tag('user/envoi-dossier.svg') diff --git a/app/views/new_user/dossiers/modifier.html.haml b/app/views/new_user/dossiers/modifier.html.haml index 0a20b7d77..81f264954 100644 --- a/app/views/new_user/dossiers/modifier.html.haml +++ b/app/views/new_user/dossiers/modifier.html.haml @@ -1,3 +1,5 @@ +- content_for(:title, "Modification du brouillon nº #{@dossier.id} (#{@dossier.procedure.libelle})") + - content_for :footer do = render partial: "new_user/dossiers/footer", locals: { dossier: @dossier } diff --git a/app/views/new_user/dossiers/show.html.haml b/app/views/new_user/dossiers/show.html.haml index 073022c10..0f3026136 100644 --- a/app/views/new_user/dossiers/show.html.haml +++ b/app/views/new_user/dossiers/show.html.haml @@ -1,3 +1,5 @@ +- content_for(:title, "Résumé · Dossier nº #{@dossier.id} (#{@dossier.procedure.libelle})") + #dossier-show = render partial: 'new_user/dossiers/show/header', locals: { dossier: @dossier } From d99e60620625a3e7319f41edd02c0c156a781a59 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Wed, 5 Sep 2018 11:50:43 +0200 Subject: [PATCH 05/15] dossier: rename status_progress to status_overview --- .../new_design/{status_progress.scss => status_overview.scss} | 2 +- app/views/new_user/dossiers/show.html.haml | 2 +- ...{_status_progress.html.haml => _status_overview.html.haml} | 2 +- ...s.html.haml_spec.rb => _status_overview.html.haml_spec.rb} | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) rename app/assets/stylesheets/new_design/{status_progress.scss => status_overview.scss} (98%) rename app/views/new_user/dossiers/show/{_status_progress.html.haml => _status_overview.html.haml} (99%) rename spec/views/new_user/dossiers/show/{_status_progress.html.haml_spec.rb => _status_overview.html.haml_spec.rb} (95%) diff --git a/app/assets/stylesheets/new_design/status_progress.scss b/app/assets/stylesheets/new_design/status_overview.scss similarity index 98% rename from app/assets/stylesheets/new_design/status_progress.scss rename to app/assets/stylesheets/new_design/status_overview.scss index e9a5261eb..49ad8a55b 100644 --- a/app/assets/stylesheets/new_design/status_progress.scss +++ b/app/assets/stylesheets/new_design/status_overview.scss @@ -1,7 +1,7 @@ @import "colors"; @import "constants"; -.status-progress { +.status-overview { text-align: center; } diff --git a/app/views/new_user/dossiers/show.html.haml b/app/views/new_user/dossiers/show.html.haml index 0f3026136..e6e17707c 100644 --- a/app/views/new_user/dossiers/show.html.haml +++ b/app/views/new_user/dossiers/show.html.haml @@ -4,4 +4,4 @@ = render partial: 'new_user/dossiers/show/header', locals: { dossier: @dossier } .container - = render partial: 'new_user/dossiers/show/status_progress', locals: { dossier: @dossier } + = render partial: 'new_user/dossiers/show/status_overview', locals: { dossier: @dossier } diff --git a/app/views/new_user/dossiers/show/_status_progress.html.haml b/app/views/new_user/dossiers/show/_status_overview.html.haml similarity index 99% rename from app/views/new_user/dossiers/show/_status_progress.html.haml rename to app/views/new_user/dossiers/show/_status_overview.html.haml index f2acfb447..026020eec 100644 --- a/app/views/new_user/dossiers/show/_status_progress.html.haml +++ b/app/views/new_user/dossiers/show/_status_overview.html.haml @@ -1,4 +1,4 @@ -.status-progress +.status-overview - if !dossier.termine? %ul.status-timeline %li.brouillon{ class: dossier.brouillon? ? 'active' : nil } diff --git a/spec/views/new_user/dossiers/show/_status_progress.html.haml_spec.rb b/spec/views/new_user/dossiers/show/_status_overview.html.haml_spec.rb similarity index 95% rename from spec/views/new_user/dossiers/show/_status_progress.html.haml_spec.rb rename to spec/views/new_user/dossiers/show/_status_overview.html.haml_spec.rb index 3ed819b07..e239555ca 100644 --- a/spec/views/new_user/dossiers/show/_status_progress.html.haml_spec.rb +++ b/spec/views/new_user/dossiers/show/_status_overview.html.haml_spec.rb @@ -1,5 +1,5 @@ -describe 'new_user/dossiers/show/_status_progress.html.haml', type: :view do - subject! { render 'new_user/dossiers/show/status_progress.html.haml', dossier: dossier } +describe 'new_user/dossiers/show/_status_overview.html.haml', type: :view do + subject! { render 'new_user/dossiers/show/status_overview.html.haml', dossier: dossier } matcher :have_timeline_item do |selector| match do |rendered| From d77e0e938fe610151dacd560ece046d940adf11a Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Wed, 5 Sep 2018 13:55:43 +0200 Subject: [PATCH 06/15] dossier: fix status overview test --- spec/views/new_user/dossiers/show.html.haml_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/views/new_user/dossiers/show.html.haml_spec.rb b/spec/views/new_user/dossiers/show.html.haml_spec.rb index dda868f27..303f1f244 100644 --- a/spec/views/new_user/dossiers/show.html.haml_spec.rb +++ b/spec/views/new_user/dossiers/show.html.haml_spec.rb @@ -12,6 +12,6 @@ describe 'new_user/dossiers/show.html.haml', type: :view do it 'renders a summary of the dossier state' do expect(rendered).to have_text("Dossier nº #{dossier.id}") - expect(rendered).to have_selector('.status-progress') + expect(rendered).to have_selector('.status-overview') end end From 4e2a5f0b9bb059fb838748e11fe8d007b076cc86 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Thu, 16 Aug 2018 15:22:35 +0000 Subject: [PATCH 07/15] messagerie: move templates to a shared location --- app/views/new_gestionnaire/avis/messagerie.html.haml | 2 +- app/views/new_gestionnaire/dossiers/messagerie.html.haml | 2 +- app/views/new_gestionnaire/shared/_messagerie.html.haml | 7 ------- app/views/shared/dossiers/_messagerie.html.haml | 7 +++++++ .../shared => shared/dossiers}/messages/_form.html.haml | 0 .../shared => shared/dossiers}/messages/_message.html.haml | 4 ++-- .../dossiers}/messages/_message_icon.html.haml | 0 .../dossiers}/messages/_message_issuer.html.haml | 0 .../dossiers}/messages/message.html.haml_spec.rb | 4 ++-- 9 files changed, 13 insertions(+), 13 deletions(-) delete mode 100644 app/views/new_gestionnaire/shared/_messagerie.html.haml create mode 100644 app/views/shared/dossiers/_messagerie.html.haml rename app/views/{new_gestionnaire/shared => shared/dossiers}/messages/_form.html.haml (100%) rename app/views/{new_gestionnaire/shared => shared/dossiers}/messages/_message.html.haml (81%) rename app/views/{new_gestionnaire/shared => shared/dossiers}/messages/_message_icon.html.haml (100%) rename app/views/{new_gestionnaire/shared => shared/dossiers}/messages/_message_issuer.html.haml (100%) rename spec/views/{new_gestionnaire/shared => shared/dossiers}/messages/message.html.haml_spec.rb (70%) diff --git a/app/views/new_gestionnaire/avis/messagerie.html.haml b/app/views/new_gestionnaire/avis/messagerie.html.haml index 58a4acbcf..04860e9d9 100644 --- a/app/views/new_gestionnaire/avis/messagerie.html.haml +++ b/app/views/new_gestionnaire/avis/messagerie.html.haml @@ -2,4 +2,4 @@ = render partial: 'header', locals: { avis: @avis, dossier: @dossier } -= render partial: "new_gestionnaire/shared/messagerie", locals: { dossier: @dossier, messagerie_seen_at: nil, new_commentaire: @commentaire, form_url: commentaire_gestionnaire_avis_path(@avis) } += render partial: "shared/dossiers/messagerie", locals: { dossier: @dossier, messagerie_seen_at: nil, new_commentaire: @commentaire, form_url: commentaire_gestionnaire_avis_path(@avis) } diff --git a/app/views/new_gestionnaire/dossiers/messagerie.html.haml b/app/views/new_gestionnaire/dossiers/messagerie.html.haml index 044d9f58e..78e91c5a8 100644 --- a/app/views/new_gestionnaire/dossiers/messagerie.html.haml +++ b/app/views/new_gestionnaire/dossiers/messagerie.html.haml @@ -2,4 +2,4 @@ = render partial: "header", locals: { dossier: @dossier } -= render partial: "new_gestionnaire/shared/messagerie", locals: { dossier: @dossier, messagerie_seen_at: @messagerie_seen_at , new_commentaire: @commentaire, form_url: commentaire_gestionnaire_dossier_path(@dossier.procedure, @dossier) } += render partial: "shared/dossiers/messagerie", locals: { dossier: @dossier, messagerie_seen_at: @messagerie_seen_at , new_commentaire: @commentaire, form_url: commentaire_gestionnaire_dossier_path(@dossier.procedure, @dossier) } diff --git a/app/views/new_gestionnaire/shared/_messagerie.html.haml b/app/views/new_gestionnaire/shared/_messagerie.html.haml deleted file mode 100644 index 1b6d7776e..000000000 --- a/app/views/new_gestionnaire/shared/_messagerie.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -.messagerie.container - %ul.messages-list - - dossier.commentaires.each do |commentaire| - %li{ class: commentaire_is_from_me_class(commentaire, current_gestionnaire.email) } - = render partial: "new_gestionnaire/shared/messages/message", locals: { commentaire: commentaire, messagerie_seen_at: messagerie_seen_at } - - = render partial: "new_gestionnaire/shared/messages/form", locals: { commentaire: new_commentaire, form_url: form_url } diff --git a/app/views/shared/dossiers/_messagerie.html.haml b/app/views/shared/dossiers/_messagerie.html.haml new file mode 100644 index 000000000..1d8f00871 --- /dev/null +++ b/app/views/shared/dossiers/_messagerie.html.haml @@ -0,0 +1,7 @@ +.messagerie.container + %ul.messages-list + - dossier.commentaires.each do |commentaire| + %li{ class: commentaire_is_from_me_class(commentaire, current_gestionnaire.email) } + = render partial: "shared/dossiers/messages/message", locals: { commentaire: commentaire, messagerie_seen_at: messagerie_seen_at } + + = render partial: "shared/dossiers/messages/form", locals: { commentaire: new_commentaire, form_url: form_url } diff --git a/app/views/new_gestionnaire/shared/messages/_form.html.haml b/app/views/shared/dossiers/messages/_form.html.haml similarity index 100% rename from app/views/new_gestionnaire/shared/messages/_form.html.haml rename to app/views/shared/dossiers/messages/_form.html.haml diff --git a/app/views/new_gestionnaire/shared/messages/_message.html.haml b/app/views/shared/dossiers/messages/_message.html.haml similarity index 81% rename from app/views/new_gestionnaire/shared/messages/_message.html.haml rename to app/views/shared/dossiers/messages/_message.html.haml index dd902856f..3f7f1accd 100644 --- a/app/views/new_gestionnaire/shared/messages/_message.html.haml +++ b/app/views/shared/dossiers/messages/_message.html.haml @@ -1,9 +1,9 @@ -= render partial: 'new_gestionnaire/shared/messages/message_icon', locals: { commentaire: commentaire, current_gestionnaire: current_gestionnaire } += render partial: 'shared/dossiers/messages/message_icon', locals: { commentaire: commentaire, current_gestionnaire: current_gestionnaire } .width-100 %h2 %span.mail - = render partial: 'new_gestionnaire/shared/messages/message_issuer', locals: { commentaire: commentaire, current_gestionnaire: current_gestionnaire } + = render partial: 'shared/dossiers/messages/message_issuer', locals: { commentaire: commentaire, current_gestionnaire: current_gestionnaire } - if ![current_gestionnaire.email, commentaire.dossier.user.email, OLD_CONTACT_EMAIL, CONTACT_EMAIL].include?(commentaire.email) %span.guest Invité %span.date{ class: highlight_if_unseen_class(messagerie_seen_at, commentaire.created_at) } diff --git a/app/views/new_gestionnaire/shared/messages/_message_icon.html.haml b/app/views/shared/dossiers/messages/_message_icon.html.haml similarity index 100% rename from app/views/new_gestionnaire/shared/messages/_message_icon.html.haml rename to app/views/shared/dossiers/messages/_message_icon.html.haml diff --git a/app/views/new_gestionnaire/shared/messages/_message_issuer.html.haml b/app/views/shared/dossiers/messages/_message_issuer.html.haml similarity index 100% rename from app/views/new_gestionnaire/shared/messages/_message_issuer.html.haml rename to app/views/shared/dossiers/messages/_message_issuer.html.haml diff --git a/spec/views/new_gestionnaire/shared/messages/message.html.haml_spec.rb b/spec/views/shared/dossiers/messages/message.html.haml_spec.rb similarity index 70% rename from spec/views/new_gestionnaire/shared/messages/message.html.haml_spec.rb rename to spec/views/shared/dossiers/messages/message.html.haml_spec.rb index 31fd9db3b..005c663bf 100644 --- a/spec/views/new_gestionnaire/shared/messages/message.html.haml_spec.rb +++ b/spec/views/shared/dossiers/messages/message.html.haml_spec.rb @@ -1,7 +1,7 @@ -describe 'new_gestionnaire/shared/messages/message.html.haml', type: :view do +describe 'shared/dossiers/messages/message.html.haml', type: :view do before { view.extend DossierHelper } - subject { render 'new_gestionnaire/shared/messages/message.html.haml', commentaire: commentaire, messagerie_seen_at: seen_at, current_gestionnaire: current_gestionnaire } + subject { render 'shared/dossiers/messages/message.html.haml', commentaire: commentaire, messagerie_seen_at: seen_at, current_gestionnaire: current_gestionnaire } let(:dossier) { create(:dossier) } let(:commentaire) { create(:commentaire, dossier: dossier) } From 63472f00e67e31425ee7bb08c75fec2641c05f6a Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Thu, 16 Aug 2018 17:22:08 +0200 Subject: [PATCH 08/15] messagerie: generalize the current user email --- app/views/new_gestionnaire/avis/messagerie.html.haml | 2 +- app/views/new_gestionnaire/dossiers/messagerie.html.haml | 2 +- app/views/new_gestionnaire/dossiers/print.html.haml | 2 +- app/views/shared/dossiers/_messagerie.html.haml | 4 ++-- app/views/shared/dossiers/messages/_message.html.haml | 6 +++--- app/views/shared/dossiers/messages/_message_icon.html.haml | 2 +- .../shared/dossiers/messages/_message_issuer.html.haml | 2 +- .../shared/dossiers/messages/message.html.haml_spec.rb | 3 +-- 8 files changed, 11 insertions(+), 12 deletions(-) diff --git a/app/views/new_gestionnaire/avis/messagerie.html.haml b/app/views/new_gestionnaire/avis/messagerie.html.haml index 04860e9d9..9bea14b67 100644 --- a/app/views/new_gestionnaire/avis/messagerie.html.haml +++ b/app/views/new_gestionnaire/avis/messagerie.html.haml @@ -2,4 +2,4 @@ = render partial: 'header', locals: { avis: @avis, dossier: @dossier } -= render partial: "shared/dossiers/messagerie", locals: { dossier: @dossier, messagerie_seen_at: nil, new_commentaire: @commentaire, form_url: commentaire_gestionnaire_avis_path(@avis) } += render partial: "shared/dossiers/messagerie", locals: { dossier: @dossier, user_email: current_gestionnaire.email, messagerie_seen_at: nil, new_commentaire: @commentaire, form_url: commentaire_gestionnaire_avis_path(@avis) } diff --git a/app/views/new_gestionnaire/dossiers/messagerie.html.haml b/app/views/new_gestionnaire/dossiers/messagerie.html.haml index 78e91c5a8..e62eeae7f 100644 --- a/app/views/new_gestionnaire/dossiers/messagerie.html.haml +++ b/app/views/new_gestionnaire/dossiers/messagerie.html.haml @@ -2,4 +2,4 @@ = render partial: "header", locals: { dossier: @dossier } -= render partial: "shared/dossiers/messagerie", locals: { dossier: @dossier, messagerie_seen_at: @messagerie_seen_at , new_commentaire: @commentaire, form_url: commentaire_gestionnaire_dossier_path(@dossier.procedure, @dossier) } += render partial: "shared/dossiers/messagerie", locals: { dossier: @dossier, user_email: current_gestionnaire.email, messagerie_seen_at: @messagerie_seen_at , new_commentaire: @commentaire, form_url: commentaire_gestionnaire_dossier_path(@dossier.procedure, @dossier) } diff --git a/app/views/new_gestionnaire/dossiers/print.html.haml b/app/views/new_gestionnaire/dossiers/print.html.haml index ebb055da4..f1b917137 100644 --- a/app/views/new_gestionnaire/dossiers/print.html.haml +++ b/app/views/new_gestionnaire/dossiers/print.html.haml @@ -84,7 +84,7 @@ %ul.messages-list - @dossier.commentaires.each do |commentaire| %li - = render partial: "new_gestionnaire/shared/messages/message", locals: { commentaire: commentaire, messagerie_seen_at: nil } + = render partial: "new_gestionnaire/shared/messages/message", locals: { commentaire: commentaire, user_email: current_gestionnaire.email, messagerie_seen_at: nil } %script{ type: "text/javascript" } window.print(); diff --git a/app/views/shared/dossiers/_messagerie.html.haml b/app/views/shared/dossiers/_messagerie.html.haml index 1d8f00871..be8414010 100644 --- a/app/views/shared/dossiers/_messagerie.html.haml +++ b/app/views/shared/dossiers/_messagerie.html.haml @@ -1,7 +1,7 @@ .messagerie.container %ul.messages-list - dossier.commentaires.each do |commentaire| - %li{ class: commentaire_is_from_me_class(commentaire, current_gestionnaire.email) } - = render partial: "shared/dossiers/messages/message", locals: { commentaire: commentaire, messagerie_seen_at: messagerie_seen_at } + %li{ class: commentaire_is_from_me_class(commentaire, user_email) } + = render partial: "shared/dossiers/messages/message", locals: { commentaire: commentaire, user_email: user_email, messagerie_seen_at: messagerie_seen_at } = render partial: "shared/dossiers/messages/form", locals: { commentaire: new_commentaire, form_url: form_url } diff --git a/app/views/shared/dossiers/messages/_message.html.haml b/app/views/shared/dossiers/messages/_message.html.haml index 3f7f1accd..f4f3ceeac 100644 --- a/app/views/shared/dossiers/messages/_message.html.haml +++ b/app/views/shared/dossiers/messages/_message.html.haml @@ -1,10 +1,10 @@ -= render partial: 'shared/dossiers/messages/message_icon', locals: { commentaire: commentaire, current_gestionnaire: current_gestionnaire } += render partial: 'shared/dossiers/messages/message_icon', locals: { commentaire: commentaire, user_email: user_email } .width-100 %h2 %span.mail - = render partial: 'shared/dossiers/messages/message_issuer', locals: { commentaire: commentaire, current_gestionnaire: current_gestionnaire } - - if ![current_gestionnaire.email, commentaire.dossier.user.email, OLD_CONTACT_EMAIL, CONTACT_EMAIL].include?(commentaire.email) + = render partial: 'shared/dossiers/messages/message_issuer', locals: { commentaire: commentaire, user_email: user_email } + - if ![user_email, commentaire.dossier.user.email, OLD_CONTACT_EMAIL, CONTACT_EMAIL].include?(commentaire.email) %span.guest Invité %span.date{ class: highlight_if_unseen_class(messagerie_seen_at, commentaire.created_at) } = I18n.l(commentaire.created_at.localtime, format: '%d/%m/%Y à %H:%M ') diff --git a/app/views/shared/dossiers/messages/_message_icon.html.haml b/app/views/shared/dossiers/messages/_message_icon.html.haml index dc19bd941..bfa5d2581 100644 --- a/app/views/shared/dossiers/messages/_message_icon.html.haml +++ b/app/views/shared/dossiers/messages/_message_icon.html.haml @@ -1,5 +1,5 @@ - case commentaire.email -- when current_gestionnaire.email +- when user_email = image_tag('icons/account-circle.svg', class: 'person-icon') - when OLD_CONTACT_EMAIL - when CONTACT_EMAIL diff --git a/app/views/shared/dossiers/messages/_message_issuer.html.haml b/app/views/shared/dossiers/messages/_message_issuer.html.haml index afba289e6..5f4eee4f2 100644 --- a/app/views/shared/dossiers/messages/_message_issuer.html.haml +++ b/app/views/shared/dossiers/messages/_message_issuer.html.haml @@ -1,5 +1,5 @@ - case commentaire.email -- when current_gestionnaire.email +- when user_email Vous - when OLD_CONTACT_EMAIL - when CONTACT_EMAIL diff --git a/spec/views/shared/dossiers/messages/message.html.haml_spec.rb b/spec/views/shared/dossiers/messages/message.html.haml_spec.rb index 005c663bf..c33ff269b 100644 --- a/spec/views/shared/dossiers/messages/message.html.haml_spec.rb +++ b/spec/views/shared/dossiers/messages/message.html.haml_spec.rb @@ -1,11 +1,10 @@ describe 'shared/dossiers/messages/message.html.haml', type: :view do before { view.extend DossierHelper } - subject { render 'shared/dossiers/messages/message.html.haml', commentaire: commentaire, messagerie_seen_at: seen_at, current_gestionnaire: current_gestionnaire } + subject { render 'shared/dossiers/messages/message.html.haml', commentaire: commentaire, messagerie_seen_at: seen_at, user_email: dossier.user.email } let(:dossier) { create(:dossier) } let(:commentaire) { create(:commentaire, dossier: dossier) } - let(:current_gestionnaire) { create(:gestionnaire) } let(:seen_at) { commentaire.created_at + 1.hour } context "with a seen_at after commentaire created_at" do From 5cfb20041783633cc7e60cbe06c50dab29291839 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Tue, 4 Sep 2018 17:47:34 +0200 Subject: [PATCH 09/15] dossier: cache the dossier value --- app/controllers/new_user/dossiers_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/new_user/dossiers_controller.rb b/app/controllers/new_user/dossiers_controller.rb index 0f8fcfc4e..060bae041 100644 --- a/app/controllers/new_user/dossiers_controller.rb +++ b/app/controllers/new_user/dossiers_controller.rb @@ -185,7 +185,7 @@ module NewUser end def dossier - Dossier.find(params[:id] || params[:dossier_id]) + @dossier ||= Dossier.find(params[:id] || params[:dossier_id]) end def dossier_with_champs From af5df2d6611bafd13759aaf51bc40feaf053133e Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Wed, 5 Sep 2018 11:56:12 +0000 Subject: [PATCH 10/15] dossier: add "Messagerie" tab --- .../new_user/dossiers_controller.rb | 25 ++++++++++- .../new_user/dossiers/messagerie.html.haml | 6 +++ .../new_user/dossiers/show/_header.html.haml | 1 + config/routes.rb | 2 + .../new_user/dossiers_controller_spec.rb | 42 +++++++++++++++++++ .../features/new_user/dossier_details_spec.rb | 21 ++++++++++ 6 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 app/views/new_user/dossiers/messagerie.html.haml diff --git a/app/controllers/new_user/dossiers_controller.rb b/app/controllers/new_user/dossiers_controller.rb index 060bae041..3a008190d 100644 --- a/app/controllers/new_user/dossiers_controller.rb +++ b/app/controllers/new_user/dossiers_controller.rb @@ -4,8 +4,8 @@ module NewUser helper_method :new_demarche_url - before_action :ensure_ownership!, except: [:index, :show, :demande, :modifier, :update, :recherche] - before_action :ensure_ownership_or_invitation!, only: [:show, :demande, :modifier, :update] + before_action :ensure_ownership!, except: [:index, :show, :demande, :messagerie, :modifier, :update, :recherche] + before_action :ensure_ownership_or_invitation!, only: [:show, :demande, :messagerie, :modifier, :update, :create_commentaire] before_action :ensure_dossier_can_be_updated, only: [:update_identite, :update] before_action :forbid_invite_submission!, only: [:update] @@ -38,6 +38,11 @@ module NewUser @dossier = dossier end + def messagerie + @dossier = dossier + @commentaire = Commentaire.new + end + def attestation send_data(dossier.attestation.pdf.read, filename: 'attestation.pdf', type: 'application/pdf') end @@ -122,6 +127,18 @@ module NewUser @dossier = current_user.dossiers.includes(:procedure).find(params[:id]) end + def create_commentaire + @commentaire = CommentaireService.create(current_user, dossier, commentaire_params) + + if @commentaire.save + flash.notice = "Message envoyé" + redirect_to messagerie_dossier_path(dossier) + else + flash.now.alert = @commentaire.errors.full_messages + render :messagerie + end + end + def ask_deletion dossier = current_user.dossiers.includes(:user, procedure: :administrateur).find(params[:id]) @@ -223,6 +240,10 @@ module NewUser params.require(:dossier).permit(:autorisation_donnees) end + def commentaire_params + params.require(:commentaire).permit(:body, :file) + end + def passage_en_construction? dossier.brouillon? && !draft? end diff --git a/app/views/new_user/dossiers/messagerie.html.haml b/app/views/new_user/dossiers/messagerie.html.haml new file mode 100644 index 000000000..26d4fb8b6 --- /dev/null +++ b/app/views/new_user/dossiers/messagerie.html.haml @@ -0,0 +1,6 @@ +- content_for(:title, "Messagerie · Dossier nº #{@dossier.id} (#{@dossier.procedure.libelle})") + +#dossier-show + = render partial: 'new_user/dossiers/show/header', locals: { dossier: @dossier } + + = render partial: "shared/dossiers/messagerie", locals: { dossier: @dossier, user_email: current_user.email, messagerie_seen_at: nil, new_commentaire: @commentaire, form_url: commentaire_dossier_path(@dossier) } diff --git a/app/views/new_user/dossiers/show/_header.html.haml b/app/views/new_user/dossiers/show/_header.html.haml index bc9d94dd7..52ae776c2 100644 --- a/app/views/new_user/dossiers/show/_header.html.haml +++ b/app/views/new_user/dossiers/show/_header.html.haml @@ -10,3 +10,4 @@ %ul.tabs = active_tab_item('Résumé', dossier_path(dossier)) = active_tab_item('Demande', demande_dossier_path(dossier)) + = active_tab_item('Messagerie', messagerie_dossier_path(dossier)) diff --git a/config/routes.rb b/config/routes.rb index 7f34ca76e..fc6b800e4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -279,6 +279,8 @@ Rails.application.routes.draw do patch 'modifier', to: 'dossiers#update' get 'merci' get 'demande' + get 'messagerie' + post 'commentaire' => 'dossiers#create_commentaire' post 'ask_deletion' get 'attestation' end diff --git a/spec/controllers/new_user/dossiers_controller_spec.rb b/spec/controllers/new_user/dossiers_controller_spec.rb index 33cfd3566..36a7b2eea 100644 --- a/spec/controllers/new_user/dossiers_controller_spec.rb +++ b/spec/controllers/new_user/dossiers_controller_spec.rb @@ -523,6 +523,48 @@ describe NewUser::DossiersController, type: :controller do it { is_expected.to render_template(:demande) } end + describe "#create_commentaire" do + let(:dossier) { create(:dossier, :en_construction, user: user) } + let(:saved_commentaire) { dossier.commentaires.first } + let(:body) { "avant\napres" } + let(:file) { Rack::Test::UploadedFile.new("./spec/support/files/piece_justificative_0.pdf", 'application/pdf') } + let(:scan_result) { true } + + subject { + post :create_commentaire, params: { + id: dossier.id, + commentaire: { + body: body, + file: file + } + } + } + + before do + sign_in(user) + allow(ClamavService).to receive(:safe_file?).and_return(scan_result) + end + + it "creates a commentaire" do + expect { subject }.to change(Commentaire, :count).by(1) + + expect(response).to redirect_to(messagerie_dossier_path(dossier)) + expect(flash.notice).to be_present + end + + context "when the commentaire creation fails" do + let(:scan_result) { false } + + it "renders the messagerie page with the invalid commentaire" do + expect { subject }.not_to change(Commentaire, :count) + + expect(response).to render_template :messagerie + expect(flash.alert).to be_present + expect(assigns(:commentaire).body).to eq("

avant\n
apres

") + end + end + end + describe '#ask_deletion' do before { sign_in(user) } diff --git a/spec/features/new_user/dossier_details_spec.rb b/spec/features/new_user/dossier_details_spec.rb index 4fc026e95..d6644e634 100644 --- a/spec/features/new_user/dossier_details_spec.rb +++ b/spec/features/new_user/dossier_details_spec.rb @@ -33,6 +33,27 @@ describe 'Dossier details:' do expect(page).to have_content('Nouveau texte') end + context 'with messages' do + let!(:commentaire) { create(:commentaire, dossier: dossier, email: 'instructeur@exemple.fr', body: 'Message envoyé à l’usager') } + let(:message_body) { 'Message envoyé à l’instructeur' } + + scenario 'the user can send a message' do + visit_dossier dossier + click_on 'Messagerie' + + expect(page).to have_current_path(messagerie_dossier_path(dossier)) + expect(page).to have_content(commentaire.body) + + fill_in 'commentaire_body', with: message_body + click_on 'Envoyer' + + expect(page).to have_current_path(messagerie_dossier_path(dossier)) + expect(page).to have_content('Message envoyé') + expect(page).to have_content(commentaire.body) + expect(page).to have_content(message_body) + end + end + private def visit_dossier(dossier) From be3b9382e50764242e16fe34a6bdc2196e23fd23 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 5 Sep 2018 11:58:34 +0200 Subject: [PATCH 11/15] Rename status partial to status_badge --- app/views/new_gestionnaire/procedures/show.html.haml | 2 +- app/views/new_gestionnaire/recherche/index.html.haml | 2 +- app/views/new_user/dossiers/index.html.haml | 2 +- app/views/new_user/dossiers/show/_header.html.haml | 2 +- .../dossiers/{_status.html.haml => _status_badge.html.haml} | 0 5 files changed, 4 insertions(+), 4 deletions(-) rename app/views/shared/dossiers/{_status.html.haml => _status_badge.html.haml} (100%) diff --git a/app/views/new_gestionnaire/procedures/show.html.haml b/app/views/new_gestionnaire/procedures/show.html.haml index 33cd2c785..4cab26c7f 100644 --- a/app/views/new_gestionnaire/procedures/show.html.haml +++ b/app/views/new_gestionnaire/procedures/show.html.haml @@ -109,7 +109,7 @@ %td.status-col = link_to(gestionnaire_dossier_path(@procedure, dossier), class: 'cell-link') do - = render partial: 'shared/dossiers/status', locals: { dossier: dossier } + = render partial: 'shared/dossiers/status_badge', locals: { dossier: dossier } %td.follow-col= render partial: 'dossier_actions', locals: { procedure: @procedure, dossier: dossier, dossier_is_followed: @followed_dossiers_id.include?(dossier.id) } = paginate @dossiers - else diff --git a/app/views/new_gestionnaire/recherche/index.html.haml b/app/views/new_gestionnaire/recherche/index.html.haml index e34f419f0..c6857fb8f 100644 --- a/app/views/new_gestionnaire/recherche/index.html.haml +++ b/app/views/new_gestionnaire/recherche/index.html.haml @@ -29,6 +29,6 @@ %td= link_to(dossier.user.email, dossier_linked_path(current_gestionnaire, dossier), class: 'cell-link') %td.status-col = link_to(dossier_linked_path(current_gestionnaire, dossier), class: 'cell-link') do - = render partial: 'shared/dossiers/status', locals: { dossier: dossier } + = render partial: 'shared/dossiers/status_badge', locals: { dossier: dossier } - else %h2 Aucun dossier correspondant à votre recherche n'a été trouvé diff --git a/app/views/new_user/dossiers/index.html.haml b/app/views/new_user/dossiers/index.html.haml index 10a5d6a78..daf47fb1d 100644 --- a/app/views/new_user/dossiers/index.html.haml +++ b/app/views/new_user/dossiers/index.html.haml @@ -42,7 +42,7 @@ = dossier.procedure.libelle %td.status-col = link_to(url_for_dossier(dossier), class: 'cell-link') do - = render partial: 'shared/dossiers/status', locals: { dossier: dossier } + = render partial: 'shared/dossiers/status_badge', locals: { dossier: dossier } %td.updated-at-col = link_to(url_for_dossier(dossier), class: 'cell-link') do = dossier.updated_at.localtime.strftime("%d/%m/%Y") diff --git a/app/views/new_user/dossiers/show/_header.html.haml b/app/views/new_user/dossiers/show/_header.html.haml index 52ae776c2..c5144e0be 100644 --- a/app/views/new_user/dossiers/show/_header.html.haml +++ b/app/views/new_user/dossiers/show/_header.html.haml @@ -1,6 +1,6 @@ .sub-header .container - = render partial: 'shared/dossiers/status', locals: { dossier: dossier } + = render partial: 'shared/dossiers/status_badge', locals: { dossier: dossier } .title-container %span.icon.folder diff --git a/app/views/shared/dossiers/_status.html.haml b/app/views/shared/dossiers/_status_badge.html.haml similarity index 100% rename from app/views/shared/dossiers/_status.html.haml rename to app/views/shared/dossiers/_status_badge.html.haml From 43b406e51cc07b34c716fca931b725d7c3358a36 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 5 Sep 2018 14:21:48 +0200 Subject: [PATCH 12/15] =?UTF-8?q?Proc=C3=A9dures=20=E2=86=92=20d=C3=A9marc?= =?UTF-8?q?hes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/stats/index.html.haml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/stats/index.html.haml b/app/views/stats/index.html.haml index 0fe2d3583..aea8aeab0 100644 --- a/app/views/stats/index.html.haml +++ b/app/views/stats/index.html.haml @@ -6,7 +6,7 @@ .stat-cards .stat-card.stat-card-half.big-number-card.pull-left - %span.big-number-card-title TOTAL PROCÉDURES DÉMATÉRIALISÉES + %span.big-number-card-title TOTAL DÉMARCHES DÉMATÉRIALISÉES %span.big-number-card-number = number_with_delimiter(@procedures_numbers[:total]) %span.big-number-card-detail @@ -43,7 +43,7 @@ Par mois %li.segmented-control-item{ :onclick => "DS.toggleChart(event, '.cumulative-procedures-chart');" } Cumul - %span.stat-card-title.pull-left Procédures dématérialisées + %span.stat-card-title.pull-left Démarches dématérialisées .clearfix .chart-container @@ -69,7 +69,7 @@ .stat-card.stat-card-half.pull-left %span.stat-card-title - Nombre d'administrations ayant dématérialisé N procédures + Nombre d'administrations ayant dématérialisé N démarches .chart-container .chart @@ -121,8 +121,8 @@ = column_chart @motivation_usage_dossier, ytitle: 'dossiers avec motivation / total dossiers', xtitle: 'semaines' .stat-card.stat-card-half.pull-left - %span.stat-card-title Taux d'utilisation des motivations (par procédure) - = column_chart @motivation_usage_procedure, ytitle: 'procedures avec motivation / total procedures', xtitle: 'semaines' + %span.stat-card-title Taux d'utilisation des motivations (par démarche) + = column_chart @motivation_usage_procedure, ytitle: 'démarches avec motivation / total démarches', xtitle: 'semaines' .clearfix @@ -131,7 +131,7 @@ .stat-cards .stat-card.stat-card-half.pull-left %span.stat-card-title Taux d'utilisation de la bibliothèque - = column_chart @cloned_from_library_procedures_ratio, ytitle: 'procédures clonées / total procédure', xtitle: 'semaines' + = column_chart @cloned_from_library_procedures_ratio, ytitle: 'démarches clonées / total démarche', xtitle: 'semaines' .clearfix From 18a7d4c79426fada7ef490ab088700f4515ef6b1 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 5 Sep 2018 14:22:16 +0200 Subject: [PATCH 13/15] Fix typo --- app/views/stats/index.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/stats/index.html.haml b/app/views/stats/index.html.haml index aea8aeab0..4d232bccd 100644 --- a/app/views/stats/index.html.haml +++ b/app/views/stats/index.html.haml @@ -131,7 +131,7 @@ .stat-cards .stat-card.stat-card-half.pull-left %span.stat-card-title Taux d'utilisation de la bibliothèque - = column_chart @cloned_from_library_procedures_ratio, ytitle: 'démarches clonées / total démarche', xtitle: 'semaines' + = column_chart @cloned_from_library_procedures_ratio, ytitle: 'démarches clonées / total démarches', xtitle: 'semaines' .clearfix From 21776e360bfbf3b219b470751ff35d9c80e92a0e Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 5 Sep 2018 14:30:19 +0200 Subject: [PATCH 14/15] Improve a stats title to better reflect reality --- app/views/stats/index.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/stats/index.html.haml b/app/views/stats/index.html.haml index 4d232bccd..603960dfb 100644 --- a/app/views/stats/index.html.haml +++ b/app/views/stats/index.html.haml @@ -6,7 +6,7 @@ .stat-cards .stat-card.stat-card-half.big-number-card.pull-left - %span.big-number-card-title TOTAL DÉMARCHES DÉMATÉRIALISÉES + %span.big-number-card-title TOTAL DÉMARCHES DÉMATÉRIALISÉES OU EN COURS DE DÉMATÉRIALISATION %span.big-number-card-number = number_with_delimiter(@procedures_numbers[:total]) %span.big-number-card-detail From 80c35c284f44cee1fc429a180f351fe05190ac38 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 5 Sep 2018 14:31:19 +0200 Subject: [PATCH 15/15] Properly handle a long title in a stats card --- app/assets/stylesheets/new_design/stats.scss | 5 +++++ app/views/stats/index.html.haml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/new_design/stats.scss b/app/assets/stylesheets/new_design/stats.scss index c77d6ba36..7084571b0 100644 --- a/app/assets/stylesheets/new_design/stats.scss +++ b/app/assets/stylesheets/new_design/stats.scss @@ -128,6 +128,11 @@ $big-number-card-padding: 2 * $segmented-control-item-border-radius; margin: 0 auto; margin-bottom: 20px; color: $light-grey; + + &.long-title { + margin-left: -30px; + margin-right: -30px; + } } .big-number-card-number { diff --git a/app/views/stats/index.html.haml b/app/views/stats/index.html.haml index 603960dfb..e44fc1174 100644 --- a/app/views/stats/index.html.haml +++ b/app/views/stats/index.html.haml @@ -6,7 +6,7 @@ .stat-cards .stat-card.stat-card-half.big-number-card.pull-left - %span.big-number-card-title TOTAL DÉMARCHES DÉMATÉRIALISÉES OU EN COURS DE DÉMATÉRIALISATION + %span.big-number-card-title.long-title TOTAL DÉMARCHES DÉMAT. OU EN COURS DE DÉMAT. %span.big-number-card-number = number_with_delimiter(@procedures_numbers[:total]) %span.big-number-card-detail