From 20c7733a481668ee24537a588cdc53af93d92b4a Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Thu, 6 Sep 2018 17:42:51 +0200 Subject: [PATCH 01/19] Display the dossier footer on all the dossier pages --- app/views/new_user/dossiers/demande.html.haml | 3 +++ app/views/new_user/dossiers/messagerie.html.haml | 3 +++ app/views/new_user/dossiers/modifier.html.haml | 3 +++ app/views/new_user/dossiers/show.html.haml | 3 +++ 4 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 f5be19d48..75b50b4bd 100644 --- a/app/views/new_user/dossiers/demande.html.haml +++ b/app/views/new_user/dossiers/demande.html.haml @@ -1,5 +1,8 @@ - content_for(:title, "Demande · Dossier nº #{@dossier.id} (#{@dossier.procedure.libelle})") +- content_for :footer do + = render partial: "new_user/dossiers/footer", locals: { dossier: @dossier } + #dossier-show = render partial: 'new_user/dossiers/show/header', locals: { dossier: @dossier } diff --git a/app/views/new_user/dossiers/messagerie.html.haml b/app/views/new_user/dossiers/messagerie.html.haml index 7715042cb..2bb4a266b 100644 --- a/app/views/new_user/dossiers/messagerie.html.haml +++ b/app/views/new_user/dossiers/messagerie.html.haml @@ -1,5 +1,8 @@ - content_for(:title, "Messagerie · Dossier nº #{@dossier.id} (#{@dossier.procedure.libelle})") +- content_for :footer do + = render partial: "new_user/dossiers/footer", locals: { dossier: @dossier } + #dossier-show = render partial: 'new_user/dossiers/show/header', locals: { dossier: @dossier } diff --git a/app/views/new_user/dossiers/modifier.html.haml b/app/views/new_user/dossiers/modifier.html.haml index 624dcaa6a..49fcfd759 100644 --- a/app/views/new_user/dossiers/modifier.html.haml +++ b/app/views/new_user/dossiers/modifier.html.haml @@ -1,5 +1,8 @@ - content_for(:title, "Modifier · Dossier nº #{@dossier.id} (#{@dossier.procedure.libelle})") +- content_for :footer do + = render partial: "new_user/dossiers/footer", locals: { dossier: @dossier } + #dossier-show = render partial: 'new_user/dossiers/show/header', locals: { dossier: @dossier } diff --git a/app/views/new_user/dossiers/show.html.haml b/app/views/new_user/dossiers/show.html.haml index b94a0686f..2577650d3 100644 --- a/app/views/new_user/dossiers/show.html.haml +++ b/app/views/new_user/dossiers/show.html.haml @@ -1,5 +1,8 @@ - content_for(:title, "Résumé · Dossier nº #{@dossier.id} (#{@dossier.procedure.libelle})") +- content_for :footer do + = render partial: "new_user/dossiers/footer", locals: { dossier: @dossier } + #dossier-show = render partial: 'new_user/dossiers/show/header', locals: { dossier: @dossier } From 8ec27d4348488f951955cdb37717e1ff1dea2bb1 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 12 Sep 2018 13:09:44 +0200 Subject: [PATCH 02/19] Add a clearfix below the edit-form button To avoid an overlap with the footer --- app/views/new_user/dossiers/demande.html.haml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/new_user/dossiers/demande.html.haml b/app/views/new_user/dossiers/demande.html.haml index 75b50b4bd..59dbaef91 100644 --- a/app/views/new_user/dossiers/demande.html.haml +++ b/app/views/new_user/dossiers/demande.html.haml @@ -11,3 +11,4 @@ .container - if !@dossier.read_only? = link_to "Modifier le dossier", modifier_dossier_path(@dossier), class: 'button primary edit-form' + .clearfix From 6745b67dc4f76270afb00ef4390ce5f6bd3843ba Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 12 Sep 2018 13:10:20 +0200 Subject: [PATCH 03/19] Add some space before the footer on the dossier pages --- app/assets/stylesheets/new_design/dossier_show.scss | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/assets/stylesheets/new_design/dossier_show.scss b/app/assets/stylesheets/new_design/dossier_show.scss index be12db19e..e85c5d10c 100644 --- a/app/assets/stylesheets/new_design/dossier_show.scss +++ b/app/assets/stylesheets/new_design/dossier_show.scss @@ -2,6 +2,8 @@ @import "constants"; #dossier-show { + margin-bottom: 30px; + .sub-header { .label { float: right; From cedf1ba427de670257961d655e56c2273b812133 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 12 Sep 2018 13:24:14 +0200 Subject: [PATCH 04/19] =?UTF-8?q?footer=20=E2=86=92=20dossier=5Ffooter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dossiers/{_footer.html.haml => _dossier_footer.html.haml} | 0 app/views/new_user/dossiers/brouillon.html.haml | 2 +- app/views/new_user/dossiers/demande.html.haml | 2 +- app/views/new_user/dossiers/identite.html.haml | 2 +- app/views/new_user/dossiers/messagerie.html.haml | 2 +- app/views/new_user/dossiers/modifier.html.haml | 2 +- app/views/new_user/dossiers/show.html.haml | 2 +- ...er.html.haml_spec.rb => _dossier_footer.html.haml_spec.rb} | 4 ++-- 8 files changed, 8 insertions(+), 8 deletions(-) rename app/views/new_user/dossiers/{_footer.html.haml => _dossier_footer.html.haml} (100%) rename spec/views/new_user/dossiers/{_footer.html.haml_spec.rb => _dossier_footer.html.haml_spec.rb} (83%) diff --git a/app/views/new_user/dossiers/_footer.html.haml b/app/views/new_user/dossiers/_dossier_footer.html.haml similarity index 100% rename from app/views/new_user/dossiers/_footer.html.haml rename to app/views/new_user/dossiers/_dossier_footer.html.haml diff --git a/app/views/new_user/dossiers/brouillon.html.haml b/app/views/new_user/dossiers/brouillon.html.haml index 81f264954..77dec858b 100644 --- a/app/views/new_user/dossiers/brouillon.html.haml +++ b/app/views/new_user/dossiers/brouillon.html.haml @@ -1,7 +1,7 @@ - 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 } + = render partial: "new_user/dossiers/dossier_footer", locals: { dossier: @dossier } .dossier-edit .dossier-header.sub-header diff --git a/app/views/new_user/dossiers/demande.html.haml b/app/views/new_user/dossiers/demande.html.haml index 59dbaef91..623a8ac54 100644 --- a/app/views/new_user/dossiers/demande.html.haml +++ b/app/views/new_user/dossiers/demande.html.haml @@ -1,7 +1,7 @@ - content_for(:title, "Demande · Dossier nº #{@dossier.id} (#{@dossier.procedure.libelle})") - content_for :footer do - = render partial: "new_user/dossiers/footer", locals: { dossier: @dossier } + = render partial: "new_user/dossiers/dossier_footer", locals: { dossier: @dossier } #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 920184db9..e4a5cc412 100644 --- a/app/views/new_user/dossiers/identite.html.haml +++ b/app/views/new_user/dossiers/identite.html.haml @@ -1,7 +1,7 @@ - content_for(:title, "Nouveau dossier (#{@dossier.procedure.libelle})") - content_for :footer do - = render partial: "new_user/dossiers/footer", locals: { dossier: @dossier } + = render partial: "new_user/dossiers/dossier_footer", locals: { dossier: @dossier } .two-columns .columns-container diff --git a/app/views/new_user/dossiers/messagerie.html.haml b/app/views/new_user/dossiers/messagerie.html.haml index 2bb4a266b..9cac5fe77 100644 --- a/app/views/new_user/dossiers/messagerie.html.haml +++ b/app/views/new_user/dossiers/messagerie.html.haml @@ -1,7 +1,7 @@ - content_for(:title, "Messagerie · Dossier nº #{@dossier.id} (#{@dossier.procedure.libelle})") - content_for :footer do - = render partial: "new_user/dossiers/footer", locals: { dossier: @dossier } + = render partial: "new_user/dossiers/dossier_footer", locals: { dossier: @dossier } #dossier-show = render partial: 'new_user/dossiers/show/header', locals: { dossier: @dossier } diff --git a/app/views/new_user/dossiers/modifier.html.haml b/app/views/new_user/dossiers/modifier.html.haml index 49fcfd759..7341db4fd 100644 --- a/app/views/new_user/dossiers/modifier.html.haml +++ b/app/views/new_user/dossiers/modifier.html.haml @@ -1,7 +1,7 @@ - content_for(:title, "Modifier · Dossier nº #{@dossier.id} (#{@dossier.procedure.libelle})") - content_for :footer do - = render partial: "new_user/dossiers/footer", locals: { dossier: @dossier } + = render partial: "new_user/dossiers/dossier_footer", locals: { dossier: @dossier } #dossier-show = render partial: 'new_user/dossiers/show/header', locals: { dossier: @dossier } diff --git a/app/views/new_user/dossiers/show.html.haml b/app/views/new_user/dossiers/show.html.haml index 2577650d3..d87e4dd0c 100644 --- a/app/views/new_user/dossiers/show.html.haml +++ b/app/views/new_user/dossiers/show.html.haml @@ -1,7 +1,7 @@ - content_for(:title, "Résumé · Dossier nº #{@dossier.id} (#{@dossier.procedure.libelle})") - content_for :footer do - = render partial: "new_user/dossiers/footer", locals: { dossier: @dossier } + = render partial: "new_user/dossiers/dossier_footer", locals: { dossier: @dossier } #dossier-show = render partial: 'new_user/dossiers/show/header', locals: { dossier: @dossier } diff --git a/spec/views/new_user/dossiers/_footer.html.haml_spec.rb b/spec/views/new_user/dossiers/_dossier_footer.html.haml_spec.rb similarity index 83% rename from spec/views/new_user/dossiers/_footer.html.haml_spec.rb rename to spec/views/new_user/dossiers/_dossier_footer.html.haml_spec.rb index d840c876e..21ef07687 100644 --- a/spec/views/new_user/dossiers/_footer.html.haml_spec.rb +++ b/spec/views/new_user/dossiers/_dossier_footer.html.haml_spec.rb @@ -1,4 +1,4 @@ -describe 'new_user/dossiers/_footer.html.haml', type: :view do +describe 'new_user/dossiers/_dossier_footer.html.haml', type: :view do let(:service) { create(:service) } let(:dossier) { dossier = create(:dossier) @@ -6,7 +6,7 @@ describe 'new_user/dossiers/_footer.html.haml', type: :view do return dossier } - subject { render 'new_user/dossiers/footer.html.haml', dossier: dossier } + subject { render 'new_user/dossiers/dossier_footer.html.haml', dossier: dossier } it "affiche les informations de contact" do expect(subject).to have_text(service.nom) From 5166b791677251b3ac9bcc183873795b17c29161 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 12 Sep 2018 13:27:42 +0200 Subject: [PATCH 05/19] Extract the general footer row in a partial --- app/views/new_user/dossiers/_dossier_footer.html.haml | 8 +------- app/views/new_user/dossiers/_general_footer_row.html.haml | 7 +++++++ 2 files changed, 8 insertions(+), 7 deletions(-) create mode 100644 app/views/new_user/dossiers/_general_footer_row.html.haml diff --git a/app/views/new_user/dossiers/_dossier_footer.html.haml b/app/views/new_user/dossiers/_dossier_footer.html.haml index 95c0aa129..b4fce7631 100644 --- a/app/views/new_user/dossiers/_dossier_footer.html.haml +++ b/app/views/new_user/dossiers/_dossier_footer.html.haml @@ -36,10 +36,4 @@ %p= politique .footer-row.footer-bottom-line - = link_to "Accessibilité", accessibilite_index_path, :class => "footer-link" - – - = link_to "CGU", CGU_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer" - – - = link_to "Mentions légales", MENTIONS_LEGALES_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer" - – - = contact_link "Contact technique", class: "footer-link", dossier_id: dossier.id + = render partial: "new_user/dossiers/general_footer_row", locals: { dossier: @dossier } diff --git a/app/views/new_user/dossiers/_general_footer_row.html.haml b/app/views/new_user/dossiers/_general_footer_row.html.haml new file mode 100644 index 000000000..351e87ba4 --- /dev/null +++ b/app/views/new_user/dossiers/_general_footer_row.html.haml @@ -0,0 +1,7 @@ += link_to "Accessibilité", accessibilite_index_path, :class => "footer-link" +– += link_to "CGU", CGU_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer" +– += link_to "Mentions légales", MENTIONS_LEGALES_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer" +– += contact_link "Contact technique", class: "footer-link", dossier_id: dossier.id From 1f6870cd5e371d53b51cd83becbd5e62b1004a2b Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 12 Sep 2018 13:29:15 +0200 Subject: [PATCH 06/19] Display a footer in the dossiers index page --- app/views/new_user/dossiers/_general_footer_row.html.haml | 2 +- app/views/new_user/dossiers/_index_footer.html.haml | 4 ++++ app/views/new_user/dossiers/index.html.haml | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 app/views/new_user/dossiers/_index_footer.html.haml diff --git a/app/views/new_user/dossiers/_general_footer_row.html.haml b/app/views/new_user/dossiers/_general_footer_row.html.haml index 351e87ba4..de46e2cc4 100644 --- a/app/views/new_user/dossiers/_general_footer_row.html.haml +++ b/app/views/new_user/dossiers/_general_footer_row.html.haml @@ -4,4 +4,4 @@ – = link_to "Mentions légales", MENTIONS_LEGALES_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer" – -= contact_link "Contact technique", class: "footer-link", dossier_id: dossier.id += contact_link "Contact technique", class: "footer-link", dossier_id: dossier&.id diff --git a/app/views/new_user/dossiers/_index_footer.html.haml b/app/views/new_user/dossiers/_index_footer.html.haml new file mode 100644 index 000000000..241ba25d7 --- /dev/null +++ b/app/views/new_user/dossiers/_index_footer.html.haml @@ -0,0 +1,4 @@ +%footer.dossier-footer + .container + .footer-row.footer-bottom-line + = render partial: "new_user/dossiers/general_footer_row", locals: { dossier: nil } diff --git a/app/views/new_user/dossiers/index.html.haml b/app/views/new_user/dossiers/index.html.haml index e37d78286..c625952a7 100644 --- a/app/views/new_user/dossiers/index.html.haml +++ b/app/views/new_user/dossiers/index.html.haml @@ -1,5 +1,8 @@ - content_for(:title, "Dossiers") +- content_for :footer do + = render partial: "new_user/dossiers/index_footer" + .dossiers-headers.sub-header .container = link_to "Commencer une nouvelle démarche", new_demarche_url, class: "button secondary new-demarche" From 9fe9f9b6167c901e19479f2a39a7921728ad7ae9 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Thu, 13 Sep 2018 16:13:54 +0200 Subject: [PATCH 07/19] Add a new demarches page, showing the demarches already done --- .../new_design/demarches_index.scss | 28 +++++++++++++++++++ .../new_user/demarches_controller.rb | 12 ++++++++ app/views/new_user/demarches/index.html.haml | 11 ++++++++ config/routes.rb | 1 + 4 files changed, 52 insertions(+) create mode 100644 app/assets/stylesheets/new_design/demarches_index.scss create mode 100644 app/controllers/new_user/demarches_controller.rb create mode 100644 app/views/new_user/demarches/index.html.haml diff --git a/app/assets/stylesheets/new_design/demarches_index.scss b/app/assets/stylesheets/new_design/demarches_index.scss new file mode 100644 index 000000000..62e8123bb --- /dev/null +++ b/app/assets/stylesheets/new_design/demarches_index.scss @@ -0,0 +1,28 @@ +@import "colors"; + +.page-title { + margin-top: 30px; + margin-bottom: 30px; +} + +.list-header { + color: $grey; + font-weight: bold; + margin-bottom: 10px; +} + +.demarche-links { + border-top: 1px solid $border-grey; + margin-bottom: 30px; +} + +.demarche-link { + display: block; + padding: 10px; + border-bottom: 1px solid $border-grey; + width: 100%; + + &:hover { + background-color: $lighter-blue; + } +} diff --git a/app/controllers/new_user/demarches_controller.rb b/app/controllers/new_user/demarches_controller.rb new file mode 100644 index 000000000..29b0a85c9 --- /dev/null +++ b/app/controllers/new_user/demarches_controller.rb @@ -0,0 +1,12 @@ +module NewUser + class DemarchesController < UserController + def index + @previous_demarches_still_active = current_user + .dossiers + .includes(:procedure) + .map(&:procedure) + .uniq + .select { |p| p.publiee? } + end + end +end diff --git a/app/views/new_user/demarches/index.html.haml b/app/views/new_user/demarches/index.html.haml new file mode 100644 index 000000000..2fc77c73e --- /dev/null +++ b/app/views/new_user/demarches/index.html.haml @@ -0,0 +1,11 @@ +- content_for(:title, "Démarches") + +.container + %h1.page-title Démarches + + - if @previous_demarches_still_active.present? + %h2.list-header SUR LESQUELLES VOUS AVEZ DÉJÀ DÉPOSÉ UN DOSSIER + %ul.demarche-links + - @previous_demarches_still_active.each do |demarche| + %li + = link_to(demarche.libelle, commencer_url(procedure_path: demarche.path), class: "demarche-link") diff --git a/config/routes.rb b/config/routes.rb index 12b5dab91..4651f88bd 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -292,6 +292,7 @@ Rails.application.routes.draw do end end resource :feedback, only: [:create] + get 'demarches' => 'demarches#index' end # From 523fdb5d45c468059eca0046bab468812358c367 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Mon, 10 Sep 2018 20:36:57 +0200 Subject: [PATCH 08/19] Add a link to the page with all the demarches --- app/views/new_user/demarches/index.html.haml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/views/new_user/demarches/index.html.haml b/app/views/new_user/demarches/index.html.haml index 2fc77c73e..bb50b4225 100644 --- a/app/views/new_user/demarches/index.html.haml +++ b/app/views/new_user/demarches/index.html.haml @@ -9,3 +9,6 @@ - @previous_demarches_still_active.each do |demarche| %li = link_to(demarche.libelle, commencer_url(procedure_path: demarche.path), class: "demarche-link") + + %h2.list-header TOUTES LES DÉMARCHES + = link_to("Voir l'intégralité des démarches disponibles", LISTE_DES_DEMARCHES_URL, class: "button") From aba0c1dcd61c79b69be9fb652df4a3afe2981206 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Tue, 11 Sep 2018 00:16:30 +0200 Subject: [PATCH 09/19] Add links to the most popular demarches --- app/controllers/new_user/demarches_controller.rb | 9 +++++++++ app/views/new_user/demarches/index.html.haml | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/app/controllers/new_user/demarches_controller.rb b/app/controllers/new_user/demarches_controller.rb index 29b0a85c9..56c984dd6 100644 --- a/app/controllers/new_user/demarches_controller.rb +++ b/app/controllers/new_user/demarches_controller.rb @@ -7,6 +7,15 @@ module NewUser .map(&:procedure) .uniq .select { |p| p.publiee? } + + @popular_demarches = Procedure + .select("procedures.*, COUNT(*) AS procedures_count") + .joins(:dossiers) + .publiees + .where(dossiers: { created_at: 7.days.ago..Time.now }) + .group("procedures.id") + .order("procedures_count DESC") + .limit(5) end end end diff --git a/app/views/new_user/demarches/index.html.haml b/app/views/new_user/demarches/index.html.haml index bb50b4225..6bf68beed 100644 --- a/app/views/new_user/demarches/index.html.haml +++ b/app/views/new_user/demarches/index.html.haml @@ -10,5 +10,12 @@ %li = link_to(demarche.libelle, commencer_url(procedure_path: demarche.path), class: "demarche-link") + - if @popular_demarches.present? + %h2.list-header LES PLUS POPULAIRES + %ul.demarche-links + - @popular_demarches.each do |demarche| + %li + = link_to(demarche.libelle, commencer_url(procedure_path: demarche.path), class: "demarche-link") + %h2.list-header TOUTES LES DÉMARCHES = link_to("Voir l'intégralité des démarches disponibles", LISTE_DES_DEMARCHES_URL, class: "button") From 118ba12d2b5be94ec3f7bc16aee065d40cbe230c Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Thu, 13 Sep 2018 16:07:46 +0200 Subject: [PATCH 10/19] Add a footer to the new demarches page --- app/views/new_user/demarches/index.html.haml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/views/new_user/demarches/index.html.haml b/app/views/new_user/demarches/index.html.haml index 6bf68beed..b36ae9a9d 100644 --- a/app/views/new_user/demarches/index.html.haml +++ b/app/views/new_user/demarches/index.html.haml @@ -1,5 +1,8 @@ - content_for(:title, "Démarches") +- content_for :footer do + = render partial: "new_user/dossiers/index_footer" + .container %h1.page-title Démarches From 734efd08227f3bbe1e28dc870cab733bef1d8c1b Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Thu, 13 Sep 2018 16:15:45 +0200 Subject: [PATCH 11/19] Scope the new demarche page to add space before the footer --- .../new_design/demarches_index.scss | 4 +++ app/views/new_user/demarches/index.html.haml | 33 ++++++++++--------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/app/assets/stylesheets/new_design/demarches_index.scss b/app/assets/stylesheets/new_design/demarches_index.scss index 62e8123bb..e14441051 100644 --- a/app/assets/stylesheets/new_design/demarches_index.scss +++ b/app/assets/stylesheets/new_design/demarches_index.scss @@ -1,5 +1,9 @@ @import "colors"; +#demarches-index { + margin-bottom: 30px; +} + .page-title { margin-top: 30px; margin-bottom: 30px; diff --git a/app/views/new_user/demarches/index.html.haml b/app/views/new_user/demarches/index.html.haml index b36ae9a9d..c7ccaef2c 100644 --- a/app/views/new_user/demarches/index.html.haml +++ b/app/views/new_user/demarches/index.html.haml @@ -3,22 +3,23 @@ - content_for :footer do = render partial: "new_user/dossiers/index_footer" -.container - %h1.page-title Démarches +#demarches-index + .container + %h1.page-title Démarches - - if @previous_demarches_still_active.present? - %h2.list-header SUR LESQUELLES VOUS AVEZ DÉJÀ DÉPOSÉ UN DOSSIER - %ul.demarche-links - - @previous_demarches_still_active.each do |demarche| - %li - = link_to(demarche.libelle, commencer_url(procedure_path: demarche.path), class: "demarche-link") + - if @previous_demarches_still_active.present? + %h2.list-header SUR LESQUELLES VOUS AVEZ DÉJÀ DÉPOSÉ UN DOSSIER + %ul.demarche-links + - @previous_demarches_still_active.each do |demarche| + %li + = link_to(demarche.libelle, commencer_url(procedure_path: demarche.path), class: "demarche-link") - - if @popular_demarches.present? - %h2.list-header LES PLUS POPULAIRES - %ul.demarche-links - - @popular_demarches.each do |demarche| - %li - = link_to(demarche.libelle, commencer_url(procedure_path: demarche.path), class: "demarche-link") + - if @popular_demarches.present? + %h2.list-header LES PLUS POPULAIRES + %ul.demarche-links + - @popular_demarches.each do |demarche| + %li + = link_to(demarche.libelle, commencer_url(procedure_path: demarche.path), class: "demarche-link") - %h2.list-header TOUTES LES DÉMARCHES - = link_to("Voir l'intégralité des démarches disponibles", LISTE_DES_DEMARCHES_URL, class: "button") + %h2.list-header TOUTES LES DÉMARCHES + = link_to("Voir l'intégralité des démarches disponibles", LISTE_DES_DEMARCHES_URL, class: "button") From 747992025b67a7ee311bf6bfbc1edee0d398cd2a Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Mon, 10 Sep 2018 20:38:33 +0200 Subject: [PATCH 12/19] 'Create a new demarche' links now point to the demarches page --- app/views/new_user/dossiers/index.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/new_user/dossiers/index.html.haml b/app/views/new_user/dossiers/index.html.haml index c625952a7..40c6189c7 100644 --- a/app/views/new_user/dossiers/index.html.haml +++ b/app/views/new_user/dossiers/index.html.haml @@ -5,7 +5,7 @@ .dossiers-headers.sub-header .container - = link_to "Commencer une nouvelle démarche", new_demarche_url, class: "button secondary new-demarche" + = link_to "Commencer une nouvelle démarche", demarches_url, class: "button secondary new-demarche" - if @dossiers_invites.count == 0 %h1.page-title Mes dossiers @@ -66,4 +66,4 @@ .dossiers-table-empty %h2.empty-text Aucun dossier. %p.empty-text-details Vous n’avez pas encore commencé de démarche. - = link_to "Commencer une nouvelle démarche", new_demarche_url, class: "button primary" + = link_to "Commencer une nouvelle démarche", demarches_url, class: "button primary" From cac202342a8fa021ec6d97fa1ea5910bad75d268 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Mon, 10 Sep 2018 20:36:47 +0200 Subject: [PATCH 13/19] Remove a new useless helper --- app/controllers/new_user/dossiers_controller.rb | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/controllers/new_user/dossiers_controller.rb b/app/controllers/new_user/dossiers_controller.rb index d602695f5..ce5023b9f 100644 --- a/app/controllers/new_user/dossiers_controller.rb +++ b/app/controllers/new_user/dossiers_controller.rb @@ -2,8 +2,6 @@ module NewUser class DossiersController < UserController include DossierHelper - helper_method :new_demarche_url - before_action :ensure_ownership!, except: [:index, :show, :demande, :messagerie, :brouillon, :update_brouillon, :modifier, :update, :recherche] before_action :ensure_ownership_or_invitation!, only: [:show, :demande, :messagerie, :brouillon, :update_brouillon, :modifier, :update, :create_commentaire] before_action :ensure_dossier_can_be_updated, only: [:update_identite, :update_brouillon, :modifier, :update] @@ -177,10 +175,6 @@ module NewUser end end - def new_demarche_url - "https://doc.demarches-simplifiees.fr/listes-des-demarches" - end - private def ensure_dossier_can_be_updated 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 14/19] 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 15/19] 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 16/19] 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 17/19] 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 18/19] 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 From 1b6e49b49e124112d6dde1037affe28e1eda7740 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 12 Sep 2018 17:57:00 +0200 Subject: [PATCH 19/19] [Fix #2544] Add a task to fix now invalid templates --- lib/tasks/2018_09_12_fix_templates.rake | 75 +++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 lib/tasks/2018_09_12_fix_templates.rake diff --git a/lib/tasks/2018_09_12_fix_templates.rake b/lib/tasks/2018_09_12_fix_templates.rake new file mode 100644 index 000000000..4d29f4035 --- /dev/null +++ b/lib/tasks/2018_09_12_fix_templates.rake @@ -0,0 +1,75 @@ +namespace :'2018_09_12_fix_templates' do + task run: :environment do + dossiers_with_invalid_attestations = find_dossiers_with_sent_and_invalid_attestations + fix_templates + fixed_attestations = regenerate_attestations(dossiers_with_invalid_attestations) + send_regenerated_attestations(dossiers_with_invalid_attestations) + end + + # 16:15 in Paris -> 14:15 UTC + DEPLOY_DATETIME = DateTime.new(2018, 9, 5, 14, 15, 0) + + def find_dossiers_with_sent_and_invalid_attestations + invalid_procedures_ids = AttestationTemplate + .where("body LIKE '%--libellé procédure--%'") + .pluck(:procedure_id) + + dossiers_with_invalid_template_ids = Dossier + .where(procedure_id: invalid_procedures_ids) + .where(processed_at: DEPLOY_DATETIME..Time.now) + .pluck(:id) + + Attestation + .includes(:dossier) + .where(created_at: DEPLOY_DATETIME..Time.now) + .where(dossier_id: dossiers_with_invalid_template_ids) + .map(&:dossier) + end + + def fix_templates + klasses = [ + Mails::ClosedMail, + Mails::InitiatedMail, + Mails::ReceivedMail, + Mails::RefusedMail, + Mails::WithoutContinuationMail, + AttestationTemplate + ] + + klasses.each do |klass| + klass + .where("body LIKE '%--libellé procédure--%'") + .each do |instance| + + instance.update(body: instance.body.gsub("--libellé procédure--", "--libellé démarche--")) + rake_puts "Body mis-à-jour pour #{klass.to_s}##{instance.id}" + end + end + end + + def delete_then_regenerate_attestations(dossiers_with_invalid_attestations) + dossiers_with_invalid_attestations.each do |dossier| + begin + dossier.attestation.destroy + + dossier.attestation = dossier.build_attestation + dossier.save + + rake_puts "Attestation regénérée pour le dossier #{dossier.id}" + rescue + rake_puts "Erreur lors de la régénération de l'attestation pour le dossier #{dossier.id}" + end + end + end + + def send_regenerated_attestations(dossiers_with_invalid_attestations) + dossiers_with_invalid_attestations.each do |dossier| + begin + ResendAttestationMailer.resend_attestation(dossier).deliver_later + rake_puts "Email envoyé à #{dossier.user.email} pour le dossier #{dossier.id}" + rescue + rake_puts "Erreur lors de l'envoi de l'email à #{dossier.user.email} pour le dossier #{dossier.id}" + end + end + end +end