From 0d7c30c9dd27d051c4e1d7d60eb8f89378913b57 Mon Sep 17 00:00:00 2001 From: pedong Date: Mon, 25 Mar 2019 16:04:33 +0100 Subject: [PATCH 01/11] [fix #3476] add notify email for the dossier change state to instruction --- app/controllers/manager/dossiers_controller.rb | 1 + app/mailers/dossier_mailer.rb | 7 +++++++ .../notify_revert_to_instruction.html.haml | 16 ++++++++++++++++ spec/mailers/previews/dossier_mailer_preview.rb | 4 ++++ 4 files changed, 28 insertions(+) create mode 100644 app/views/dossier_mailer/notify_revert_to_instruction.html.haml diff --git a/app/controllers/manager/dossiers_controller.rb b/app/controllers/manager/dossiers_controller.rb index 4407d2323..0372f579d 100644 --- a/app/controllers/manager/dossiers_controller.rb +++ b/app/controllers/manager/dossiers_controller.rb @@ -26,6 +26,7 @@ module Manager dossier.attestation&.destroy logger.info("Le dossier #{dossier.id} est repassé en instruction par #{current_administration.email}") flash[:notice] = "Le dossier #{dossier.id} est repassé en instruction" + DossierMailer.notify_revert_to_instruction(dossier).deliver_later redirect_to manager_dossier_path(dossier) end diff --git a/app/mailers/dossier_mailer.rb b/app/mailers/dossier_mailer.rb index 2a9129e83..a26caff85 100644 --- a/app/mailers/dossier_mailer.rb +++ b/app/mailers/dossier_mailer.rb @@ -55,4 +55,11 @@ class DossierMailer < ApplicationMailer mail(to: dossier.user.email, subject: @subject) end + + def notify_revert_to_instruction(dossier) + @dossier = dossier + @subject = "Votre dossier n° #{@dossier.id} est en train d'être réexaminé" + + mail(to: dossier.user.email, subject: @subject) + end end diff --git a/app/views/dossier_mailer/notify_revert_to_instruction.html.haml b/app/views/dossier_mailer/notify_revert_to_instruction.html.haml new file mode 100644 index 000000000..06518948e --- /dev/null +++ b/app/views/dossier_mailer/notify_revert_to_instruction.html.haml @@ -0,0 +1,16 @@ +%p + Bonjour, + +%p + Votre dossier va être réexaminé, la précédente décision sur ce dossier est caduque. + Vous pouvez retrouver le dossier que vous avez créé pour la démarche + %strong= @dossier.procedure.libelle + à l'adresse suivante : + = link_to dossier_url(@dossier), dossier_url(@dossier), target: '_blank', rel: 'noopener' +- if @dossier.procedure.service.present? + %p + Pour obtenir le détail de cette modification de la décision, vous pouvez contacter par + email: + = mail_to @dossier.procedure.service.email, @dossier.procedure.service.email + += render partial: "layouts/mailers/signature" diff --git a/spec/mailers/previews/dossier_mailer_preview.rb b/spec/mailers/previews/dossier_mailer_preview.rb index b914b27c5..d34d4f0e6 100644 --- a/spec/mailers/previews/dossier_mailer_preview.rb +++ b/spec/mailers/previews/dossier_mailer_preview.rb @@ -16,6 +16,10 @@ class DossierMailerPreview < ActionMailer::Preview DossierMailer.notify_deletion_to_administration(deleted_dossier, "admin@ds.fr") end + def notify_revert_to_instruction + DossierMailer.notify_revert_to_instruction(dossier) + end + private def deleted_dossier From f229688988457aa71cebe6f2ab1ccd36889a6ba7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chai=CC=88b=20Martinez?= Date: Fri, 15 Mar 2019 14:35:10 +0100 Subject: [PATCH 02/11] Add sendinblue JS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Chaïb Martinez --- app/views/layouts/_sendinblue.html.haml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 app/views/layouts/_sendinblue.html.haml diff --git a/app/views/layouts/_sendinblue.html.haml b/app/views/layouts/_sendinblue.html.haml new file mode 100644 index 000000000..280ba4742 --- /dev/null +++ b/app/views/layouts/_sendinblue.html.haml @@ -0,0 +1,17 @@ +:javascript + (function() { + window.sib = { equeue: [], client_key: "pcxtf4lpkka986pf4l1kt" }; + /* OPTIONAL: email for identify request*/ + window.sib.email_id = '#{current_administrateur.email}'; + window.sendinblue = {}; for (var j = ['track', 'identify', 'trackLink', 'page'], i = 0; i < j.length; i++) { (function(k) { window.sendinblue[k] = function() { var arg = Array.prototype.slice.call(arguments); (window.sib[k] || function() { var t = {}; t[k] = arg; window.sib.equeue.push(t);})(arg[0], arg[1], arg[2]);};})(j[i]);}var n = document.createElement("script"),i = document.getElementsByTagName("script")[0]; n.type = "text/javascript", n.id = "sendinblue-js", n.async = !0, n.src = "https://sibautomation.com/sa.js?key=" + window.sib.client_key, i.parentNode.insertBefore(n, i), window.sendinblue.page(); + })(); + + sendinblue.identify('#{current_administrateur.email}', { + 'DS_NB_DEMARCHES_BROUILLONS': '#{current_administrateur.procedures.brouillons.count}', + 'DS_NB_DEMARCHES_ACTIVES': '#{current_administrateur.procedures.publiees.count}', + 'DS_NB_DEMARCHES_ARCHIVES': '#{current_administrateur.procedures.archivees.count}', + 'DS_SIGN_IN_COUNT' : '#{current_administrateur.sign_in_count}', + 'DS_CREATED_AT' : '#{current_administrateur.created_at}', + 'DS_ACTIVE' : '#{current_administrateur.active}', + 'DS_ID' : '#{current_administrateur.id}' + }); \ No newline at end of file From 9968d24af6618220ebc67e606368d6409b0d55eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chai=CC=88b=20Martinez?= Date: Fri, 15 Mar 2019 14:38:12 +0100 Subject: [PATCH 03/11] Remove old sendinblue interface through JavaScript [fix #3622] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Chaïb Martinez --- app/views/layouts/application.html.haml | 2 ++ app/views/layouts/application_old.html.haml | 1 + 2 files changed, 3 insertions(+) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 033ec625c..0d59a2c6c 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -22,6 +22,8 @@ = stylesheet_link_tag :xray = render partial: "layouts/matomo" + = render partial: "layouts/sendinblue" + :javascript DATA = [{ diff --git a/app/views/layouts/application_old.html.haml b/app/views/layouts/application_old.html.haml index 5b1b9cb21..a5a6a67b8 100644 --- a/app/views/layouts/application_old.html.haml +++ b/app/views/layouts/application_old.html.haml @@ -17,6 +17,7 @@ = csrf_meta_tags = render partial: "layouts/matomo" + = render partial: "layouts/sendinblue" :javascript DATA = [{ From dae51ced745a10d335e4c0eec347527c18895a41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chai=CC=88b=20Martinez?= Date: Mon, 18 Mar 2019 16:34:13 +0100 Subject: [PATCH 04/11] Add Sendinblue js tracking for admin logged users MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Chaïb Martinez --- app/views/layouts/application.html.haml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 0d59a2c6c..8dae66ea3 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -22,7 +22,8 @@ = stylesheet_link_tag :xray = render partial: "layouts/matomo" - = render partial: "layouts/sendinblue" + - if administrateur_signed_in? + = render partial: "layouts/sendinblue" :javascript From bad5822bf3bbd249551bdd3e2bb4fdb995573df4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chai=CC=88b=20Martinez?= Date: Mon, 18 Mar 2019 16:34:49 +0100 Subject: [PATCH 05/11] Remove useless variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Chaïb Martinez --- app/views/layouts/_sendinblue.html.haml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/views/layouts/_sendinblue.html.haml b/app/views/layouts/_sendinblue.html.haml index 280ba4742..5966e0503 100644 --- a/app/views/layouts/_sendinblue.html.haml +++ b/app/views/layouts/_sendinblue.html.haml @@ -1,15 +1,12 @@ :javascript (function() { - window.sib = { equeue: [], client_key: "pcxtf4lpkka986pf4l1kt" }; + window.sib = { equeue: [], client_key: "#{Rails.application.secrets.sendinblue[:client_key]}" }; /* OPTIONAL: email for identify request*/ window.sib.email_id = '#{current_administrateur.email}'; window.sendinblue = {}; for (var j = ['track', 'identify', 'trackLink', 'page'], i = 0; i < j.length; i++) { (function(k) { window.sendinblue[k] = function() { var arg = Array.prototype.slice.call(arguments); (window.sib[k] || function() { var t = {}; t[k] = arg; window.sib.equeue.push(t);})(arg[0], arg[1], arg[2]);};})(j[i]);}var n = document.createElement("script"),i = document.getElementsByTagName("script")[0]; n.type = "text/javascript", n.id = "sendinblue-js", n.async = !0, n.src = "https://sibautomation.com/sa.js?key=" + window.sib.client_key, i.parentNode.insertBefore(n, i), window.sendinblue.page(); })(); sendinblue.identify('#{current_administrateur.email}', { - 'DS_NB_DEMARCHES_BROUILLONS': '#{current_administrateur.procedures.brouillons.count}', - 'DS_NB_DEMARCHES_ACTIVES': '#{current_administrateur.procedures.publiees.count}', - 'DS_NB_DEMARCHES_ARCHIVES': '#{current_administrateur.procedures.archivees.count}', 'DS_SIGN_IN_COUNT' : '#{current_administrateur.sign_in_count}', 'DS_CREATED_AT' : '#{current_administrateur.created_at}', 'DS_ACTIVE' : '#{current_administrateur.active}', From dc220dc3625edc675f0bbea91d3f1dbc658b185e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chai=CC=88b=20Martinez?= Date: Fri, 22 Mar 2019 10:08:49 +0100 Subject: [PATCH 06/11] lint fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Chaïb Martinez --- app/views/layouts/_sendinblue.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/_sendinblue.html.haml b/app/views/layouts/_sendinblue.html.haml index 5966e0503..283100cc8 100644 --- a/app/views/layouts/_sendinblue.html.haml +++ b/app/views/layouts/_sendinblue.html.haml @@ -11,4 +11,4 @@ 'DS_CREATED_AT' : '#{current_administrateur.created_at}', 'DS_ACTIVE' : '#{current_administrateur.active}', 'DS_ID' : '#{current_administrateur.id}' - }); \ No newline at end of file + }); From caadf5667ac5a9fc3dc4b6c82f16c89c52e9f054 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chai=CC=88b=20Martinez?= Date: Fri, 15 Mar 2019 16:37:56 +0100 Subject: [PATCH 07/11] Minor text changes in new admin email [fix #3628] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Chaïb Martinez --- .../invite_admin.html.haml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/app/views/administration_mailer/invite_admin.html.haml b/app/views/administration_mailer/invite_admin.html.haml index a3e52ba41..f646d2946 100644 --- a/app/views/administration_mailer/invite_admin.html.haml +++ b/app/views/administration_mailer/invite_admin.html.haml @@ -14,22 +14,5 @@ Pour l’activer, cliquez sur le lien suivant : = link_to(admin_activate_url(token: @reset_password_token), admin_activate_url(token: @reset_password_token)) -%p - Afin de vous accompagner dans la découverte de demarches-simplifiees.fr, je vous propose de m’appeler pour faire un point sur vos besoins de dématérialisation. - %br - Vous pouvez me joindre au numéro suivant : - = link_to(CONTACT_PHONE, "tel:#{CONTACT_PHONE}") - \. - -%p - Je vous invite également à prendre quelques minutes pour consulter notre tutoriel à destination des nouveaux administrateurs : - = link_to(ADMINISTRATEUR_TUTORIAL_URL, ADMINISTRATEUR_TUTORIAL_URL) - \. - -%p - Enfin, vous pouvez vous inscrire à notre prochain webinaire en ligne pour découvrir les fonctionnalités de notre outil : - = link_to(WEBINAIRE_URL, WEBINAIRE_URL) - \. - %p = render partial: "layouts/mailers/bizdev_signature", locals: { author_name: @author_name } From 30d11e0dacdbcfc352da04ba8f74db04650d8164 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 25 Mar 2019 15:54:46 +0000 Subject: [PATCH 08/11] app: rename `new_gestionnaire` to `gestionnaires` --- .../avis_controller.rb | 2 +- .../dossiers_controller.rb | 2 +- .../gestionnaire_controller.rb | 2 +- .../procedures_controller.rb | 2 +- .../recherche_controller.rb | 2 +- .../_help_dropdown.html.haml | 0 .../avis/_header.html.haml | 0 .../avis/index.html.haml | 10 +++++----- .../avis/instruction.html.haml | 4 ++-- .../avis/messagerie.html.haml | 0 .../avis/show.html.haml | 0 .../avis/sign_up.html.haml | 2 +- .../dossiers/_envoyer_dossier_block.html.haml | 0 .../dossiers/_header.html.haml | 2 +- .../dossiers/_personnes_impliquees_block.html.haml | 0 .../dossiers/_state_button.html.haml | 6 +++--- .../dossiers/_state_button_motivation.html.haml | 0 .../dossiers/_state_button_refresh.js.erb | 0 .../dossiers/annotations_privees.html.haml | 0 .../dossiers/avis.html.haml | 4 ++-- .../dossiers/messagerie.html.haml | 0 .../dossiers/personnes_impliquees.html.haml | 12 ++++++++++++ .../dossiers/print.html.haml | 0 .../dossiers/purge_champ_piece_justificative.js.erb | 0 .../dossiers/show.html.haml | 0 .../procedures/_dossier_actions.html.haml | 0 .../procedures/_download_dossiers.html.haml | 0 .../procedures/_header_field.html.haml | 0 .../procedures/email_notifications.html.haml | 0 .../procedures/index.html.haml | 0 .../procedures/show.html.haml | 0 .../recherche/index.html.haml | 2 +- .../shared/avis/_form.html.haml | 0 .../shared/avis/_list.html.haml | 0 app/views/layouts/_new_header.haml | 2 +- .../dossiers/personnes_impliquees.html.haml | 12 ------------ config/routes.rb | 2 +- .../avis_controller_spec.rb | 2 +- .../dossiers_controller_spec.rb | 2 +- .../gestionnaire_controller_spec.rb | 4 ++-- .../procedures_controller_spec.rb | 6 +++--- .../recherche_controller_spec.rb | 2 +- .../gestionnaire_spec.rb | 0 .../procedure_filters_spec.rb | 0 .../avis/instruction.html.haml_spec.rb | 2 +- .../_envoyer_dossier_block.html.haml_spec.rb | 4 ++-- .../_state_button_motivation.html.haml_spec.rb | 4 ++-- .../dossiers/print.html.haml_spec.rb | 2 +- .../dossiers/show.html.haml_spec.rb | 2 +- .../procedures/_download_dossiers.html.haml_spec.rb | 4 ++-- .../shared/avis/list.html.haml_spec.rb | 4 ++-- 51 files changed, 53 insertions(+), 53 deletions(-) rename app/controllers/{new_gestionnaire => gestionnaires}/avis_controller.rb (99%) rename app/controllers/{new_gestionnaire => gestionnaires}/dossiers_controller.rb (99%) rename app/controllers/{new_gestionnaire => gestionnaires}/gestionnaire_controller.rb (87%) rename app/controllers/{new_gestionnaire => gestionnaires}/procedures_controller.rb (99%) rename app/controllers/{new_gestionnaire => gestionnaires}/recherche_controller.rb (94%) rename app/views/{new_gestionnaire => gestionnaires}/_help_dropdown.html.haml (100%) rename app/views/{new_gestionnaire => gestionnaires}/avis/_header.html.haml (100%) rename app/views/{new_gestionnaire => gestionnaires}/avis/index.html.haml (69%) rename app/views/{new_gestionnaire => gestionnaires}/avis/instruction.html.haml (78%) rename app/views/{new_gestionnaire => gestionnaires}/avis/messagerie.html.haml (100%) rename app/views/{new_gestionnaire => gestionnaires}/avis/show.html.haml (100%) rename app/views/{new_gestionnaire => gestionnaires}/avis/sign_up.html.haml (77%) rename app/views/{new_gestionnaire => gestionnaires}/dossiers/_envoyer_dossier_block.html.haml (100%) rename app/views/{new_gestionnaire => gestionnaires}/dossiers/_header.html.haml (91%) rename app/views/{new_gestionnaire => gestionnaires}/dossiers/_personnes_impliquees_block.html.haml (100%) rename app/views/{new_gestionnaire => gestionnaires}/dossiers/_state_button.html.haml (73%) rename app/views/{new_gestionnaire => gestionnaires}/dossiers/_state_button_motivation.html.haml (100%) rename app/views/{new_gestionnaire => gestionnaires}/dossiers/_state_button_refresh.js.erb (100%) rename app/views/{new_gestionnaire => gestionnaires}/dossiers/annotations_privees.html.haml (100%) rename app/views/{new_gestionnaire => gestionnaires}/dossiers/avis.html.haml (56%) rename app/views/{new_gestionnaire => gestionnaires}/dossiers/messagerie.html.haml (100%) create mode 100644 app/views/gestionnaires/dossiers/personnes_impliquees.html.haml rename app/views/{new_gestionnaire => gestionnaires}/dossiers/print.html.haml (100%) rename app/views/{new_gestionnaire => gestionnaires}/dossiers/purge_champ_piece_justificative.js.erb (100%) rename app/views/{new_gestionnaire => gestionnaires}/dossiers/show.html.haml (100%) rename app/views/{new_gestionnaire => gestionnaires}/procedures/_dossier_actions.html.haml (100%) rename app/views/{new_gestionnaire => gestionnaires}/procedures/_download_dossiers.html.haml (100%) rename app/views/{new_gestionnaire => gestionnaires}/procedures/_header_field.html.haml (100%) rename app/views/{new_gestionnaire => gestionnaires}/procedures/email_notifications.html.haml (100%) rename app/views/{new_gestionnaire => gestionnaires}/procedures/index.html.haml (100%) rename app/views/{new_gestionnaire => gestionnaires}/procedures/show.html.haml (100%) rename app/views/{new_gestionnaire => gestionnaires}/recherche/index.html.haml (86%) rename app/views/{new_gestionnaire => gestionnaires}/shared/avis/_form.html.haml (100%) rename app/views/{new_gestionnaire => gestionnaires}/shared/avis/_list.html.haml (100%) delete mode 100644 app/views/new_gestionnaire/dossiers/personnes_impliquees.html.haml rename spec/controllers/{new_gestionnaire => gestionnaires}/avis_controller_spec.rb (99%) rename spec/controllers/{new_gestionnaire => gestionnaires}/dossiers_controller_spec.rb (99%) rename spec/controllers/{new_gestionnaire => gestionnaires}/gestionnaire_controller_spec.rb (71%) rename spec/controllers/{new_gestionnaire => gestionnaires}/procedures_controller_spec.rb (98%) rename spec/controllers/{new_gestionnaire => gestionnaires}/recherche_controller_spec.rb (95%) rename spec/features/{new_gestionnaire => gestionnaires}/gestionnaire_spec.rb (100%) rename spec/features/{new_gestionnaire => gestionnaires}/procedure_filters_spec.rb (100%) rename spec/views/{new_gestionnaire => gestionnaire}/avis/instruction.html.haml_spec.rb (89%) rename spec/views/{new_gestionnaire => gestionnaire}/dossiers/_envoyer_dossier_block.html.haml_spec.rb (83%) rename spec/views/{new_gestionnaire => gestionnaire}/dossiers/_state_button_motivation.html.haml_spec.rb (81%) rename spec/views/{new_gestionnaire => gestionnaire}/dossiers/print.html.haml_spec.rb (87%) rename spec/views/{new_gestionnaire => gestionnaire}/dossiers/show.html.haml_spec.rb (88%) rename spec/views/{new_gestionnaire => gestionnaire}/procedures/_download_dossiers.html.haml_spec.rb (77%) rename spec/views/{new_gestionnaire => gestionnaire}/shared/avis/list.html.haml_spec.rb (69%) diff --git a/app/controllers/new_gestionnaire/avis_controller.rb b/app/controllers/gestionnaires/avis_controller.rb similarity index 99% rename from app/controllers/new_gestionnaire/avis_controller.rb rename to app/controllers/gestionnaires/avis_controller.rb index 7ff6bfec6..7b7fede16 100644 --- a/app/controllers/new_gestionnaire/avis_controller.rb +++ b/app/controllers/gestionnaires/avis_controller.rb @@ -1,4 +1,4 @@ -module NewGestionnaire +module Gestionnaires class AvisController < GestionnaireController include CreateAvisConcern diff --git a/app/controllers/new_gestionnaire/dossiers_controller.rb b/app/controllers/gestionnaires/dossiers_controller.rb similarity index 99% rename from app/controllers/new_gestionnaire/dossiers_controller.rb rename to app/controllers/gestionnaires/dossiers_controller.rb index d3fbd5917..ded7aaba6 100644 --- a/app/controllers/new_gestionnaire/dossiers_controller.rb +++ b/app/controllers/gestionnaires/dossiers_controller.rb @@ -1,4 +1,4 @@ -module NewGestionnaire +module Gestionnaires class DossiersController < ProceduresController include ActionView::Helpers::NumberHelper include ActionView::Helpers::TextHelper diff --git a/app/controllers/new_gestionnaire/gestionnaire_controller.rb b/app/controllers/gestionnaires/gestionnaire_controller.rb similarity index 87% rename from app/controllers/new_gestionnaire/gestionnaire_controller.rb rename to app/controllers/gestionnaires/gestionnaire_controller.rb index cd23783b7..c9026553d 100644 --- a/app/controllers/new_gestionnaire/gestionnaire_controller.rb +++ b/app/controllers/gestionnaires/gestionnaire_controller.rb @@ -1,4 +1,4 @@ -module NewGestionnaire +module Gestionnaires class GestionnaireController < ApplicationController before_action :authenticate_gestionnaire! diff --git a/app/controllers/new_gestionnaire/procedures_controller.rb b/app/controllers/gestionnaires/procedures_controller.rb similarity index 99% rename from app/controllers/new_gestionnaire/procedures_controller.rb rename to app/controllers/gestionnaires/procedures_controller.rb index 46de9ce85..0a5d2f10b 100644 --- a/app/controllers/new_gestionnaire/procedures_controller.rb +++ b/app/controllers/gestionnaires/procedures_controller.rb @@ -1,4 +1,4 @@ -module NewGestionnaire +module Gestionnaires class ProceduresController < GestionnaireController before_action :ensure_ownership!, except: [:index] before_action :redirect_to_avis_if_needed, only: [:index] diff --git a/app/controllers/new_gestionnaire/recherche_controller.rb b/app/controllers/gestionnaires/recherche_controller.rb similarity index 94% rename from app/controllers/new_gestionnaire/recherche_controller.rb rename to app/controllers/gestionnaires/recherche_controller.rb index ff677c3f9..b3c921f66 100644 --- a/app/controllers/new_gestionnaire/recherche_controller.rb +++ b/app/controllers/gestionnaires/recherche_controller.rb @@ -1,4 +1,4 @@ -module NewGestionnaire +module Gestionnaires class RechercheController < GestionnaireController def index @search_terms = params[:q] diff --git a/app/views/new_gestionnaire/_help_dropdown.html.haml b/app/views/gestionnaires/_help_dropdown.html.haml similarity index 100% rename from app/views/new_gestionnaire/_help_dropdown.html.haml rename to app/views/gestionnaires/_help_dropdown.html.haml diff --git a/app/views/new_gestionnaire/avis/_header.html.haml b/app/views/gestionnaires/avis/_header.html.haml similarity index 100% rename from app/views/new_gestionnaire/avis/_header.html.haml rename to app/views/gestionnaires/avis/_header.html.haml diff --git a/app/views/new_gestionnaire/avis/index.html.haml b/app/views/gestionnaires/avis/index.html.haml similarity index 69% rename from app/views/new_gestionnaire/avis/index.html.haml rename to app/views/gestionnaires/avis/index.html.haml index d2850abb7..c3e694554 100644 --- a/app/views/new_gestionnaire/avis/index.html.haml +++ b/app/views/gestionnaires/avis/index.html.haml @@ -1,4 +1,4 @@ -- avis_statut = (@statut == NewGestionnaire::AvisController::A_DONNER_STATUS) ? 'à donner' : 'rendus' +- avis_statut = (@statut == Gestionnaires::AvisController::A_DONNER_STATUS) ? 'à donner' : 'rendus' - content_for(:title, "Avis #{avis_statut}") .sub-header @@ -7,14 +7,14 @@ %h1.tab-title Avis %ul.tabs = tab_item('avis à donner', - gestionnaire_avis_index_path(statut: NewGestionnaire::AvisController::A_DONNER_STATUS), - active: @statut == NewGestionnaire::AvisController::A_DONNER_STATUS, + gestionnaire_avis_index_path(statut: Gestionnaires::AvisController::A_DONNER_STATUS), + active: @statut == Gestionnaires::AvisController::A_DONNER_STATUS, badge: @avis_a_donner.count, notification: @avis_a_donner.any?) = tab_item("avis #{'donné'.pluralize(@avis_donnes.count)}", - gestionnaire_avis_index_path(statut: NewGestionnaire::AvisController::DONNES_STATUS), - active: @statut == NewGestionnaire::AvisController::DONNES_STATUS, + gestionnaire_avis_index_path(statut: Gestionnaires::AvisController::DONNES_STATUS), + active: @statut == Gestionnaires::AvisController::DONNES_STATUS, badge: @avis_donnes.count) .container diff --git a/app/views/new_gestionnaire/avis/instruction.html.haml b/app/views/gestionnaires/avis/instruction.html.haml similarity index 78% rename from app/views/new_gestionnaire/avis/instruction.html.haml rename to app/views/gestionnaires/avis/instruction.html.haml index 2b26eb134..12c5f0537 100644 --- a/app/views/new_gestionnaire/avis/instruction.html.haml +++ b/app/views/gestionnaires/avis/instruction.html.haml @@ -26,7 +26,7 @@ = f.submit 'Envoyer votre avis', class: 'button send' - if !@dossier.termine? - = render partial: "new_gestionnaire/shared/avis/form", locals: { url: avis_gestionnaire_avis_path(@avis), must_be_confidentiel: @avis.confidentiel?, avis: @new_avis } + = render partial: "gestionnaires/shared/avis/form", locals: { url: avis_gestionnaire_avis_path(@avis), must_be_confidentiel: @avis.confidentiel?, avis: @new_avis } - if @dossier.avis_for(current_gestionnaire).present? - = render partial: 'new_gestionnaire/shared/avis/list', locals: { avis: @dossier.avis_for(current_gestionnaire), avis_seen_at: nil } + = render partial: 'gestionnaires/shared/avis/list', locals: { avis: @dossier.avis_for(current_gestionnaire), avis_seen_at: nil } diff --git a/app/views/new_gestionnaire/avis/messagerie.html.haml b/app/views/gestionnaires/avis/messagerie.html.haml similarity index 100% rename from app/views/new_gestionnaire/avis/messagerie.html.haml rename to app/views/gestionnaires/avis/messagerie.html.haml diff --git a/app/views/new_gestionnaire/avis/show.html.haml b/app/views/gestionnaires/avis/show.html.haml similarity index 100% rename from app/views/new_gestionnaire/avis/show.html.haml rename to app/views/gestionnaires/avis/show.html.haml diff --git a/app/views/new_gestionnaire/avis/sign_up.html.haml b/app/views/gestionnaires/avis/sign_up.html.haml similarity index 77% rename from app/views/new_gestionnaire/avis/sign_up.html.haml rename to app/views/gestionnaires/avis/sign_up.html.haml index 0b7fa17e8..0ce22571a 100644 --- a/app/views/new_gestionnaire/avis/sign_up.html.haml +++ b/app/views/gestionnaires/avis/sign_up.html.haml @@ -4,7 +4,7 @@ %p.description= @dossier.procedure.libelle %p.dossier Dossier nº #{@dossier.id} .column - = form_for(Gestionnaire.new, url: { controller: "new_gestionnaire/avis", action: :create_gestionnaire }, method: :post, html: { class: "form" }) do |f| + = form_for(Gestionnaire.new, url: { controller: "gestionnaires/avis", action: :create_gestionnaire }, method: :post, html: { class: "form" }) do |f| %h1 Créez-vous un compte = f.label :email, "Email" diff --git a/app/views/new_gestionnaire/dossiers/_envoyer_dossier_block.html.haml b/app/views/gestionnaires/dossiers/_envoyer_dossier_block.html.haml similarity index 100% rename from app/views/new_gestionnaire/dossiers/_envoyer_dossier_block.html.haml rename to app/views/gestionnaires/dossiers/_envoyer_dossier_block.html.haml diff --git a/app/views/new_gestionnaire/dossiers/_header.html.haml b/app/views/gestionnaires/dossiers/_header.html.haml similarity index 91% rename from app/views/new_gestionnaire/dossiers/_header.html.haml rename to app/views/gestionnaires/dossiers/_header.html.haml index 964a50594..186d4c4d6 100644 --- a/app/views/new_gestionnaire/dossiers/_header.html.haml +++ b/app/views/gestionnaires/dossiers/_header.html.haml @@ -19,7 +19,7 @@ %li = link_to "Uniquement cet onglet", "#", onclick: "window.print()", class: "menu-item menu-link" - = render partial: "new_gestionnaire/procedures/dossier_actions", locals: { procedure: dossier.procedure, dossier: dossier, dossier_is_followed: current_gestionnaire&.follow?(dossier) } + = render partial: "gestionnaires/procedures/dossier_actions", locals: { procedure: dossier.procedure, dossier: dossier, dossier_is_followed: current_gestionnaire&.follow?(dossier) } %span.state-button = render partial: "state_button", locals: { dossier: dossier } diff --git a/app/views/new_gestionnaire/dossiers/_personnes_impliquees_block.html.haml b/app/views/gestionnaires/dossiers/_personnes_impliquees_block.html.haml similarity index 100% rename from app/views/new_gestionnaire/dossiers/_personnes_impliquees_block.html.haml rename to app/views/gestionnaires/dossiers/_personnes_impliquees_block.html.haml diff --git a/app/views/new_gestionnaire/dossiers/_state_button.html.haml b/app/views/gestionnaires/dossiers/_state_button.html.haml similarity index 73% rename from app/views/new_gestionnaire/dossiers/_state_button.html.haml rename to app/views/gestionnaires/dossiers/_state_button.html.haml index c28254ca0..2c6580c6b 100644 --- a/app/views/new_gestionnaire/dossiers/_state_button.html.haml +++ b/app/views/gestionnaires/dossiers/_state_button.html.haml @@ -47,9 +47,9 @@ .dropdown-description %h4 Refuser L'usager sera notifié que son dossier a été refusé - = render partial: 'new_gestionnaire/dossiers/state_button_motivation', locals: { dossier: dossier, popup_title: 'Accepter le dossier', placeholder: 'Expliquez au demandeur pourquoi ce dossier est accepté (facultatif)', popup_class: 'accept', process_action: 'accepter', title: 'Accepter', confirm: "Confirmez-vous l'acceptation ce dossier ?" } - = render partial: 'new_gestionnaire/dossiers/state_button_motivation', locals: { dossier: dossier, popup_title: 'Classer le dossier sans suite', placeholder: 'Expliquez au demandeur pourquoi ce dossier est classé sans suite (obligatoire)', popup_class: 'without-continuation', process_action: 'classer_sans_suite', title: 'Classer sans suite', confirm: 'Confirmez-vous le classement sans suite de ce dossier ?' } - = render partial: 'new_gestionnaire/dossiers/state_button_motivation', locals: { dossier: dossier, popup_title: 'Refuser le dossier', placeholder: 'Expliquez au demandeur pourquoi ce dossier est refusé (obligatoire)', popup_class: 'refuse', process_action: 'refuser', title: 'Refuser', confirm: 'Confirmez-vous le refus de ce dossier ?' } + = render partial: 'gestionnaires/dossiers/state_button_motivation', locals: { dossier: dossier, popup_title: 'Accepter le dossier', placeholder: 'Expliquez au demandeur pourquoi ce dossier est accepté (facultatif)', popup_class: 'accept', process_action: 'accepter', title: 'Accepter', confirm: "Confirmez-vous l'acceptation ce dossier ?" } + = render partial: 'gestionnaires/dossiers/state_button_motivation', locals: { dossier: dossier, popup_title: 'Classer le dossier sans suite', placeholder: 'Expliquez au demandeur pourquoi ce dossier est classé sans suite (obligatoire)', popup_class: 'without-continuation', process_action: 'classer_sans_suite', title: 'Classer sans suite', confirm: 'Confirmez-vous le classement sans suite de ce dossier ?' } + = render partial: 'gestionnaires/dossiers/state_button_motivation', locals: { dossier: dossier, popup_title: 'Refuser le dossier', placeholder: 'Expliquez au demandeur pourquoi ce dossier est refusé (obligatoire)', popup_class: 'refuse', process_action: 'refuser', title: 'Refuser', confirm: 'Confirmez-vous le refus de ce dossier ?' } - else - if dossier.motivation.present? || dossier.attestation.present? diff --git a/app/views/new_gestionnaire/dossiers/_state_button_motivation.html.haml b/app/views/gestionnaires/dossiers/_state_button_motivation.html.haml similarity index 100% rename from app/views/new_gestionnaire/dossiers/_state_button_motivation.html.haml rename to app/views/gestionnaires/dossiers/_state_button_motivation.html.haml diff --git a/app/views/new_gestionnaire/dossiers/_state_button_refresh.js.erb b/app/views/gestionnaires/dossiers/_state_button_refresh.js.erb similarity index 100% rename from app/views/new_gestionnaire/dossiers/_state_button_refresh.js.erb rename to app/views/gestionnaires/dossiers/_state_button_refresh.js.erb diff --git a/app/views/new_gestionnaire/dossiers/annotations_privees.html.haml b/app/views/gestionnaires/dossiers/annotations_privees.html.haml similarity index 100% rename from app/views/new_gestionnaire/dossiers/annotations_privees.html.haml rename to app/views/gestionnaires/dossiers/annotations_privees.html.haml diff --git a/app/views/new_gestionnaire/dossiers/avis.html.haml b/app/views/gestionnaires/dossiers/avis.html.haml similarity index 56% rename from app/views/new_gestionnaire/dossiers/avis.html.haml rename to app/views/gestionnaires/dossiers/avis.html.haml index eb59d5dbb..45c28b4b9 100644 --- a/app/views/new_gestionnaire/dossiers/avis.html.haml +++ b/app/views/gestionnaires/dossiers/avis.html.haml @@ -4,10 +4,10 @@ .container - if !@dossier.termine? - = render partial: "new_gestionnaire/shared/avis/form", locals: { url: avis_gestionnaire_dossier_path(@dossier.procedure, @dossier), must_be_confidentiel: false, avis: @avis } + = render partial: "gestionnaires/shared/avis/form", locals: { url: avis_gestionnaire_dossier_path(@dossier.procedure, @dossier), must_be_confidentiel: false, avis: @avis } - if @dossier.avis.present? - = render partial: 'new_gestionnaire/shared/avis/list', locals: { avis: @dossier.avis, avis_seen_at: @avis_seen_at } + = render partial: 'gestionnaires/shared/avis/list', locals: { avis: @dossier.avis, avis_seen_at: @avis_seen_at } - if @dossier.termine? && !@dossier.avis.present? .blank-tab diff --git a/app/views/new_gestionnaire/dossiers/messagerie.html.haml b/app/views/gestionnaires/dossiers/messagerie.html.haml similarity index 100% rename from app/views/new_gestionnaire/dossiers/messagerie.html.haml rename to app/views/gestionnaires/dossiers/messagerie.html.haml diff --git a/app/views/gestionnaires/dossiers/personnes_impliquees.html.haml b/app/views/gestionnaires/dossiers/personnes_impliquees.html.haml new file mode 100644 index 000000000..933afe6ba --- /dev/null +++ b/app/views/gestionnaires/dossiers/personnes_impliquees.html.haml @@ -0,0 +1,12 @@ +- content_for(:title, "Personnes impliquées · Dossier nº #{@dossier.id} (#{@dossier.owner_name})") + += render partial: "header", locals: { dossier: @dossier } + +.personnes-impliquees.container + = render partial: 'gestionnaires/dossiers/envoyer_dossier_block', locals: { dossier: @dossier, potential_recipients: @potential_recipients } + + = render partial: 'gestionnaires/dossiers/personnes_impliquees_block', locals: { emails_collection: @following_instructeurs_emails, title: "Instructeurs qui suivent le dossier", blank: "Aucun instructeur ne suit ce dossier" } + + = render partial: 'gestionnaires/dossiers/personnes_impliquees_block', locals: { emails_collection: @avis_emails, title: "Personnes à qui un avis a été demandé", blank: "Aucun avis n'a été demandé" } + + = render partial: 'gestionnaires/dossiers/personnes_impliquees_block', locals: { emails_collection: @invites_emails, title: "Personnes invitées à consulter ce dossier", blank: "Aucune personne n'a été invitée à consulter ce dossier" } diff --git a/app/views/new_gestionnaire/dossiers/print.html.haml b/app/views/gestionnaires/dossiers/print.html.haml similarity index 100% rename from app/views/new_gestionnaire/dossiers/print.html.haml rename to app/views/gestionnaires/dossiers/print.html.haml diff --git a/app/views/new_gestionnaire/dossiers/purge_champ_piece_justificative.js.erb b/app/views/gestionnaires/dossiers/purge_champ_piece_justificative.js.erb similarity index 100% rename from app/views/new_gestionnaire/dossiers/purge_champ_piece_justificative.js.erb rename to app/views/gestionnaires/dossiers/purge_champ_piece_justificative.js.erb diff --git a/app/views/new_gestionnaire/dossiers/show.html.haml b/app/views/gestionnaires/dossiers/show.html.haml similarity index 100% rename from app/views/new_gestionnaire/dossiers/show.html.haml rename to app/views/gestionnaires/dossiers/show.html.haml diff --git a/app/views/new_gestionnaire/procedures/_dossier_actions.html.haml b/app/views/gestionnaires/procedures/_dossier_actions.html.haml similarity index 100% rename from app/views/new_gestionnaire/procedures/_dossier_actions.html.haml rename to app/views/gestionnaires/procedures/_dossier_actions.html.haml diff --git a/app/views/new_gestionnaire/procedures/_download_dossiers.html.haml b/app/views/gestionnaires/procedures/_download_dossiers.html.haml similarity index 100% rename from app/views/new_gestionnaire/procedures/_download_dossiers.html.haml rename to app/views/gestionnaires/procedures/_download_dossiers.html.haml diff --git a/app/views/new_gestionnaire/procedures/_header_field.html.haml b/app/views/gestionnaires/procedures/_header_field.html.haml similarity index 100% rename from app/views/new_gestionnaire/procedures/_header_field.html.haml rename to app/views/gestionnaires/procedures/_header_field.html.haml diff --git a/app/views/new_gestionnaire/procedures/email_notifications.html.haml b/app/views/gestionnaires/procedures/email_notifications.html.haml similarity index 100% rename from app/views/new_gestionnaire/procedures/email_notifications.html.haml rename to app/views/gestionnaires/procedures/email_notifications.html.haml diff --git a/app/views/new_gestionnaire/procedures/index.html.haml b/app/views/gestionnaires/procedures/index.html.haml similarity index 100% rename from app/views/new_gestionnaire/procedures/index.html.haml rename to app/views/gestionnaires/procedures/index.html.haml diff --git a/app/views/new_gestionnaire/procedures/show.html.haml b/app/views/gestionnaires/procedures/show.html.haml similarity index 100% rename from app/views/new_gestionnaire/procedures/show.html.haml rename to app/views/gestionnaires/procedures/show.html.haml diff --git a/app/views/new_gestionnaire/recherche/index.html.haml b/app/views/gestionnaires/recherche/index.html.haml similarity index 86% rename from app/views/new_gestionnaire/recherche/index.html.haml rename to app/views/gestionnaires/recherche/index.html.haml index 3af866a83..b6dcb6347 100644 --- a/app/views/new_gestionnaire/recherche/index.html.haml +++ b/app/views/gestionnaires/recherche/index.html.haml @@ -31,6 +31,6 @@ %td.status-col = link_to(dossier_linked_path(current_gestionnaire, dossier), class: 'cell-link') do = render partial: 'shared/dossiers/status_badge', locals: { dossier: dossier } - %td.action-col.follow-col= render partial: 'new_gestionnaire/procedures/dossier_actions', locals: { procedure: dossier.procedure, dossier: dossier, dossier_is_followed: @followed_dossiers_id.include?(dossier.id) } + %td.action-col.follow-col= render partial: 'gestionnaires/procedures/dossier_actions', locals: { procedure: dossier.procedure, dossier: dossier, dossier_is_followed: @followed_dossiers_id.include?(dossier.id) } - else %h2 Aucun dossier correspondant à votre recherche n'a été trouvé diff --git a/app/views/new_gestionnaire/shared/avis/_form.html.haml b/app/views/gestionnaires/shared/avis/_form.html.haml similarity index 100% rename from app/views/new_gestionnaire/shared/avis/_form.html.haml rename to app/views/gestionnaires/shared/avis/_form.html.haml diff --git a/app/views/new_gestionnaire/shared/avis/_list.html.haml b/app/views/gestionnaires/shared/avis/_list.html.haml similarity index 100% rename from app/views/new_gestionnaire/shared/avis/_list.html.haml rename to app/views/gestionnaires/shared/avis/_list.html.haml diff --git a/app/views/layouts/_new_header.haml b/app/views/layouts/_new_header.haml index 8293280e1..738eb173b 100644 --- a/app/views/layouts/_new_header.haml +++ b/app/views/layouts/_new_header.haml @@ -91,6 +91,6 @@ - if nav_bar_profile == :user && dossier.present? = render partial: 'users/dossier_help_dropdown', locals: { dossier: dossier } - elsif nav_bar_profile == :gestionnaire - = render partial: 'new_gestionnaire/help_dropdown' + = render partial: 'gestionnaires/help_dropdown' - else = link_to 'Aide', FAQ_URL, class: "button primary" diff --git a/app/views/new_gestionnaire/dossiers/personnes_impliquees.html.haml b/app/views/new_gestionnaire/dossiers/personnes_impliquees.html.haml deleted file mode 100644 index 74174e862..000000000 --- a/app/views/new_gestionnaire/dossiers/personnes_impliquees.html.haml +++ /dev/null @@ -1,12 +0,0 @@ -- content_for(:title, "Personnes impliquées · Dossier nº #{@dossier.id} (#{@dossier.owner_name})") - -= render partial: "header", locals: { dossier: @dossier } - -.personnes-impliquees.container - = render partial: 'new_gestionnaire/dossiers/envoyer_dossier_block', locals: { dossier: @dossier, potential_recipients: @potential_recipients } - - = render partial: 'new_gestionnaire/dossiers/personnes_impliquees_block', locals: { emails_collection: @following_instructeurs_emails, title: "Instructeurs qui suivent le dossier", blank: "Aucun instructeur ne suit ce dossier" } - - = render partial: 'new_gestionnaire/dossiers/personnes_impliquees_block', locals: { emails_collection: @avis_emails, title: "Personnes à qui un avis a été demandé", blank: "Aucun avis n'a été demandé" } - - = render partial: 'new_gestionnaire/dossiers/personnes_impliquees_block', locals: { emails_collection: @invites_emails, title: "Personnes invitées à consulter ce dossier", blank: "Aucune personne n'a été invitée à consulter ce dossier" } diff --git a/config/routes.rb b/config/routes.rb index 84e00699b..6c2ea3113 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -307,7 +307,7 @@ Rails.application.routes.draw do # Gestionnaire # - scope module: 'new_gestionnaire', as: 'gestionnaire' do + scope module: 'gestionnaires', as: 'gestionnaire' do resources :procedures, only: [:index, :show], param: :procedure_id do member do patch 'update_displayed_fields' diff --git a/spec/controllers/new_gestionnaire/avis_controller_spec.rb b/spec/controllers/gestionnaires/avis_controller_spec.rb similarity index 99% rename from spec/controllers/new_gestionnaire/avis_controller_spec.rb rename to spec/controllers/gestionnaires/avis_controller_spec.rb index 655f805c5..35f9d5159 100644 --- a/spec/controllers/new_gestionnaire/avis_controller_spec.rb +++ b/spec/controllers/gestionnaires/avis_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe NewGestionnaire::AvisController, type: :controller do +describe Gestionnaires::AvisController, type: :controller do context 'with a gestionnaire signed in' do render_views diff --git a/spec/controllers/new_gestionnaire/dossiers_controller_spec.rb b/spec/controllers/gestionnaires/dossiers_controller_spec.rb similarity index 99% rename from spec/controllers/new_gestionnaire/dossiers_controller_spec.rb rename to spec/controllers/gestionnaires/dossiers_controller_spec.rb index 3a2e412f1..0add282a7 100644 --- a/spec/controllers/new_gestionnaire/dossiers_controller_spec.rb +++ b/spec/controllers/gestionnaires/dossiers_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe NewGestionnaire::DossiersController, type: :controller do +describe Gestionnaires::DossiersController, type: :controller do render_views let(:gestionnaire) { create(:gestionnaire) } diff --git a/spec/controllers/new_gestionnaire/gestionnaire_controller_spec.rb b/spec/controllers/gestionnaires/gestionnaire_controller_spec.rb similarity index 71% rename from spec/controllers/new_gestionnaire/gestionnaire_controller_spec.rb rename to spec/controllers/gestionnaires/gestionnaire_controller_spec.rb index 36a31b204..63fd8c3bd 100644 --- a/spec/controllers/new_gestionnaire/gestionnaire_controller_spec.rb +++ b/spec/controllers/gestionnaires/gestionnaire_controller_spec.rb @@ -1,9 +1,9 @@ require 'spec_helper' -describe NewGestionnaire::GestionnaireController, type: :controller do +describe Gestionnaires::GestionnaireController, type: :controller do describe 'before actions: authenticate_gestionnaire!' do it 'is present' do - before_actions = NewGestionnaire::GestionnaireController + before_actions = Gestionnaires::GestionnaireController ._process_action_callbacks .find_all { |process_action_callbacks| process_action_callbacks.kind == :before } .map(&:filter) diff --git a/spec/controllers/new_gestionnaire/procedures_controller_spec.rb b/spec/controllers/gestionnaires/procedures_controller_spec.rb similarity index 98% rename from spec/controllers/new_gestionnaire/procedures_controller_spec.rb rename to spec/controllers/gestionnaires/procedures_controller_spec.rb index 91d6f8886..e0951964f 100644 --- a/spec/controllers/new_gestionnaire/procedures_controller_spec.rb +++ b/spec/controllers/gestionnaires/procedures_controller_spec.rb @@ -1,9 +1,9 @@ require 'spec_helper' -describe NewGestionnaire::ProceduresController, type: :controller do +describe Gestionnaires::ProceduresController, type: :controller do describe "before_action: ensure_ownership!" do it "is present" do - before_actions = NewGestionnaire::ProceduresController + before_actions = Gestionnaires::ProceduresController ._process_action_callbacks .find_all { |process_action_callbacks| process_action_callbacks.kind == :before } .map(&:filter) @@ -44,7 +44,7 @@ describe NewGestionnaire::ProceduresController, type: :controller do describe "before_action: redirect_to_avis_if_needed" do it "is present" do - before_actions = NewGestionnaire::ProceduresController + before_actions = Gestionnaires::ProceduresController ._process_action_callbacks .find_all { |process_action_callbacks| process_action_callbacks.kind == :before } .map(&:filter) diff --git a/spec/controllers/new_gestionnaire/recherche_controller_spec.rb b/spec/controllers/gestionnaires/recherche_controller_spec.rb similarity index 95% rename from spec/controllers/new_gestionnaire/recherche_controller_spec.rb rename to spec/controllers/gestionnaires/recherche_controller_spec.rb index 4e3ac6288..6d33e190a 100644 --- a/spec/controllers/new_gestionnaire/recherche_controller_spec.rb +++ b/spec/controllers/gestionnaires/recherche_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe NewGestionnaire::RechercheController, type: :controller do +describe Gestionnaires::RechercheController, type: :controller do let(:dossier) { create(:dossier, :en_construction) } let(:dossier2) { create(:dossier, :en_construction, procedure: dossier.procedure) } let(:gestionnaire) { create(:gestionnaire) } diff --git a/spec/features/new_gestionnaire/gestionnaire_spec.rb b/spec/features/gestionnaires/gestionnaire_spec.rb similarity index 100% rename from spec/features/new_gestionnaire/gestionnaire_spec.rb rename to spec/features/gestionnaires/gestionnaire_spec.rb diff --git a/spec/features/new_gestionnaire/procedure_filters_spec.rb b/spec/features/gestionnaires/procedure_filters_spec.rb similarity index 100% rename from spec/features/new_gestionnaire/procedure_filters_spec.rb rename to spec/features/gestionnaires/procedure_filters_spec.rb diff --git a/spec/views/new_gestionnaire/avis/instruction.html.haml_spec.rb b/spec/views/gestionnaire/avis/instruction.html.haml_spec.rb similarity index 89% rename from spec/views/new_gestionnaire/avis/instruction.html.haml_spec.rb rename to spec/views/gestionnaire/avis/instruction.html.haml_spec.rb index 0d23b7b75..56030ed69 100644 --- a/spec/views/new_gestionnaire/avis/instruction.html.haml_spec.rb +++ b/spec/views/gestionnaire/avis/instruction.html.haml_spec.rb @@ -1,4 +1,4 @@ -describe 'new_gestionnaire/avis/instruction.html.haml', type: :view do +describe 'gestionnaires/avis/instruction.html.haml', type: :view do let(:avis) { create(:avis, confidentiel: confidentiel) } before do diff --git a/spec/views/new_gestionnaire/dossiers/_envoyer_dossier_block.html.haml_spec.rb b/spec/views/gestionnaire/dossiers/_envoyer_dossier_block.html.haml_spec.rb similarity index 83% rename from spec/views/new_gestionnaire/dossiers/_envoyer_dossier_block.html.haml_spec.rb rename to spec/views/gestionnaire/dossiers/_envoyer_dossier_block.html.haml_spec.rb index 464a42089..efe50d61d 100644 --- a/spec/views/new_gestionnaire/dossiers/_envoyer_dossier_block.html.haml_spec.rb +++ b/spec/views/gestionnaire/dossiers/_envoyer_dossier_block.html.haml_spec.rb @@ -1,9 +1,9 @@ -describe 'new_gestionnaire/dossiers/envoyer_dossier_block.html.haml', type: :view do +describe 'gestionnaires/dossiers/envoyer_dossier_block.html.haml', type: :view do let(:dossier) { create(:dossier) } subject do render( - 'new_gestionnaire/dossiers/envoyer_dossier_block.html.haml', + 'gestionnaires/dossiers/envoyer_dossier_block.html.haml', dossier: dossier, potential_recipients: potential_recipients ) diff --git a/spec/views/new_gestionnaire/dossiers/_state_button_motivation.html.haml_spec.rb b/spec/views/gestionnaire/dossiers/_state_button_motivation.html.haml_spec.rb similarity index 81% rename from spec/views/new_gestionnaire/dossiers/_state_button_motivation.html.haml_spec.rb rename to spec/views/gestionnaire/dossiers/_state_button_motivation.html.haml_spec.rb index 4023b1e11..d2d10cb91 100644 --- a/spec/views/new_gestionnaire/dossiers/_state_button_motivation.html.haml_spec.rb +++ b/spec/views/gestionnaire/dossiers/_state_button_motivation.html.haml_spec.rb @@ -1,9 +1,9 @@ -describe 'new_gestionnaire/dossiers/state_button_motivation.html.haml', type: :view do +describe 'gestionnaires/dossiers/state_button_motivation.html.haml', type: :view do let(:dossier) { create(:dossier, :en_instruction) } subject! do render( - 'new_gestionnaire/dossiers/state_button_motivation.html.haml', + 'gestionnaires/dossiers/state_button_motivation.html.haml', dossier: dossier, popup_title: 'Accepter le dossier', placeholder: 'Expliquez au demandeur pourquoi ce dossier est accepté (facultatif)', diff --git a/spec/views/new_gestionnaire/dossiers/print.html.haml_spec.rb b/spec/views/gestionnaire/dossiers/print.html.haml_spec.rb similarity index 87% rename from spec/views/new_gestionnaire/dossiers/print.html.haml_spec.rb rename to spec/views/gestionnaire/dossiers/print.html.haml_spec.rb index 1aaf41029..26bdc949e 100644 --- a/spec/views/new_gestionnaire/dossiers/print.html.haml_spec.rb +++ b/spec/views/gestionnaire/dossiers/print.html.haml_spec.rb @@ -1,4 +1,4 @@ -describe 'new_gestionnaire/dossiers/print.html.haml', type: :view do +describe 'gestionnaires/dossiers/print.html.haml', type: :view do before { view.extend DossierHelper } context "with a dossier" do diff --git a/spec/views/new_gestionnaire/dossiers/show.html.haml_spec.rb b/spec/views/gestionnaire/dossiers/show.html.haml_spec.rb similarity index 88% rename from spec/views/new_gestionnaire/dossiers/show.html.haml_spec.rb rename to spec/views/gestionnaire/dossiers/show.html.haml_spec.rb index 2ff909600..598284831 100644 --- a/spec/views/new_gestionnaire/dossiers/show.html.haml_spec.rb +++ b/spec/views/gestionnaire/dossiers/show.html.haml_spec.rb @@ -1,4 +1,4 @@ -describe 'new_gestionnaire/dossiers/show.html.haml', type: :view do +describe 'gestionnaires/dossiers/show.html.haml', type: :view do let(:current_gestionnaire) { create(:gestionnaire) } let(:dossier) { create(:dossier, :en_construction) } diff --git a/spec/views/new_gestionnaire/procedures/_download_dossiers.html.haml_spec.rb b/spec/views/gestionnaire/procedures/_download_dossiers.html.haml_spec.rb similarity index 77% rename from spec/views/new_gestionnaire/procedures/_download_dossiers.html.haml_spec.rb rename to spec/views/gestionnaire/procedures/_download_dossiers.html.haml_spec.rb index 334e97ef8..a47d3d089 100644 --- a/spec/views/new_gestionnaire/procedures/_download_dossiers.html.haml_spec.rb +++ b/spec/views/gestionnaire/procedures/_download_dossiers.html.haml_spec.rb @@ -1,8 +1,8 @@ -describe 'new_gestionnaire/procedures/_download_dossiers.html.haml', type: :view do +describe 'gestionnaires/procedures/_download_dossiers.html.haml', type: :view do let(:current_gestionnaire) { create(:gestionnaire) } let(:procedure) { create(:procedure) } - subject { render 'new_gestionnaire/procedures/download_dossiers.html.haml', procedure: procedure } + subject { render 'gestionnaires/procedures/download_dossiers.html.haml', procedure: procedure } context "when procedure has 0 dossier" do it { is_expected.not_to include("Télécharger tous les dossiers") } diff --git a/spec/views/new_gestionnaire/shared/avis/list.html.haml_spec.rb b/spec/views/gestionnaire/shared/avis/list.html.haml_spec.rb similarity index 69% rename from spec/views/new_gestionnaire/shared/avis/list.html.haml_spec.rb rename to spec/views/gestionnaire/shared/avis/list.html.haml_spec.rb index a7c694209..1f8797785 100644 --- a/spec/views/new_gestionnaire/shared/avis/list.html.haml_spec.rb +++ b/spec/views/gestionnaire/shared/avis/list.html.haml_spec.rb @@ -1,7 +1,7 @@ -describe 'new_gestionnaire/shared/avis/_list.html.haml', type: :view do +describe 'gestionnaires/shared/avis/_list.html.haml', type: :view do before { view.extend DossierHelper } - subject { render 'new_gestionnaire/shared/avis/list.html.haml', avis: avis, avis_seen_at: seen_at, current_gestionnaire: gestionnaire } + subject { render 'gestionnaires/shared/avis/list.html.haml', avis: avis, avis_seen_at: seen_at, current_gestionnaire: gestionnaire } let(:gestionnaire) { create(:gestionnaire) } let(:avis) { [create(:avis, claimant: gestionnaire)] } From 97af31d54f5a264dd7bfbb874355b2b7099af793 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Tue, 26 Mar 2019 11:10:30 +0100 Subject: [PATCH 09/11] app: rename references to `betagouv/tps` Github has an automatic redirection, but better be clean. --- CONTRIBUTING.md | 4 ++-- README.md | 4 ++-- app/views/layouts/_footer.html.haml | 2 +- app/views/root/_footer.html.haml | 2 +- config/deploy.rb | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 40d2deab8..6a51ae6d8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,13 +12,13 @@ Voici la marche à suivre recommandée pour effectuer une modification. La première étape est généralement de discuter de l’amélioration que vous proposez (s’il ne s’agit pas d’un changement trivial, comme la correction d’une coquille). -Pour cela, [créez une nouvelle issue](https://github.com/betagouv/tps/issues/new) concernant votre proposition. Autant que possible, indiquez clairement votre besoin, votre cas d’usage – et éventuellement comment vous pensez déjà le résoudre. +Pour cela, [créez une nouvelle issue](https://github.com/betagouv/demarches-simplifiees.fr/issues/new) concernant votre proposition. Autant que possible, indiquez clairement votre besoin, votre cas d’usage – et éventuellement comment vous pensez déjà le résoudre. Nous pouvons alors discuter, pour vérifier que le besoin exprimé correspond à l’usage de demarches-simplifiees.fr, proposer éventuellement des alternatives, et se mettre d’accord sur une implémentation technique pertinente. ## 2. Proposer du code -Une fois que la discussion est établie, et que les éléments techniques sont dégrossis, vous pouvez proposer des changements au code. Pour cela, effectuez vos modifications en local, et [ouvrez une Pull Request](https://github.com/betagouv/tps/issues/new) avec les changements que vous souhaitez apporter. +Une fois que la discussion est établie, et que les éléments techniques sont dégrossis, vous pouvez proposer des changements au code. Pour cela, effectuez vos modifications en local, et [ouvrez une Pull Request](https://github.com/betagouv/demarches-simplifiees.fr/issues/new) avec les changements que vous souhaitez apporter. Quelques conseils : pensez à bien décrire l’objectif et l’implémentation de votre PR au moment de la créer. Et si vos changements sont importants, découpez-les en plusieurs petites PRs successives, qui seront plus faciles à relire. N’oubliez pas d’ajouter des tests automatisés pour vous assurer que vos changements fonctionnent bien. diff --git a/README.md b/README.md index 500dc1c49..a84994dba 100644 --- a/README.md +++ b/README.md @@ -53,11 +53,11 @@ Afin d'initialiser l'environnement de développement, exécutez la commande suiv overmind start -L'application tourne à l'adresse `http://localhost:3000`. +L'application tourne à l'adresse `http://localhost:3000`. ### Utilisateurs de test -En local, un utilisateur de test est créé automatiquement, avec les identifiants `test@exemple.fr`/`this is a very complicated password !`. (voir [db/seeds.rb](https://github.com/betagouv/tps/blob/dev/db/seeds.rb)) +En local, un utilisateur de test est créé automatiquement, avec les identifiants `test@exemple.fr`/`this is a very complicated password !`. (voir [db/seeds.rb](https://github.com/betagouv/demarches-simplifiees.fr/blob/dev/db/seeds.rb)) ### Programmation des jobs diff --git a/app/views/layouts/_footer.html.haml b/app/views/layouts/_footer.html.haml index 5219c2105..4ef07e77c 100644 --- a/app/views/layouts/_footer.html.haml +++ b/app/views/layouts/_footer.html.haml @@ -3,7 +3,7 @@ = link_to 'DINSIC', "http://etatplateforme.modernisation.gouv.fr" = Time.zone.now.year \- - = link_to 'Nouveautés', 'https://github.com/betagouv/tps/releases', target: '_blank' + = link_to 'Nouveautés', 'https://github.com/betagouv/demarches-simplifiees.fr/releases', target: '_blank' \- = link_to 'Statistiques', stats_path \- diff --git a/app/views/root/_footer.html.haml b/app/views/root/_footer.html.haml index bf3c8a4ef..08934bef8 100644 --- a/app/views/root/_footer.html.haml +++ b/app/views/root/_footer.html.haml @@ -21,7 +21,7 @@ %li.footer-link = link_to "Newsletter", "https://my.sendinblue.com/users/subscribe/js_id/3s2q1/id/1", :class => "footer-link", :target => "_blank", rel: "noopener" %li.footer-link - = link_to "Nouveautés", "https://github.com/betagouv/tps/releases", :class => "footer-link" + = link_to "Nouveautés", "https://github.com/betagouv/demarches-simplifiees.fr/releases", :class => "footer-link" %li.footer-link = link_to "Statistiques", stats_path, :class => "footer-link" %li.footer-link diff --git a/config/deploy.rb b/config/deploy.rb index 64066db52..b8cfdd565 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -26,7 +26,7 @@ shared_dirs = [ set :domain, ENV.fetch('domain') set :deploy_to, deploy_to -set :repository, 'https://github.com/betagouv/tps.git' +set :repository, 'https://github.com/betagouv/demarches-simplifiees.fr.git' set :branch, ENV.fetch('branch') set :forward_agent, true set :user, 'ds' From 4e27872a2527699204f7f612166ad637c0ec2941 Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Tue, 26 Mar 2019 11:00:24 +0100 Subject: [PATCH 10/11] [Fix #3650] when cloning a procedure, do not forget pj_templates --- app/models/procedure.rb | 12 +++++++++++- spec/factories/type_de_champ.rb | 4 ++++ spec/models/procedure_spec.rb | 4 ++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/models/procedure.rb b/app/models/procedure.rb index 4f18b8562..88b04ec84 100644 --- a/app/models/procedure.rb +++ b/app/models/procedure.rb @@ -189,6 +189,16 @@ class Procedure < ApplicationRecord end end + def clone_attachments(original, kopy) + if original.is_a?(TypeDeChamp) && original.piece_justificative_template.attached? + kopy.piece_justificative_template.attach({ + io: StringIO.new(original.piece_justificative_template.download), + filename: original.piece_justificative_template.blob.filename, + content_type: original.piece_justificative_template.blob.content_type + }) + end + end + def clone(admin, from_library) is_different_admin = !admin.owns?(self) @@ -198,7 +208,7 @@ class Procedure < ApplicationRecord attestation_template: nil, types_de_champ: [:drop_down_list, types_de_champ: :drop_down_list], types_de_champ_private: [:drop_down_list, types_de_champ: :drop_down_list] - }) + }, &method(:clone_attachments)) procedure.path = nil procedure.aasm_state = :brouillon procedure.test_started_at = nil diff --git a/spec/factories/type_de_champ.rb b/spec/factories/type_de_champ.rb index 26df602b2..2bc898b09 100644 --- a/spec/factories/type_de_champ.rb +++ b/spec/factories/type_de_champ.rb @@ -86,6 +86,10 @@ FactoryBot.define do end factory :type_de_champ_piece_justificative do type_champ { TypeDeChamp.type_champs.fetch(:piece_justificative) } + + after(:create) do |tc, _evaluator| + tc.piece_justificative_template.attach(io: StringIO.new("toto"), filename: "toto.txt", content_type: "text/plain") + end end factory :type_de_champ_siret do type_champ { TypeDeChamp.type_champs.fetch(:siret) } diff --git a/spec/models/procedure_spec.rb b/spec/models/procedure_spec.rb index fe4e74f70..3148b3d76 100644 --- a/spec/models/procedure_spec.rb +++ b/spec/models/procedure_spec.rb @@ -485,6 +485,10 @@ describe Procedure do expect(subject.types_de_champ.first.id).not_to eq(procedure.types_de_champ.first.id) expect(subject.types_de_champ.first.stable_id).to eq(procedure.types_de_champ.first.id) end + + it 'should duplicate piece_justificative_template on a type_de_champ' do + expect(subject.types_de_champ.where(type_champ: "piece_justificative").first.piece_justificative_template.attached?).to be true + end end describe '#publish!' do From 40d644ea3f8a5b651c9f8b49545d5c0355c1fd7d Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Tue, 26 Mar 2019 11:39:06 +0100 Subject: [PATCH 11/11] Add a confirm before procedure deletion --- app/views/admin/procedures/_list.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/procedures/_list.html.haml b/app/views/admin/procedures/_list.html.haml index 8fcb04aee..39f9a4a4a 100644 --- a/app/views/admin/procedures/_list.html.haml +++ b/app/views/admin/procedures/_list.html.haml @@ -26,7 +26,7 @@ %td = link_to('Cloner', admin_procedure_clone_path(procedure.id), data: { method: :put }, class: 'btn-sm btn-primary clone-btn') - if !procedure.publiee_ou_archivee? - = link_to('X', url_for(controller: 'admin/procedures', action: :destroy, id: procedure.id), data: { method: :delete }, class: 'btn-sm btn-danger') + = link_to('X', url_for(controller: 'admin/procedures', action: :destroy, id: procedure.id), data: { method: :delete, confirm: "Confirmez-vous la suppression de la démarche ?" }, class: 'btn-sm btn-danger') = smart_listing.paginate = smart_listing.pagination_per_page_links