From f45ede7f44a6795bacd759b228c80c039a2bca1e Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 20 Nov 2019 17:22:01 +0100 Subject: [PATCH] href should not contain space --- app/models/service.rb | 6 ++++++ app/views/layouts/mailers/_service_footer.html.haml | 2 +- .../shared/help/dropdown_items/_service_item.html.haml | 2 +- app/views/users/_procedure_footer.html.haml | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/models/service.rb b/app/models/service.rb index 167863ed4..8dac51ba7 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -30,4 +30,10 @@ class Service < ApplicationRecord service_cloned.administrateur = administrateur service_cloned end + + def telephone_url + if telephone.present? + "tel:#{telephone.gsub(/[[:blank:]]/, '')}" + end + end end diff --git a/app/views/layouts/mailers/_service_footer.html.haml b/app/views/layouts/mailers/_service_footer.html.haml index c60d887b6..8bfde7a01 100644 --- a/app/views/layouts/mailers/_service_footer.html.haml +++ b/app/views/layouts/mailers/_service_footer.html.haml @@ -28,7 +28,7 @@ = link_to service.email, "mailto:#{service.email}" %br Par téléphone : - = link_to service.telephone, "tel:#{service.telephone}" + = link_to service.telephone, service.telephone_url %br Horaires : #{ formatted_horaires(service.horaires) } diff --git a/app/views/shared/help/dropdown_items/_service_item.html.haml b/app/views/shared/help/dropdown_items/_service_item.html.haml index c57a0bada..215793ec5 100644 --- a/app/views/shared/help/dropdown_items/_service_item.html.haml +++ b/app/views/shared/help/dropdown_items/_service_item.html.haml @@ -9,7 +9,7 @@ = link_to service.email, "mailto:#{service.email}" %p.help-dropdown-service-item %span.icon.small.phone - = link_to service.telephone, "tel:#{service.telephone}" + = link_to service.telephone, service.telephone_url %p.help-dropdown-service-item %span.icon.small.clock = service.horaires diff --git a/app/views/users/_procedure_footer.html.haml b/app/views/users/_procedure_footer.html.haml index 1286ea584..c0dab7569 100644 --- a/app/views/users/_procedure_footer.html.haml +++ b/app/views/users/_procedure_footer.html.haml @@ -24,7 +24,7 @@ %li Par téléphone : - %a{ href: "tel:#{service.telephone}" }= service.telephone + = link_to service.telephone, service.telephone_url %li - horaires = "Horaires : #{formatted_horaires(service.horaires)}"