From 509613afe689b0e675e4f97f41d8832a6a51673a Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Wed, 29 Aug 2018 14:01:09 +0100 Subject: [PATCH] Use contact_link helper instead of mailto --- app/controllers/admin/procedures_controller.rb | 2 +- app/controllers/administrateurs/activate_controller.rb | 2 +- app/controllers/gestionnaires/activate_controller.rb | 2 +- app/controllers/new_user/feedbacks_controller.rb | 2 +- app/views/accessibilite/index.html.haml | 2 +- app/views/layouts/_footer.html.haml | 2 +- app/views/layouts/_new_header.haml | 2 +- app/views/new_user/dossiers/_footer.html.haml | 2 +- app/views/root/_footer.html.haml | 4 +--- app/views/root/administration.html.haml | 4 ++-- app/views/root/landing.html.haml | 6 +++--- spec/views/layouts/_new_header_spec.rb | 3 ++- 12 files changed, 16 insertions(+), 17 deletions(-) diff --git a/app/controllers/admin/procedures_controller.rb b/app/controllers/admin/procedures_controller.rb index ef68211f0..71f2c5061 100644 --- a/app/controllers/admin/procedures_controller.rb +++ b/app/controllers/admin/procedures_controller.rb @@ -45,7 +45,7 @@ class Admin::ProceduresController < AdminController procedure = current_administrateur.procedures.find(params[:id]) procedure.hide! - flash.notice = "Procédure supprimée, en cas d'erreur contactez nous : #{CONTACT_EMAIL}" + flash.notice = "Procédure supprimée, en cas d'erreur #{view_context.contact_link('contactez nous', tags: 'procédure supprimée')}" redirect_to admin_procedures_draft_path end diff --git a/app/controllers/administrateurs/activate_controller.rb b/app/controllers/administrateurs/activate_controller.rb index 2421035b2..c6487aa0a 100644 --- a/app/controllers/administrateurs/activate_controller.rb +++ b/app/controllers/administrateurs/activate_controller.rb @@ -5,7 +5,7 @@ class Administrateurs::ActivateController < ApplicationController @administrateur = Administrateur.find_inactive_by_token(params[:token]) if !@administrateur - flash.alert = "Le lien de validation d'administrateur a expiré, contactez-nous à #{CONTACT_EMAIL} pour obtenir un nouveau lien." + flash.alert = "Le lien de validation d'administrateur a expiré, #{view_context.contact_link('contactez-nous', tags: 'lien expiré')} pour obtenir un nouveau lien." redirect_to root_path end end diff --git a/app/controllers/gestionnaires/activate_controller.rb b/app/controllers/gestionnaires/activate_controller.rb index 2fa1d0d39..61d957401 100644 --- a/app/controllers/gestionnaires/activate_controller.rb +++ b/app/controllers/gestionnaires/activate_controller.rb @@ -5,7 +5,7 @@ class Gestionnaires::ActivateController < ApplicationController @gestionnaire = Gestionnaire.with_reset_password_token(params[:token]) if !@gestionnaire - flash.alert = "Le lien de validation du compte accompagnateur a expiré, contactez-nous à #{CONTACT_EMAIL} pour obtenir un nouveau lien." + flash.alert = "Le lien de validation du compte accompagnateur a expiré, #{view_context.contact_link('contactez-nous', tags: 'lien expiré')} pour obtenir un nouveau lien." redirect_to root_path end end diff --git a/app/controllers/new_user/feedbacks_controller.rb b/app/controllers/new_user/feedbacks_controller.rb index d7db41189..3c7b391da 100644 --- a/app/controllers/new_user/feedbacks_controller.rb +++ b/app/controllers/new_user/feedbacks_controller.rb @@ -1,6 +1,6 @@ class NewUser::FeedbacksController < ApplicationController def create current_user.feedbacks.create!(rating: params[:rating]) - flash.notice = "Merci de votre retour, si vous souhaitez nous en dire plus, n'hésitez pas à nous contacter par email." + flash.notice = "Merci de votre retour, si vous souhaitez nous en dire plus, n'hésitez pas à #{view_context.contact_link('nous contacter', type: Helpscout::FormAdapter::TYPE_AMELIORATION)}." end end diff --git a/app/views/accessibilite/index.html.haml b/app/views/accessibilite/index.html.haml index d56f539bc..0923c5d65 100644 --- a/app/views/accessibilite/index.html.haml +++ b/app/views/accessibilite/index.html.haml @@ -9,7 +9,7 @@ %h2.new-h2 Signaler un dysfonctionnement %p.new-p - = "Si, malgré notre vigilance, vous rencontriez le moindre problème d’accessibilité sur notre site, n’hésitez pas à nous écrire à #{CONTACT_EMAIL}." + = "Si, malgré notre vigilance, vous rencontriez le moindre problème d’accessibilité sur notre site, n’hésitez pas à #{contact_link('nous écrire', tags: 'a11y')}." %h2.new-h2 Défenseur des droits %p.new-p diff --git a/app/views/layouts/_footer.html.haml b/app/views/layouts/_footer.html.haml index 1eae6f9ab..1d9a90032 100644 --- a/app/views/layouts/_footer.html.haml +++ b/app/views/layouts/_footer.html.haml @@ -9,4 +9,4 @@ \- = link_to 'CGU / Mentions légales', CGU_URL \- - = link_to 'Contact', "mailto:#{CONTACT_EMAIL}" + = contact_link 'Contact' diff --git a/app/views/layouts/_new_header.haml b/app/views/layouts/_new_header.haml index 9a9af4624..d5b8890af 100644 --- a/app/views/layouts/_new_header.haml +++ b/app/views/layouts/_new_header.haml @@ -31,7 +31,7 @@ = link_to CONTACT_PHONE, "tel:#{CONTACT_PHONE}" %br – par email : - = link_to CONTACT_EMAIL, "mailto:#{CONTACT_EMAIL}" + = contact_link CONTACT_EMAIL - if nav_bar_profile == :user %ul.header-tabs diff --git a/app/views/new_user/dossiers/_footer.html.haml b/app/views/new_user/dossiers/_footer.html.haml index 59d04ecb0..45d6fafda 100644 --- a/app/views/new_user/dossiers/_footer.html.haml +++ b/app/views/new_user/dossiers/_footer.html.haml @@ -36,4 +36,4 @@ – = link_to "Mentions légales", MENTIONS_LEGALES_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer" – - = link_to "Contact technique", "mailto:#{CONTACT_EMAIL}", :class => "footer-link" + = contact_link "Contact technique", class: "footer-link" diff --git a/app/views/root/_footer.html.haml b/app/views/root/_footer.html.haml index 7e73ff8b5..ef2b14c33 100644 --- a/app/views/root/_footer.html.haml +++ b/app/views/root/_footer.html.haml @@ -30,9 +30,7 @@ %li.footer-column %ul.footer-links %li.footer-link - = link_to "Contact", - "mailto:#{CONTACT_EMAIL}", - :class => "footer-link" + = contact_link "Contact", class: "footer-link" %li.footer-link = link_to "Documentation", DOC_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer" %li.footer-link diff --git a/app/views/root/administration.html.haml b/app/views/root/administration.html.haml index 5820a7458..c6d0f0216 100644 --- a/app/views/root/administration.html.haml +++ b/app/views/root/administration.html.haml @@ -182,8 +182,8 @@ %h1.cta-panel-title Une question, un problème ? %p.cta-panel-explanation Notre équipe est disponible pour vous renseigner et vous aider %div - = link_to "Contactez-nous", - "mailto:#{CONTACT_EMAIL}?subject=Question%20à%20propos%20de%20demarches-simplifiees.fr", + = contact_link "Contactez-nous", + tags: 'administration', class: "cta-panel-button-white", target: "_blank", rel: "noopener noreferrer" diff --git a/app/views/root/landing.html.haml b/app/views/root/landing.html.haml index f0d36673c..52e7e39ba 100644 --- a/app/views/root/landing.html.haml +++ b/app/views/root/landing.html.haml @@ -70,9 +70,9 @@ %h1.cta-panel-title Une question, un problème ? %p.cta-panel-explanation Notre équipe est disponible pour vous renseigner et vous aider %div - = link_to "Contactez-nous", - "mailto:#{CONTACT_EMAIL}?subject=Question%20à%20propos%20de%20demarches-simplifiees.fr", - class: "cta-panel-button-white", + = contact_link "Contactez-nous", + tags: 'landing', + class: "cta-panel-button white", target: "_blank", rel: "noopener noreferrer" diff --git a/spec/views/layouts/_new_header_spec.rb b/spec/views/layouts/_new_header_spec.rb index 9cf454c1a..5e7b5ee9e 100644 --- a/spec/views/layouts/_new_header_spec.rb +++ b/spec/views/layouts/_new_header_spec.rb @@ -3,6 +3,7 @@ require 'spec_helper' describe 'layouts/_new_header.html.haml', type: :view do describe 'logo link' do before do + Flipflop::FeatureSet.current.test!.switch!(:support_form, true) sign_in user allow(controller).to receive(:nav_bar_profile).and_return(profile) render @@ -26,7 +27,7 @@ describe 'layouts/_new_header.html.haml', type: :view do it "displays the contact infos" do expect(rendered).to have_text("Contact") - expect(rendered).to have_link(CONTACT_EMAIL, href: "mailto:#{CONTACT_EMAIL}") + expect(rendered).to have_link(CONTACT_EMAIL, href: contact_url) end end end