From f7842fa4bdf3a8ffe6799da0a9df97af57c936c6 Mon Sep 17 00:00:00 2001 From: clemkeirua Date: Thu, 18 Jul 2019 09:36:19 +0200 Subject: [PATCH 01/15] ajout d'un message lorsque le dossier fait plus de 50Mo --- app/views/gestionnaires/dossiers/_header.html.haml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/views/gestionnaires/dossiers/_header.html.haml b/app/views/gestionnaires/dossiers/_header.html.haml index 61afc1361..1eda6a77a 100644 --- a/app/views/gestionnaires/dossiers/_header.html.haml +++ b/app/views/gestionnaires/dossiers/_header.html.haml @@ -18,13 +18,16 @@ = link_to "Tout le dossier", print_gestionnaire_dossier_path(dossier.procedure, dossier), target: "_blank", rel: "noopener", class: "menu-item menu-link" %li = link_to "Uniquement cet onglet", "#", onclick: "window.print()", class: "menu-item menu-link" - - if Flipflop.download_as_zip_enabled? && dossier.attachments_downloadable? + - if Flipflop.download_as_zip_enabled? && !PiecesJustificativesService.liste_pieces_justificatives(dossier).empty? %span.dropdown.print-menu-opener %button.button.dropdown-button.icon-only %span.icon.attachment %ul.print-menu.dropdown-content %li - = link_to "Télécharger toutes les pièces jointes", telecharger_pjs_gestionnaire_dossier_path(dossier.procedure, dossier), target: "_blank", rel: "noopener", class: "menu-item menu-link" + - if PiecesJustificativesService.pieces_justificatives_total_size(dossier) < 50.megabytes + = link_to "Télécharger toutes les pièces jointes", telecharger_pjs_gestionnaire_dossier_path(dossier.procedure, dossier), target: "_blank", rel: "noopener", class: "menu-item menu-link" + - else + %p.menu-item Le téléchargement des dossiers est désactivé pour les dossiers de plus de 50Mo. = render partial: "gestionnaires/procedures/dossier_actions", locals: { procedure: dossier.procedure, dossier: dossier, dossier_is_followed: current_gestionnaire&.follow?(dossier) } From d62740c198eb5758931d6949373529a99b5d5635 Mon Sep 17 00:00:00 2001 From: clemkeirua Date: Thu, 18 Jul 2019 16:47:59 +0200 Subject: [PATCH 02/15] extraction de la taille max des fichiers dans une constante --- app/models/dossier.rb | 4 +++- app/views/gestionnaires/dossiers/_header.html.haml | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/models/dossier.rb b/app/models/dossier.rb index a0251397b..0c80cf727 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -15,6 +15,8 @@ class Dossier < ApplicationRecord INSTRUCTION_COMMENCEE = TERMINE + [states.fetch(:en_instruction)] SOUMIS = EN_CONSTRUCTION_OU_INSTRUCTION + TERMINE + TAILLE_MAX_ZIP = 50.megabytes + has_one :etablissement, dependent: :destroy has_one :individual, dependent: :destroy has_one :attestation, dependent: :destroy @@ -461,7 +463,7 @@ class Dossier < ApplicationRecord end def attachments_downloadable? - !PiecesJustificativesService.liste_pieces_justificatives(self).empty? && PiecesJustificativesService.pieces_justificatives_total_size(self) < 50.megabytes + !PiecesJustificativesService.liste_pieces_justificatives(self).empty? && PiecesJustificativesService.pieces_justificatives_total_size(self) < Dossier::TAILLE_MAX_ZIP end private diff --git a/app/views/gestionnaires/dossiers/_header.html.haml b/app/views/gestionnaires/dossiers/_header.html.haml index 1eda6a77a..77a9debbe 100644 --- a/app/views/gestionnaires/dossiers/_header.html.haml +++ b/app/views/gestionnaires/dossiers/_header.html.haml @@ -24,10 +24,10 @@ %span.icon.attachment %ul.print-menu.dropdown-content %li - - if PiecesJustificativesService.pieces_justificatives_total_size(dossier) < 50.megabytes + - if PiecesJustificativesService.pieces_justificatives_total_size(dossier) < Dossier::TAILLE_MAX_ZIP = link_to "Télécharger toutes les pièces jointes", telecharger_pjs_gestionnaire_dossier_path(dossier.procedure, dossier), target: "_blank", rel: "noopener", class: "menu-item menu-link" - else - %p.menu-item Le téléchargement des dossiers est désactivé pour les dossiers de plus de 50Mo. + %p.menu-item Le téléchargement des pièces jointes est désactivé pour les dossiers de plus de #{number_to_human_size Dossier::TAILLE_MAX_ZIP}. = render partial: "gestionnaires/procedures/dossier_actions", locals: { procedure: dossier.procedure, dossier: dossier, dossier_is_followed: current_gestionnaire&.follow?(dossier) } From 2e107babfb0e2b74d163ec2b0ca26917d29e50f9 Mon Sep 17 00:00:00 2001 From: clemkeirua Date: Thu, 18 Jul 2019 16:51:34 +0200 Subject: [PATCH 03/15] meilleures marges monavis --- app/assets/stylesheets/new_design/merci.scss | 6 ++++++ app/views/users/dossiers/merci.html.haml | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/new_design/merci.scss b/app/assets/stylesheets/new_design/merci.scss index b9986c443..d6f7f5d15 100644 --- a/app/assets/stylesheets/new_design/merci.scss +++ b/app/assets/stylesheets/new_design/merci.scss @@ -30,4 +30,10 @@ a { margin-top: 40px; } + + .monavis { + img { + margin-top: 2*$default-padding; + } + } } diff --git a/app/views/users/dossiers/merci.html.haml b/app/views/users/dossiers/merci.html.haml index 941ffe36f..784df656d 100644 --- a/app/views/users/dossiers/merci.html.haml +++ b/app/views/users/dossiers/merci.html.haml @@ -23,4 +23,5 @@ .flex.column.align-center = link_to 'Accéder à votre dossier', dossier_path(@dossier), class: 'button large primary' = link_to 'Déposer un autre dossier', procedure_lien(@dossier.procedure) - != @dossier.procedure.monavis_embed + %div.monavis + != @dossier.procedure.monavis_embed From 50ddf723b0a99510d3df8bc5bde4176d3d95db75 Mon Sep 17 00:00:00 2001 From: clemkeirua Date: Thu, 18 Jul 2019 17:16:36 +0200 Subject: [PATCH 04/15] =?UTF-8?q?garde=20le=20bandeau=20bleu=20de=20naviga?= =?UTF-8?q?tion=20apr=C3=A8s=20MAJ?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/stylesheets/new_design/merci.scss | 2 +- app/views/admin/procedures/monavis.html.haml | 2 +- ...ft_panel_admin_procedurescontroller_update_monavis.html.haml | 1 + .../_navbar_admin_procedurescontroller_monavis.html.haml | 1 + .../_navbar_admin_procedurescontroller_update_monavis.html.haml | 1 + app/views/users/dossiers/merci.html.haml | 2 +- 6 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_update_monavis.html.haml create mode 100644 app/views/layouts/navbars/_navbar_admin_procedurescontroller_monavis.html.haml create mode 100644 app/views/layouts/navbars/_navbar_admin_procedurescontroller_update_monavis.html.haml diff --git a/app/assets/stylesheets/new_design/merci.scss b/app/assets/stylesheets/new_design/merci.scss index d6f7f5d15..e52b91bb2 100644 --- a/app/assets/stylesheets/new_design/merci.scss +++ b/app/assets/stylesheets/new_design/merci.scss @@ -33,7 +33,7 @@ .monavis { img { - margin-top: 2*$default-padding; + margin-top: 2 * $default-padding; } } } diff --git a/app/views/admin/procedures/monavis.html.haml b/app/views/admin/procedures/monavis.html.haml index 226c2f24b..0b55058a2 100644 --- a/app/views/admin/procedures/monavis.html.haml +++ b/app/views/admin/procedures/monavis.html.haml @@ -1,6 +1,6 @@ .row.white-back #procedure_new.section.section-label - = form_for @procedure, url: url_for({ controller: 'admin/procedures', action: :update_monavis, id: @procedure.id }), multipart: true do |f| + = form_for @procedure, url: url_for({ controller: 'admin/procedures', action: :update_monavis }), multipart: true do |f| = render partial: 'monavis', locals: { f: f } .text-right = f.button 'Enregistrer', class: 'btn btn-success' diff --git a/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_update_monavis.html.haml b/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_update_monavis.html.haml new file mode 100644 index 000000000..fad3db3bb --- /dev/null +++ b/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_update_monavis.html.haml @@ -0,0 +1 @@ += render partial: 'layouts/left_panels/left_panel_admin_procedurescontroller_navbar', locals: { active: 'MonAvis' } diff --git a/app/views/layouts/navbars/_navbar_admin_procedurescontroller_monavis.html.haml b/app/views/layouts/navbars/_navbar_admin_procedurescontroller_monavis.html.haml new file mode 100644 index 000000000..1ff68e01a --- /dev/null +++ b/app/views/layouts/navbars/_navbar_admin_procedurescontroller_monavis.html.haml @@ -0,0 +1 @@ += render partial: 'layouts/navbars/navbar_admin_procedurescontroller_index' diff --git a/app/views/layouts/navbars/_navbar_admin_procedurescontroller_update_monavis.html.haml b/app/views/layouts/navbars/_navbar_admin_procedurescontroller_update_monavis.html.haml new file mode 100644 index 000000000..1ff68e01a --- /dev/null +++ b/app/views/layouts/navbars/_navbar_admin_procedurescontroller_update_monavis.html.haml @@ -0,0 +1 @@ += render partial: 'layouts/navbars/navbar_admin_procedurescontroller_index' diff --git a/app/views/users/dossiers/merci.html.haml b/app/views/users/dossiers/merci.html.haml index 784df656d..4cd67b54b 100644 --- a/app/views/users/dossiers/merci.html.haml +++ b/app/views/users/dossiers/merci.html.haml @@ -23,5 +23,5 @@ .flex.column.align-center = link_to 'Accéder à votre dossier', dossier_path(@dossier), class: 'button large primary' = link_to 'Déposer un autre dossier', procedure_lien(@dossier.procedure) - %div.monavis + .monavis != @dossier.procedure.monavis_embed From af6172d0e8c82a2679e98634eccb9dcdb6616c03 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 22 Jul 2019 11:48:28 +0200 Subject: [PATCH 05/15] suivi: explain how to disable tracking --- app/views/root/suivi.html.haml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/views/root/suivi.html.haml b/app/views/root/suivi.html.haml index c56519619..85525d1ed 100644 --- a/app/views/root/suivi.html.haml +++ b/app/views/root/suivi.html.haml @@ -18,6 +18,10 @@ %br Nous utilisons pour cela Matomo, un outil libre, paramétré pour être en conformité avec la recommandation « Cookies » de la CNIL. Cela signifie que votre adresse IP, par exemple, est anonymisée avant d’être enregistrée. Il est donc impossible d’associer vos visites sur ce site à votre personne. + %h2.new-h2 Comment désactiver le suivi statistique sur mon navigateur ? + %p.new-p + Si vous souhaitez désactiver ce suivi statistique, il vous suffit d’activer la fonctionnalité « Ne pas me pister » de votre navigateur. Notre outil de suivi le prendra en compte, et cessera d’inclure vos visites dans les statistiques. + %h2.new-h2 Je contribue à enrichir vos données, puis-je y accéder ? %p.new-p Bien sûr ! Les statistiques d’usage sont en accès libre sur stats.data.gouv.fr. From dbe03d4f740a474db7a03af0e09fa68945d046ca Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 22 Jul 2019 11:49:09 +0200 Subject: [PATCH 06/15] suivi: remove link to stats dashboard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The dashboard is currently private–and it currently contains sensitive informations that are hard to filter out. --- app/views/root/suivi.html.haml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/views/root/suivi.html.haml b/app/views/root/suivi.html.haml index 85525d1ed..12f4a963b 100644 --- a/app/views/root/suivi.html.haml +++ b/app/views/root/suivi.html.haml @@ -21,7 +21,3 @@ %h2.new-h2 Comment désactiver le suivi statistique sur mon navigateur ? %p.new-p Si vous souhaitez désactiver ce suivi statistique, il vous suffit d’activer la fonctionnalité « Ne pas me pister » de votre navigateur. Notre outil de suivi le prendra en compte, et cessera d’inclure vos visites dans les statistiques. - - %h2.new-h2 Je contribue à enrichir vos données, puis-je y accéder ? - %p.new-p - Bien sûr ! Les statistiques d’usage sont en accès libre sur stats.data.gouv.fr. From f32357f527cd1c3d013a72314b5410e9c3cc20e0 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 22 Jul 2019 16:10:18 +0200 Subject: [PATCH 07/15] specs: avoid weird hacks to test NotificationMailer private method - testing private methods is a code smell - this setup is especially brittle - we test the equivalent public method right below --- spec/mailers/notification_mailer_spec.rb | 81 ++++++++++++------------ 1 file changed, 39 insertions(+), 42 deletions(-) diff --git a/spec/mailers/notification_mailer_spec.rb b/spec/mailers/notification_mailer_spec.rb index b0d203807..4d28508b9 100644 --- a/spec/mailers/notification_mailer_spec.rb +++ b/spec/mailers/notification_mailer_spec.rb @@ -1,58 +1,55 @@ require "spec_helper" RSpec.describe NotificationMailer, type: :mailer do - shared_examples_for "create a commentaire not notified" do - it do - expect { subject.deliver_now }.to change { Commentaire.count }.by(1) - - subject.deliver_now - commentaire = Commentaire.last - expect(commentaire.body).to include(email_template.subject_for_dossier(dossier), email_template.body_for_dossier(dossier)) - expect(commentaire.dossier).to eq(dossier) - end - end - let(:user) { create(:user) } - let(:dossier) { create(:dossier, :with_service, :en_construction, user: user) } - - describe '.send_notification' do - let(:email_template) { instance_double('email_template', subject_for_dossier: 'subject', body_for_dossier: 'body') } - - subject(:mail) do - klass = Class.new(described_class) do - # We’re testing the (private) method `NotificationMailer#send_notification`. - # - # The standard trick to test a private method would be to `send(:send_notification)`, but doesn’t work here, - # because ActionMailer does some magic to expose public instance methods as class methods. - # So, we use inheritance instead to make the private method public for testing purposes. - def send_notification(dossier, template) - super - end - end - klass.send_notification(dossier, email_template) - end - - it { expect(mail.subject).to eq(email_template.subject_for_dossier) } - it { expect(mail.body).to include(email_template.body_for_dossier) } - it { expect(mail.body).to have_link('messagerie') } - - it_behaves_like "create a commentaire not notified" - end + let(:procedure) { create(:simple_procedure) } + let(:dossier) { create(:dossier, :en_construction, :for_individual, :with_service, user: user, procedure: procedure) } describe '.send_dossier_received' do - subject(:mail) { described_class.send_dossier_received(dossier) } - let(:email_template) { create(:received_mail) } + let(:email_template) { create(:received_mail, subject: 'Email subject', body: 'Your dossier was processed. Thanks.') } before do dossier.procedure.received_mail = email_template end - it do - expect(mail.subject).to eq(email_template.subject) - expect(mail.body).to include(email_template.body) + subject(:mail) { described_class.send_dossier_received(dossier) } + + it 'creates a commentaire in the messagerie' do + expect { subject.deliver_now }.to change { Commentaire.count }.by(1) + + commentaire = Commentaire.last + expect(commentaire.body).to include(email_template.subject_for_dossier(dossier), email_template.body_for_dossier(dossier)) + expect(commentaire.dossier).to eq(dossier) + end + + it 'renders the template' do + expect(mail.subject).to eq('Email subject') + expect(mail.body).to include('Your dossier was processed') expect(mail.body).to have_link('messagerie') end - it_behaves_like "create a commentaire not notified" + context 'when the template body contains tags' do + let(:email_template) { create(:received_mail, subject: 'Email subject', body: 'Hello --nom--, your dossier --lien dossier-- was processed.') } + + it 'replaces value tags with the proper value' do + expect(mail.body).to have_content(dossier.individual.nom) + end + + it 'replaces link tags with a clickable link' do + expect(mail.body).to have_link(dossier_url(dossier)) + end + end + + context 'when the template body contains HTML' do + let(:email_template) { create(:received_mail, body: 'Your dossier was processed. ') } + + it 'allows basic formatting tags' do + expect(mail.body).to include('dossier') + end + + it 'sanitizes sensitive content' do + expect(mail.body).not_to include('iframe') + end + end end end From 45abb6ebc290fe6ab6b6b703eabd9a859ca43b4c Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Thu, 18 Jul 2019 18:25:11 +0200 Subject: [PATCH 08/15] mailers: move default templates to a specific subdirectory It makes more understandable that they are templates (and not views rendered directly by Rails). --- app/models/mails/closed_mail.rb | 4 ++-- app/models/mails/initiated_mail.rb | 2 +- app/models/mails/received_mail.rb | 2 +- app/models/mails/refused_mail.rb | 2 +- app/models/mails/without_continuation_mail.rb | 2 +- .../{ => default_templates}/_signature.html.haml | 0 .../{ => default_templates}/closed_mail.html.haml | 2 +- .../closed_mail_with_attestation.html.haml | 2 +- .../{ => default_templates}/initiated_mail.html.haml | 2 +- .../{ => default_templates}/received_mail.html.haml | 2 +- .../{ => default_templates}/refused_mail.html.haml | 2 +- .../without_continuation_mail.html.haml | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) rename app/views/notification_mailer/{ => default_templates}/_signature.html.haml (100%) rename app/views/notification_mailer/{ => default_templates}/closed_mail.html.haml (78%) rename app/views/notification_mailer/{ => default_templates}/closed_mail_with_attestation.html.haml (83%) rename app/views/notification_mailer/{ => default_templates}/initiated_mail.html.haml (79%) rename app/views/notification_mailer/{ => default_templates}/received_mail.html.haml (74%) rename app/views/notification_mailer/{ => default_templates}/refused_mail.html.haml (82%) rename app/views/notification_mailer/{ => default_templates}/without_continuation_mail.html.haml (83%) diff --git a/app/models/mails/closed_mail.rb b/app/models/mails/closed_mail.rb index a0245bac6..03888a50c 100644 --- a/app/models/mails/closed_mail.rb +++ b/app/models/mails/closed_mail.rb @@ -12,9 +12,9 @@ module Mails def self.default_template_name_for_procedure(procedure) attestation_template = procedure.attestation_template if attestation_template&.activated? - "notification_mailer/closed_mail_with_attestation" + "notification_mailer/default_templates/closed_mail_with_attestation" else - "notification_mailer/closed_mail" + "notification_mailer/default_templates/closed_mail" end end end diff --git a/app/models/mails/initiated_mail.rb b/app/models/mails/initiated_mail.rb index fc32ae5da..9653b8d8c 100644 --- a/app/models/mails/initiated_mail.rb +++ b/app/models/mails/initiated_mail.rb @@ -5,7 +5,7 @@ module Mails belongs_to :procedure SLUG = "initiated_mail" - DEFAULT_TEMPLATE_NAME = "notification_mailer/initiated_mail" + DEFAULT_TEMPLATE_NAME = "notification_mailer/default_templates/initiated_mail" DISPLAYED_NAME = 'Accusé de réception' DEFAULT_SUBJECT = 'Votre dossier nº --numéro du dossier-- a bien été reçu (--libellé démarche--)' DOSSIER_STATE = Dossier.states.fetch(:en_construction) diff --git a/app/models/mails/received_mail.rb b/app/models/mails/received_mail.rb index 5cb3258e1..8e1c73b24 100644 --- a/app/models/mails/received_mail.rb +++ b/app/models/mails/received_mail.rb @@ -5,7 +5,7 @@ module Mails belongs_to :procedure SLUG = "received_mail" - DEFAULT_TEMPLATE_NAME = "notification_mailer/received_mail" + DEFAULT_TEMPLATE_NAME = "notification_mailer/default_templates/received_mail" DISPLAYED_NAME = 'Accusé de passage en instruction' DEFAULT_SUBJECT = 'Votre dossier nº --numéro du dossier-- va être instruit (--libellé démarche--)' DOSSIER_STATE = Dossier.states.fetch(:en_instruction) diff --git a/app/models/mails/refused_mail.rb b/app/models/mails/refused_mail.rb index d4b4d25db..ad598d859 100644 --- a/app/models/mails/refused_mail.rb +++ b/app/models/mails/refused_mail.rb @@ -5,7 +5,7 @@ module Mails belongs_to :procedure SLUG = "refused_mail" - DEFAULT_TEMPLATE_NAME = "notification_mailer/refused_mail" + DEFAULT_TEMPLATE_NAME = "notification_mailer/default_templates/refused_mail" DISPLAYED_NAME = 'Accusé de rejet du dossier' DEFAULT_SUBJECT = 'Votre dossier nº --numéro du dossier-- a été refusé (--libellé démarche--)' DOSSIER_STATE = Dossier.states.fetch(:refuse) diff --git a/app/models/mails/without_continuation_mail.rb b/app/models/mails/without_continuation_mail.rb index 11cd9a182..449bd40ab 100644 --- a/app/models/mails/without_continuation_mail.rb +++ b/app/models/mails/without_continuation_mail.rb @@ -5,7 +5,7 @@ module Mails belongs_to :procedure SLUG = "without_continuation" - DEFAULT_TEMPLATE_NAME = "notification_mailer/without_continuation_mail" + DEFAULT_TEMPLATE_NAME = "notification_mailer/default_templates/without_continuation_mail" DISPLAYED_NAME = 'Accusé de classement sans suite' DEFAULT_SUBJECT = 'Votre dossier nº --numéro du dossier-- a été classé sans suite (--libellé démarche--)' DOSSIER_STATE = Dossier.states.fetch(:sans_suite) diff --git a/app/views/notification_mailer/_signature.html.haml b/app/views/notification_mailer/default_templates/_signature.html.haml similarity index 100% rename from app/views/notification_mailer/_signature.html.haml rename to app/views/notification_mailer/default_templates/_signature.html.haml diff --git a/app/views/notification_mailer/closed_mail.html.haml b/app/views/notification_mailer/default_templates/closed_mail.html.haml similarity index 78% rename from app/views/notification_mailer/closed_mail.html.haml rename to app/views/notification_mailer/default_templates/closed_mail.html.haml index dcaf366be..8af4e8e82 100644 --- a/app/views/notification_mailer/closed_mail.html.haml +++ b/app/views/notification_mailer/default_templates/closed_mail.html.haml @@ -7,4 +7,4 @@ %p À tout moment, vous pouvez consulter votre dossier et les éventuels messages de l'administration à cette adresse : --lien dossier-- -= render partial: "notification_mailer/signature" += render partial: "notification_mailer/default_templates/signature" diff --git a/app/views/notification_mailer/closed_mail_with_attestation.html.haml b/app/views/notification_mailer/default_templates/closed_mail_with_attestation.html.haml similarity index 83% rename from app/views/notification_mailer/closed_mail_with_attestation.html.haml rename to app/views/notification_mailer/default_templates/closed_mail_with_attestation.html.haml index 22dce3d5a..1c95b1ca7 100644 --- a/app/views/notification_mailer/closed_mail_with_attestation.html.haml +++ b/app/views/notification_mailer/default_templates/closed_mail_with_attestation.html.haml @@ -10,4 +10,4 @@ %p À tout moment, vous pouvez consulter votre dossier et les éventuels messages de l'administration à cette adresse : --lien dossier-- -= render partial: "notification_mailer/signature" += render partial: "notification_mailer/default_templates/signature" diff --git a/app/views/notification_mailer/initiated_mail.html.haml b/app/views/notification_mailer/default_templates/initiated_mail.html.haml similarity index 79% rename from app/views/notification_mailer/initiated_mail.html.haml rename to app/views/notification_mailer/default_templates/initiated_mail.html.haml index 91007a340..de2c1c91a 100644 --- a/app/views/notification_mailer/initiated_mail.html.haml +++ b/app/views/notification_mailer/default_templates/initiated_mail.html.haml @@ -7,4 +7,4 @@ %p À tout moment, vous pouvez consulter votre dossier et les éventuels messages de l'administration à cette adresse : --lien dossier-- -= render partial: "notification_mailer/signature" += render partial: "notification_mailer/default_templates/signature" diff --git a/app/views/notification_mailer/received_mail.html.haml b/app/views/notification_mailer/default_templates/received_mail.html.haml similarity index 74% rename from app/views/notification_mailer/received_mail.html.haml rename to app/views/notification_mailer/default_templates/received_mail.html.haml index d006d6271..234d1b1fe 100644 --- a/app/views/notification_mailer/received_mail.html.haml +++ b/app/views/notification_mailer/default_templates/received_mail.html.haml @@ -4,4 +4,4 @@ %p Votre administration vous confirme la bonne réception de votre dossier nº --numéro du dossier--. Celui-ci sera instruit dans le délai légal déclaré par votre interlocuteur. -= render partial: "notification_mailer/signature" += render partial: "notification_mailer/default_templates/signature" diff --git a/app/views/notification_mailer/refused_mail.html.haml b/app/views/notification_mailer/default_templates/refused_mail.html.haml similarity index 82% rename from app/views/notification_mailer/refused_mail.html.haml rename to app/views/notification_mailer/default_templates/refused_mail.html.haml index f45054ca2..5cf09152f 100644 --- a/app/views/notification_mailer/refused_mail.html.haml +++ b/app/views/notification_mailer/default_templates/refused_mail.html.haml @@ -10,4 +10,4 @@ %p Pour en savoir plus sur le motif du refus, vous pouvez consulter votre dossier et les éventuels messages de l'administration à cette adresse : --lien dossier-- -= render partial: "notification_mailer/signature" += render partial: "notification_mailer/default_templates/signature" diff --git a/app/views/notification_mailer/without_continuation_mail.html.haml b/app/views/notification_mailer/default_templates/without_continuation_mail.html.haml similarity index 83% rename from app/views/notification_mailer/without_continuation_mail.html.haml rename to app/views/notification_mailer/default_templates/without_continuation_mail.html.haml index c397c1adc..731d65f08 100644 --- a/app/views/notification_mailer/without_continuation_mail.html.haml +++ b/app/views/notification_mailer/default_templates/without_continuation_mail.html.haml @@ -10,4 +10,4 @@ %p Pour en savoir plus sur les raisons de ce classement sans suite, vous pouvez consulter votre dossier et les éventuels messages de l'administration à cette adresse : --lien dossier-- -= render partial: "notification_mailer/signature" += render partial: "notification_mailer/default_templates/signature" From 5bbcd600fb5436740f7c369a586d94a3950f083a Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Tue, 23 Jul 2019 12:45:44 +0000 Subject: [PATCH 09/15] mailers: extract more of the template to partials This will allow to re-use these partials in other emails --- app/views/layouts/mailers/_logo.html.haml | 5 +++ .../layouts/mailers/_service_footer.html.haml | 34 +++++++++++++++ .../layouts/mailers/notification.html.haml | 43 ++----------------- 3 files changed, 42 insertions(+), 40 deletions(-) create mode 100644 app/views/layouts/mailers/_logo.html.haml create mode 100644 app/views/layouts/mailers/_service_footer.html.haml diff --git a/app/views/layouts/mailers/_logo.html.haml b/app/views/layouts/mailers/_logo.html.haml new file mode 100644 index 000000000..2b0aa1ae2 --- /dev/null +++ b/app/views/layouts/mailers/_logo.html.haml @@ -0,0 +1,5 @@ +- if url.present? + %table{ width: "100%", border: "0", cellspacing: "0", cellpadding: "0" } + %tr + %td{ align: "center" } + = image_tag url, height: "150", style: "display:block; max-height: 150px; max-width: 150px;" diff --git a/app/views/layouts/mailers/_service_footer.html.haml b/app/views/layouts/mailers/_service_footer.html.haml new file mode 100644 index 000000000..c60d887b6 --- /dev/null +++ b/app/views/layouts/mailers/_service_footer.html.haml @@ -0,0 +1,34 @@ +%strong + Merci de ne pas répondre à cet email. + - if dossier.present? && dossier.messagerie_available? + Pour vous adresser à votre administration, passez directement par la + = succeed '.' do + = link_to 'messagerie du dossier', messagerie_dossier_url(dossier), target: '_blank', rel: 'noopener' + +- if service.present? + %table{ width: "100%", border: "0", cellspacing: "0", cellpadding: "0", style: "cursor:auto;color:#55575d;font-family:Helvetica, Arial, sans-serif;font-size:11px;line-height:22px;text-align:left;" } + %tr + %td{ width: "50%", valign: "top" } + %p + %strong Cette démarche est gérée par : + %br + = service.nom + %br + = service.organisme + %br + = service.adresse + %td{ width: "50%", valign: "top" } + %p + %strong Poser une question sur votre dossier : + %br + - if dossier.present? && dossier.messagerie_available? + = link_to 'Par la messagerie', messagerie_dossier_url(dossier), target: '_blank', rel: 'noopener' + - else + Par email : + = link_to service.email, "mailto:#{service.email}" + %br + Par téléphone : + = link_to service.telephone, "tel:#{service.telephone}" + %br + Horaires : #{ formatted_horaires(service.horaires) } + diff --git a/app/views/layouts/mailers/notification.html.haml b/app/views/layouts/mailers/notification.html.haml index 04da35e63..ca9f84d73 100644 --- a/app/views/layouts/mailers/notification.html.haml +++ b/app/views/layouts/mailers/notification.html.haml @@ -1,44 +1,7 @@ -- if @logo_url.present? - - content_for :procedure_logo do - %table{ width: "100%", border: "0", cellspacing: "0", cellpadding: "0" } - %tr - %td{ align: "center" } - = image_tag @logo_url, height: "150", style: "display:block; max-height: 150px; max-width: 150px;" +- content_for :procedure_logo do + = render 'layouts/mailers/logo', url: @logo_url - content_for :footer do - %strong - Merci de ne pas répondre à cet email. - - if @dossier.present? && @dossier.messagerie_available? - Pour vous adresser à votre administration, passez directement par la - = succeed '.' do - = link_to 'messagerie du dossier', messagerie_dossier_url(@dossier), target: '_blank', rel: 'noopener' - - - if @service.present? - %table{ width: "100%", border: "0", cellspacing: "0", cellpadding: "0", style: "cursor:auto;color:#55575d;font-family:Helvetica, Arial, sans-serif;font-size:11px;line-height:22px;text-align:left;" } - %tr - %td{ width: "50%", valign: "top" } - %p - %strong Cette démarche est gérée par : - %br - = @service.nom - %br - = @service.organisme - %br - = @service.adresse - %td{ width: "50%", valign: "top" } - %p - %strong Poser une question sur votre dossier : - %br - - if @dossier.present? && @dossier.messagerie_available? - = link_to 'Par la messagerie', messagerie_dossier_url(@dossier), target: '_blank', rel: 'noopener' - - else - Par email : - = link_to @service.email, "mailto:#{@service.email}" - %br - Par téléphone : - = link_to @service.telephone, "tel:#{@service.telephone}" - %br - Horaires : #{ formatted_horaires(@service.horaires) } - + = render 'layouts/mailers/service_footer', service: @service, dossier: @dossier = render template: 'layouts/mailers/notifications_layout' From 858b093314c6c8d03a4540c239d1cd02335ddaf8 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 22 Jul 2019 13:49:11 +0000 Subject: [PATCH 10/15] mailers: use the standard view mechanism to render notifications Instead of rendering a view as a template, consider the view as a normal view. --- .../new_administrateur/mail_templates_controller.rb | 3 ++- app/mailers/dossier_mailer.rb | 4 ++-- app/mailers/notification_mailer.rb | 11 ++++++----- app/views/dossier_mailer/notify_new_answer.html.haml | 8 +++++++- app/views/dossier_mailer/notify_new_draft.html.haml | 8 +++++++- .../send_notification.html.haml} | 4 ++-- spec/mailers/dossier_mailer_spec.rb | 10 ++++++++++ 7 files changed, 36 insertions(+), 12 deletions(-) rename app/views/{layouts/mailers/notification.html.haml => notification_mailer/send_notification.html.haml} (76%) diff --git a/app/controllers/new_administrateur/mail_templates_controller.rb b/app/controllers/new_administrateur/mail_templates_controller.rb index 7bc7dfba6..32039afa3 100644 --- a/app/controllers/new_administrateur/mail_templates_controller.rb +++ b/app/controllers/new_administrateur/mail_templates_controller.rb @@ -8,8 +8,9 @@ module NewAdministrateur @service = procedure.service mail_template = find_mail_template_by_slug(params[:id]) + @rendered_template = sanitize(mail_template.body) - render(html: sanitize(mail_template.body), layout: 'mailers/notification') + render(template: 'notification_mailer/send_notification', layout: 'mailers/notifications_layout') end private diff --git a/app/mailers/dossier_mailer.rb b/app/mailers/dossier_mailer.rb index 613b64775..ce00ce63f 100644 --- a/app/mailers/dossier_mailer.rb +++ b/app/mailers/dossier_mailer.rb @@ -13,7 +13,7 @@ class DossierMailer < ApplicationMailer subject = "Retrouvez votre brouillon pour la démarche « #{dossier.procedure.libelle} »" mail(to: dossier.user.email, subject: subject) do |format| - format.html { render layout: 'mailers/notification' } + format.html { render layout: 'mailers/notifications_layout' } end end @@ -25,7 +25,7 @@ class DossierMailer < ApplicationMailer subject = "Nouveau message pour votre dossier nº #{dossier.id} (#{dossier.procedure.libelle})" mail(to: dossier.user.email, subject: subject) do |format| - format.html { render layout: 'mailers/notification' } + format.html { render layout: 'mailers/notifications_layout' } end end diff --git a/app/mailers/notification_mailer.rb b/app/mailers/notification_mailer.rb index 87379f6df..816ff2c7c 100644 --- a/app/mailers/notification_mailer.rb +++ b/app/mailers/notification_mailer.rb @@ -6,8 +6,12 @@ # The subject and body of a Notification can be customized by each demarche. # class NotificationMailer < ApplicationMailer + include ActionView::Helpers::SanitizeHelper + helper ServiceHelper + layout 'mailers/notifications_layout' + def send_dossier_received(dossier) send_notification(dossier, dossier.procedure.received_mail_template) end @@ -41,12 +45,9 @@ class NotificationMailer < ApplicationMailer @dossier = dossier @service = dossier.procedure.service @logo_url = attach_logo(dossier.procedure) + @rendered_template = sanitize(body) - mail(subject: subject, to: email) do |format| - # rubocop:disable Rails/OutputSafety - format.html { render(html: body.html_safe, layout: 'mailers/notification') } - # rubocop:enable Rails/OutputSafety - end + mail(subject: subject, to: email, template_name: 'send_notification') end def create_commentaire_for_notification(dossier, subject, body) diff --git a/app/views/dossier_mailer/notify_new_answer.html.haml b/app/views/dossier_mailer/notify_new_answer.html.haml index 502b5a985..3e0195afe 100644 --- a/app/views/dossier_mailer/notify_new_answer.html.haml +++ b/app/views/dossier_mailer/notify_new_answer.html.haml @@ -1,3 +1,6 @@ +- content_for :procedure_logo do + = render 'layouts/mailers/logo', url: @logo_url + %p Bonjour, @@ -10,4 +13,7 @@ = round_button('Lire le message', messagerie_dossier_url(@dossier)) -= render partial: "layouts/mailers/signature", locals: { service: @service } += render 'layouts/mailers/signature', service: @service + +- content_for :footer do + = render 'layouts/mailers/service_footer', service: @service, dossier: @dossier diff --git a/app/views/dossier_mailer/notify_new_draft.html.haml b/app/views/dossier_mailer/notify_new_draft.html.haml index 9c3a63a9a..fc22af857 100644 --- a/app/views/dossier_mailer/notify_new_draft.html.haml +++ b/app/views/dossier_mailer/notify_new_draft.html.haml @@ -1,3 +1,6 @@ +- content_for :procedure_logo do + = render 'layouts/mailers/logo', url: @logo_url + %p Bonjour, @@ -10,4 +13,7 @@ à l’adresse suivante : = link_to dossier_url(@dossier), dossier_url(@dossier), target: '_blank', rel: 'noopener' -= render partial: "layouts/mailers/signature" += render 'layouts/mailers/signature' + +- content_for :footer do + = render 'layouts/mailers/service_footer', service: @service, dossier: @dossier diff --git a/app/views/layouts/mailers/notification.html.haml b/app/views/notification_mailer/send_notification.html.haml similarity index 76% rename from app/views/layouts/mailers/notification.html.haml rename to app/views/notification_mailer/send_notification.html.haml index ca9f84d73..875806f48 100644 --- a/app/views/layouts/mailers/notification.html.haml +++ b/app/views/notification_mailer/send_notification.html.haml @@ -1,7 +1,7 @@ - content_for :procedure_logo do = render 'layouts/mailers/logo', url: @logo_url += @rendered_template + - content_for :footer do = render 'layouts/mailers/service_footer', service: @service, dossier: @dossier - -= render template: 'layouts/mailers/notifications_layout' diff --git a/spec/mailers/dossier_mailer_spec.rb b/spec/mailers/dossier_mailer_spec.rb index 626d1513b..145d8b17f 100644 --- a/spec/mailers/dossier_mailer_spec.rb +++ b/spec/mailers/dossier_mailer_spec.rb @@ -3,6 +3,12 @@ require "rails_helper" RSpec.describe DossierMailer, type: :mailer do let(:to_email) { 'gestionnaire@exemple.gouv.fr' } + shared_examples 'a dossier notification' do + it 'includes the contact informations in the footer' do + expect(subject.body).to include('ne pas répondre') + end + end + describe '.notify_new_draft' do let(:dossier) { create(:dossier, procedure: build(:simple_procedure)) } @@ -12,6 +18,8 @@ RSpec.describe DossierMailer, type: :mailer do it { expect(subject.subject).to include(dossier.procedure.libelle) } it { expect(subject.body).to include(dossier.procedure.libelle) } it { expect(subject.body).to include(dossier_url(dossier)) } + + it_behaves_like 'a dossier notification' end describe '.notify_new_answer' do @@ -22,6 +30,8 @@ RSpec.describe DossierMailer, type: :mailer do it { expect(subject.subject).to include("Nouveau message") } it { expect(subject.subject).to include(dossier.id.to_s) } it { expect(subject.body).to include(messagerie_dossier_url(dossier)) } + + it_behaves_like 'a dossier notification' end describe '.notify_deletion_to_user' do From f166077f5e168329f65ba75428a1825e01ba55d7 Mon Sep 17 00:00:00 2001 From: clemkeirua Date: Mon, 22 Jul 2019 15:33:58 +0200 Subject: [PATCH 11/15] ajout d'un bouton de suppression des admin dans le manager --- .../manager/administrateurs_controller.rb | 15 +++++++++++++++ app/models/administrateur.rb | 4 ++++ app/views/manager/administrateurs/show.html.erb | 3 +++ config/routes.rb | 1 + 4 files changed, 23 insertions(+) diff --git a/app/controllers/manager/administrateurs_controller.rb b/app/controllers/manager/administrateurs_controller.rb index 91866045c..bfb3cceea 100644 --- a/app/controllers/manager/administrateurs_controller.rb +++ b/app/controllers/manager/administrateurs_controller.rb @@ -33,6 +33,21 @@ module Manager head :ok end + def delete + administrateur = Administrateur.find(params[:id]) + + if !administrateur.can_be_deleted? + fail "Cannot delete this administrateur because it has dossiers or procedures" + end + administrateur.dossiers.each(&:delete_and_keep_track) + administrateur.destroy + + logger.info("L'administrateur #{administrateur.id} est supprimé par #{current_user.id}") + flash[:notice] = "L'administrateur #{administrateur.id} est supprimé" + + redirect_to manager_administrateurs_path + end + private def create_administrateur_params diff --git a/app/models/administrateur.rb b/app/models/administrateur.rb index 6d1de0927..87c4ed221 100644 --- a/app/models/administrateur.rb +++ b/app/models/administrateur.rb @@ -123,4 +123,8 @@ class Administrateur < ApplicationRecord def gestionnaire Gestionnaire.find_by(email: email) end + + def can_be_deleted? + dossiers.state_instruction_commencee.none? && procedures.none? + end end diff --git a/app/views/manager/administrateurs/show.html.erb b/app/views/manager/administrateurs/show.html.erb index 8d152a733..04e85ce4f 100644 --- a/app/views/manager/administrateurs/show.html.erb +++ b/app/views/manager/administrateurs/show.html.erb @@ -33,6 +33,9 @@ as well as a link to its edit page.
+ <% if page.resource.can_be_deleted? %> + <%= link_to "supprimer", delete_manager_administrateur_path(page.resource), method: :delete, class: "button", data: { confirm: "Confirmez-vous la suppression de l'administrateur ?" } %> + <% end %> <% if page.resource.invitation_expired? %> <%= link_to "renvoyer l'invitation", reinvite_manager_administrateur_path(page.resource), method: :post, class: "button" %> <% end %> diff --git a/config/routes.rb b/config/routes.rb index e77e6eb5f..fc9169607 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -21,6 +21,7 @@ Rails.application.routes.draw do resources :administrateurs, only: [:index, :show, :new, :create] do post 'reinvite', on: :member put 'enable_feature', on: :member + delete 'delete', on: :member end resources :users, only: [:index, :show] do From af436500fd0bf3249883cfabb3323c59767c28e6 Mon Sep 17 00:00:00 2001 From: clemkeirua Date: Tue, 23 Jul 2019 15:24:43 +0200 Subject: [PATCH 12/15] better button --- app/controllers/manager/administrateurs_controller.rb | 2 +- app/views/manager/administrateurs/show.html.erb | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/controllers/manager/administrateurs_controller.rb b/app/controllers/manager/administrateurs_controller.rb index bfb3cceea..83894c0ab 100644 --- a/app/controllers/manager/administrateurs_controller.rb +++ b/app/controllers/manager/administrateurs_controller.rb @@ -37,7 +37,7 @@ module Manager administrateur = Administrateur.find(params[:id]) if !administrateur.can_be_deleted? - fail "Cannot delete this administrateur because it has dossiers or procedures" + fail "Impossible de supprimer cet administrateur car il a des dossiers ou des procédures" end administrateur.dossiers.each(&:delete_and_keep_track) administrateur.destroy diff --git a/app/views/manager/administrateurs/show.html.erb b/app/views/manager/administrateurs/show.html.erb index 04e85ce4f..34b4b9857 100644 --- a/app/views/manager/administrateurs/show.html.erb +++ b/app/views/manager/administrateurs/show.html.erb @@ -33,12 +33,10 @@ as well as a link to its edit page.
- <% if page.resource.can_be_deleted? %> - <%= link_to "supprimer", delete_manager_administrateur_path(page.resource), method: :delete, class: "button", data: { confirm: "Confirmez-vous la suppression de l'administrateur ?" } %> - <% end %> <% if page.resource.invitation_expired? %> <%= link_to "renvoyer l'invitation", reinvite_manager_administrateur_path(page.resource), method: :post, class: "button" %> <% end %> + <%= button_to "supprimer", delete_manager_administrateur_path(page.resource), method: :delete, disabled: !page.resource.can_be_deleted?, class: "button", data: { confirm: "Confirmez-vous la suppression de l'administrateur ?" }, title: page.resource.can_be_deleted? ? "Supprimer" : "Cet administrateur a des dossiers ou des procédures et ne peut être supprimé" %>
From 99421545ab364817584b1717574bb03d8c04a229 Mon Sep 17 00:00:00 2001 From: clemkeirua Date: Tue, 23 Jul 2019 14:26:42 +0200 Subject: [PATCH 13/15] replaced api-carto endpoint --- config/initializers/urls.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/urls.rb b/config/initializers/urls.rb index 7d279eec6..afd9bcbd9 100644 --- a/config/initializers/urls.rb +++ b/config/initializers/urls.rb @@ -1,6 +1,6 @@ # API URLs API_ADRESSE_URL = ENV.fetch("API_ADRESSE_URL", "https://api-adresse.data.gouv.fr") -API_CARTO_URL = ENV.fetch("API_CARTO_URL", "https://apicarto.sgmap.fr") +API_CARTO_URL = ENV.fetch("API_CARTO_URL", "https://sandbox.geo.api.gouv.fr/apicarto") API_ENTREPRISE_URL = ENV.fetch("API_ENTREPRISE_URL", "https://entreprise.api.gouv.fr/v2") API_GEO_URL = ENV.fetch("API_GEO_URL", "https://geo.api.gouv.fr") API_GEO_SANDBOX_URL = ENV.fetch("API_GEO_SANDBOX_URL", "https://sandbox.geo.api.gouv.fr") From 0818331319739d28aa8baaa0f58678a66071eaba Mon Sep 17 00:00:00 2001 From: clemkeirua Date: Tue, 23 Jul 2019 15:37:23 +0200 Subject: [PATCH 14/15] changement du endpoint dans les tests --- spec/lib/api_carto/api_spec.rb | 4 ++-- spec/lib/api_carto/cadastre_adapter_spec.rb | 2 +- spec/lib/api_carto/quartiers_prioritaires_adapter_spec.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/lib/api_carto/api_spec.rb b/spec/lib/api_carto/api_spec.rb index 900debfda..2e52a58b1 100644 --- a/spec/lib/api_carto/api_spec.rb +++ b/spec/lib/api_carto/api_spec.rb @@ -5,7 +5,7 @@ describe ApiCarto::API do subject { described_class.search_qp(geojson) } before do - stub_request(:post, "https://apicarto.sgmap.fr/quartiers-prioritaires/search") + stub_request(:post, "https://sandbox.geo.api.gouv.fr/apicarto/quartiers-prioritaires/search") .with(:body => /.*/, :headers => { 'Content-Type' => 'application/json' }) .to_return(status: status, body: body) @@ -53,7 +53,7 @@ describe ApiCarto::API do subject { described_class.search_cadastre(geojson) } before do - stub_request(:post, "https://apicarto.sgmap.fr/cadastre/geometrie") + stub_request(:post, "https://sandbox.geo.api.gouv.fr/apicarto/cadastre/geometrie") .with(:body => /.*/, :headers => { 'Content-Type' => 'application/json' }) .to_return(status: status, body: body) diff --git a/spec/lib/api_carto/cadastre_adapter_spec.rb b/spec/lib/api_carto/cadastre_adapter_spec.rb index 6aa2858ca..aaba3cae7 100644 --- a/spec/lib/api_carto/cadastre_adapter_spec.rb +++ b/spec/lib/api_carto/cadastre_adapter_spec.rb @@ -4,7 +4,7 @@ describe ApiCarto::CadastreAdapter do subject { described_class.new(coordinates).results } before do - stub_request(:post, "https://apicarto.sgmap.fr/cadastre/geometrie") + stub_request(:post, "https://sandbox.geo.api.gouv.fr/apicarto/cadastre/geometrie") .with(:body => /.*/, :headers => { 'Content-Type' => 'application/json' }) .to_return(status: status, body: body) diff --git a/spec/lib/api_carto/quartiers_prioritaires_adapter_spec.rb b/spec/lib/api_carto/quartiers_prioritaires_adapter_spec.rb index b4ac7ef3a..32f5eb60b 100644 --- a/spec/lib/api_carto/quartiers_prioritaires_adapter_spec.rb +++ b/spec/lib/api_carto/quartiers_prioritaires_adapter_spec.rb @@ -4,7 +4,7 @@ describe ApiCarto::QuartiersPrioritairesAdapter do subject { described_class.new(coordinates).results } before do - stub_request(:post, "https://apicarto.sgmap.fr/quartiers-prioritaires/search") + stub_request(:post, "https://sandbox.geo.api.gouv.fr/apicarto/quartiers-prioritaires/search") .with(:body => /.*/, :headers => { 'Content-Type' => 'application/json' }) .to_return(status: status, body: body) From ff395b8c4bbccb5066d766d6756773b5f89b5376 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chai=CC=88b=20Martinez?= Date: Wed, 17 Jul 2019 17:09:45 +0200 Subject: [PATCH 15/15] =?UTF-8?q?Add=20a=20triggered=20message=20in=20chat?= =?UTF-8?q?=20box=20for=20new=20admins=20=F0=9F=98=8E=20Remove=20useless?= =?UTF-8?q?=20text=20[fix=20#4052]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Chaïb Martinez --- app/views/admin/procedures/new_from_existing.html.haml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/admin/procedures/new_from_existing.html.haml b/app/views/admin/procedures/new_from_existing.html.haml index 2800c40b4..b7479670d 100644 --- a/app/views/admin/procedures/new_from_existing.html.haml +++ b/app/views/admin/procedures/new_from_existing.html.haml @@ -10,11 +10,6 @@ %br Besoin d'aide ? %br - > Nous proposons des ateliers en ligne pour vous aider à créer votre 1er formulaire et répondre à vos questions : - = link_to "inscrivez-vous ici", - "https://vimeo.com/334463514", - target: "_blank" - %br > Vous pouvez = link_to "visionner cette vidéo", "https://vimeo.com/261478872", @@ -31,6 +26,11 @@ "https://calendly.com/demarches-simplifiees/accompagnement-administrateur-demarches-simplifiees-fr", target: "_blank" + :javascript + document.addEventListener("turbolinks:load", function() { + $crisp.push(["do", "trigger:run", ["admin-signup"]]); + }); + .form .send-wrapper