Merge pull request #4495 from betagouv/dev

2019-11-07-01
This commit is contained in:
Keirua 2019-11-07 11:31:28 +01:00 committed by GitHub
commit d81a6184a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 104 additions and 55 deletions

View file

@ -11,7 +11,7 @@
} }
} }
h4.help-dropdown-title { .help-dropdown-title {
font-size: 16px; font-size: 16px;
color: $blue; color: $blue;
} }

View file

@ -113,3 +113,19 @@ footer {
margin-bottom: 0; margin-bottom: 0;
} }
} }
.footer-site-links {
li {
display: inline;
&::before {
content: "-";
margin: $default-spacer;
}
&:first-child::before {
content: none;
}
}
}

View file

@ -0,0 +1,12 @@
@import "constants";
.huge-title {
text-align: center;
margin-bottom: 20px;
font-size: 35px;
font-weight: bold;
@media (max-width: $two-columns-breakpoint) {
font-size: 25px;
}
}

View file

@ -1,6 +1,6 @@
module StringToHtmlHelper module StringToHtmlHelper
def string_to_html(str) def string_to_html(str, wrapper_tag = 'p')
html_formatted = simple_format(str) html_formatted = simple_format(str, {}, { wrapper_tag: wrapper_tag })
with_links = html_formatted.gsub(URI.regexp, '<a target="_blank" rel="noopener" href="\0">\0</a>') with_links = html_formatted.gsub(URI.regexp, '<a target="_blank" rel="noopener" href="\0">\0</a>')
sanitize(with_links, attributes: ['target', 'rel', 'href']) sanitize(with_links, attributes: ['target', 'rel', 'href'])
end end

View file

@ -3,6 +3,11 @@ class ApplicationMailer < ActionMailer::Base
default from: "demarches-simplifiees.fr <#{CONTACT_EMAIL}>" default from: "demarches-simplifiees.fr <#{CONTACT_EMAIL}>"
layout 'mailer' layout 'mailer'
# Dont retry to send a message if the server rejects the recipient address
rescue_from Net::SMTPSyntaxError do |_error|
message.perform_deliveries = false
end
# Attach the procedure logo to the email (if any). # Attach the procedure logo to the email (if any).
# Returns the attachment url. # Returns the attachment url.
def attach_logo(procedure) def attach_logo(procedure)

View file

@ -2,7 +2,7 @@
.commencer.form .commencer.form
- if !user_signed_in? - if !user_signed_in?
%h1 Commencer la démarche %h2.huge-title Commencer la démarche
= link_to commencer_sign_up_path(path: @procedure.path), class: ['button large expand primary'] do = link_to commencer_sign_up_path(path: @procedure.path), class: ['button large expand primary'] do
Créer un compte Créer un compte
%span.optional-on-small-screens %span.optional-on-small-screens
@ -20,7 +20,7 @@
- elsif drafts.count == 1 && not_drafts.count == 0 - elsif drafts.count == 1 && not_drafts.count == 0
- dossier = drafts.first - dossier = drafts.first
%h1 Vous avez déjà commencé à remplir un dossier %h2.huge-title Vous avez déjà commencé à remplir un dossier
%p %p
Il y a <strong>#{time_ago_in_words(dossier.created_at)}</strong>, Il y a <strong>#{time_ago_in_words(dossier.created_at)}</strong>,
vous avez commencé à remplir un dossier sur la démarche « #{dossier.procedure.libelle} ». vous avez commencé à remplir un dossier sur la démarche « #{dossier.procedure.libelle} ».
@ -29,7 +29,7 @@
- elsif not_drafts.count == 1 - elsif not_drafts.count == 1
- dossier = not_drafts.first - dossier = not_drafts.first
%h1 Vous avez déjà déposé un dossier %h2.huge-title Vous avez déjà déposé un dossier
%p %p
Il y a <strong>#{time_ago_in_words(dossier.en_construction_at)}</strong>, Il y a <strong>#{time_ago_in_words(dossier.en_construction_at)}</strong>,
vous avez déposé un dossier sur la démarche « #{dossier.procedure.libelle} ». vous avez déposé un dossier sur la démarche « #{dossier.procedure.libelle} ».
@ -37,6 +37,6 @@
= link_to 'Commencer un nouveau dossier', url_for_new_dossier(@procedure), class: ['button large expand'] = link_to 'Commencer un nouveau dossier', url_for_new_dossier(@procedure), class: ['button large expand']
- else - else
%h1 Vous avez déjà des dossiers pour cette démarche %h2.huge-title Vous avez déjà des dossiers pour cette démarche
= link_to 'Voir mes dossiers en cours', dossiers_path, class: ['button large expand primary'] = link_to 'Voir mes dossiers en cours', dossiers_path, class: ['button large expand primary']
= link_to 'Commencer un nouveau dossier', url_for_new_dossier(@procedure), class: ['button large expand'] = link_to 'Commencer un nouveau dossier', url_for_new_dossier(@procedure), class: ['button large expand']

View file

@ -3,7 +3,7 @@
- dossier = controller.try(:dossier_for_help) - dossier = controller.try(:dossier_for_help)
- procedure = controller.try(:procedure_for_help) - procedure = controller.try(:procedure_for_help)
.new-header{ class: current_page?(root_path) ? nil : "new-header-with-border" } %header.new-header{ class: current_page?(root_path) ? nil : "new-header-with-border" }
.header-inner-content .header-inner-content
.flex.align-center .flex.align-center

View file

@ -33,8 +33,9 @@
Env Test Env Test
= render partial: "layouts/new_header" = render partial: "layouts/new_header"
= render partial: "layouts/flash_messages" %main
= content_for?(:content) ? yield(:content) : yield = render partial: "layouts/flash_messages"
= content_for?(:content) ? yield(:content) : yield
- if content_for?(:footer) - if content_for?(:footer)
= content_for(:footer) = content_for(:footer)

View file

@ -1,5 +1,5 @@
.no-procedure .no-procedure
= image_tag "landing/hero/dematerialiser.svg", class: "paperless-logo" = image_tag "landing/hero/dematerialiser.svg", class: "paperless-logo", alt: "moins de papier"
.baseline.center .baseline.center
%h3 Un outil simple %h3 Un outil simple
%p %p

View file

@ -6,22 +6,22 @@
%ul.footer-logos %ul.footer-logos
%li.footer-text %li.footer-text
Un service fourni par la Un service fourni par la
= link_to "DINSIC", "http://www.modernisation.gouv.fr/" = link_to "DINUM", "http://www.modernisation.gouv.fr/", title: "Direction Interministérielle au Numérique"
%br %br
et incubé par et incubé par
= link_to "beta.gouv.fr", "https://beta.gouv.fr" = link_to "beta.gouv.fr", "https://beta.gouv.fr", title: "le site de Beta.gouv.fr"
%li %li
= link_to "http://www.modernisation.gouv.fr/" do = link_to "http://www.modernisation.gouv.fr/", title: "DINUM" do
%span.footer-logo.footer-logo-dinsic{ role: 'img', 'aria-label': 'DINSIC' } %span.footer-logo.footer-logo-dinsic{ role: 'img', 'aria-label': 'DINSIC' }
= link_to "https://beta.gouv.fr" do = link_to "https://beta.gouv.fr", title: "le site de Beta.gouv.fr" do
%span.footer-logo.footer-logo-beta-gouv-fr{ role: 'img', 'aria-label': 'beta.gouv.fr' } %span.footer-logo.footer-logo-beta-gouv-fr{ role: 'img', 'aria-label': 'beta.gouv.fr' }
%li.footer-column %li.footer-column
%ul.footer-links %ul.footer-links
%li.footer-link %li.footer-link
= link_to "Newsletter", "https://my.sendinblue.com/users/subscribe/js_id/3s2q1/id/1", :class => "footer-link", :target => "_blank", rel: "noopener" = link_to "Newsletter", "https://my.sendinblue.com/users/subscribe/js_id/3s2q1/id/1", :title => "Notre newsletter", :class => "footer-link", :target => "_blank", rel: "noopener"
%li.footer-link %li.footer-link
= link_to "Nouveautés", "https://github.com/betagouv/demarches-simplifiees.fr/releases", :class => "footer-link" = link_to "Nouveautés", "https://github.com/betagouv/demarches-simplifiees.fr/releases", :class => "footer-link", :title => "Nos nouveautés"
%li.footer-link %li.footer-link
= link_to "Statistiques", stats_path, :class => "footer-link", data: { turbolinks: false } # Turbolinks disabled for Chartkick. See Issue #350 = link_to "Statistiques", stats_path, :class => "footer-link", data: { turbolinks: false } # Turbolinks disabled for Chartkick. See Issue #350
%li.footer-link %li.footer-link

View file

@ -14,13 +14,13 @@
%em.hero-tagline-em en ligne %em.hero-tagline-em en ligne
.hero-illustration .hero-illustration
%img{ :src => image_url("landing/hero/dematerialiser.svg"), alt: "" } %img{ :src => image_url("landing/hero/dematerialiser.svg"), alt: "dématérialisez" }
.landing-panel.usagers-panel .landing-panel.usagers-panel
.container .container
.role-panel-wrapper .role-panel-wrapper
.role-panel-30.role-usagers-image .role-panel-30.role-usagers-image
%img.role-image{ :src => image_url("landing/roles/usagers.svg"), alt: "" } %img.role-image{ :src => image_url("landing/roles/usagers.svg"), alt: "usager" }
.role-panel-70 .role-panel-70
%h1.role-panel-title Vous souhaitez effectuer une demande auprès d'une administration ? %h1.role-panel-title Vous souhaitez effectuer une demande auprès d'une administration ?

View file

@ -1,8 +1,8 @@
.procedure-logos .procedure-logos
= image_tag procedure.logo_url = image_tag procedure.logo_url, alt: "logo #{procedure.libelle}"
- if procedure.euro_flag - if procedure.euro_flag
= image_tag("flag_of_europe.svg", id: 'euro_flag', class: (!procedure.euro_flag ? "hidden" : "")) = image_tag("flag_of_europe.svg", id: 'euro_flag', class: (!procedure.euro_flag ? "hidden" : ""))
%h2.procedure-title %h1.procedure-title
= procedure.libelle = procedure.libelle
.procedure-description .procedure-description
.procedure-description-body.read-more-enabled.read-more-collapsed .procedure-description-body.read-more-enabled.read-more-collapsed

View file

@ -2,5 +2,5 @@
= mail_to CONTACT_EMAIL do = mail_to CONTACT_EMAIL do
%span.icon.mail %span.icon.mail
.dropdown-description .dropdown-description
%h4.help-dropdown-title Contact technique %span.help-dropdown-title Contact technique
%p Envoyez nous un message à #{CONTACT_EMAIL}. %p Envoyez nous un message à #{CONTACT_EMAIL}.

View file

@ -2,5 +2,5 @@
= link_to FAQ_URL, target: "_blank", rel: "noopener" do = link_to FAQ_URL, target: "_blank", rel: "noopener" do
%span.icon.help %span.icon.help
.dropdown-description .dropdown-description
%h4.help-dropdown-title Un problème avec le site ? %span.help-dropdown-title Un problème avec le site ?
%p Trouvez votre réponse dans laide en ligne. %p Trouvez votre réponse dans laide en ligne.

View file

@ -2,5 +2,5 @@
= link_to messagerie_dossier_path(dossier) do = link_to messagerie_dossier_path(dossier) do
%span.icon.mail %span.icon.mail
.dropdown-description .dropdown-description
%h4.help-dropdown-title= title %span.help-dropdown-title= title
%p Envoyez directement un message à linstructeur. %p Envoyez directement un message à linstructeur.

View file

@ -1,7 +1,7 @@
%li.help-dropdown-service %li.help-dropdown-service
%span.icon.person %span.icon.person
.dropdown-description .dropdown-description
%h4.help-dropdown-title= title %span.help-dropdown-title= title
.help-dropdown-service-action .help-dropdown-service-action
%p Contactez directement ladministration : %p Contactez directement ladministration :
%p.help-dropdown-service-item %p.help-dropdown-service-item

View file

@ -1,11 +1,7 @@
= link_to "Accessibilité", accessibilite_path, :class => "footer-link" %ul.footer-row.footer-bottom-line.footer-site-links
%li>= link_to "Accessibilité", accessibilite_path
= link_to "CGU", CGU_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer" %li>= link_to "CGU", CGU_URL, target: "_blank", rel: "noopener noreferrer"
%li>= link_to "Mentions légales", MENTIONS_LEGALES_URL, target: "_blank", rel: "noopener noreferrer"
= link_to "Mentions légales", MENTIONS_LEGALES_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer" %li>= link_to 'Documentation', DOC_URL
%li>= contact_link "Contact technique", dossier_id: dossier&.id
= link_to 'Documentation', DOC_URL %li>= link_to 'Aide', FAQ_URL
= contact_link "Contact technique", class: "footer-link", dossier_id: dossier&.id
= link_to 'Aide', FAQ_URL

View file

@ -2,19 +2,19 @@
.container .container
- service = procedure.service - service = procedure.service
- if service.present? - if service.present?
%ul.footer-row.footer-columns .footer-row.footer-columns
%li.footer-column %ul.footer-column
%h3.footer-header Cette démarche est gérée par : %p.footer-header Cette démarche est gérée par :
%p %li
= service.nom = service.nom
%br %br
= service.organisme = service.organisme
%br %br
= string_to_html(service.adresse) = string_to_html(service.adresse, wrapper_tag = 'span')
%li.footer-column %ul.footer-column
%h3.footer-header Poser une question sur votre dossier : %p.footer-header Poser une question sur votre dossier :
%p %li
- if dossier.present? && dossier.messagerie_available? - if dossier.present? && dossier.messagerie_available?
Directement Directement
= link_to "par la messagerie", messagerie_dossier_path(dossier) = link_to "par la messagerie", messagerie_dossier_path(dossier)
@ -22,21 +22,21 @@
Par email : Par email :
= link_to service.email, "mailto:#{service.email}" = link_to service.email, "mailto:#{service.email}"
%p %li
Par téléphone : Par téléphone :
%a{ href: "tel:#{service.telephone}" }= service.telephone %a{ href: "tel:#{service.telephone}" }= service.telephone
%p %li
- horaires = "Horaires : #{formatted_horaires(service.horaires)}" - horaires = "Horaires : #{formatted_horaires(service.horaires)}"
= simple_format(horaires) = simple_format(horaires, {}, wrapper_tag: 'span')
- politiques = politiques_conservation_de_donnees(procedure) - politiques = politiques_conservation_de_donnees(procedure)
- if politiques.present? - if politiques.present?
%li.footer-column %ul.footer-column
%h3.footer-header Conservation des données : %p.footer-header Conservation des données :
- politiques.each do |politique| - politiques.each do |politique|
%p= politique %li= politique
= render partial: 'users/general_footer_row', locals: { dossier: dossier }
.footer-row.footer-bottom-line
= render partial: 'users/general_footer_row', locals: { dossier: dossier }

View file

@ -1,4 +1,3 @@
%footer.procedure-footer %footer.procedure-footer
.container .container
.footer-row.footer-bottom-line = render partial: "users/general_footer_row", locals: { dossier: nil }
= render partial: "users/general_footer_row", locals: { dossier: nil }

View file

@ -3,7 +3,7 @@
.auth-form.sign-in-form .auth-form.sign-in-form
= form_for User.new, url: user_session_path, html: { class: "form" } do |f| = form_for User.new, url: user_session_path, html: { class: "form" } do |f|
%h1 Connectez-vous %h2.huge-title Connectez-vous
= f.label :email, "Email" = f.label :email, "Email"
= f.text_field :email, autofocus: true = f.text_field :email, autofocus: true

View file

@ -0,0 +1,20 @@
RSpec.describe ApplicationMailer, type: :mailer do
describe 'dealing with invalid emails' do
let(:dossier) { create(:dossier, procedure: build(:simple_procedure)) }
subject { DossierMailer.notify_new_draft(dossier) }
describe 'invalid emails are not sent' do
before do
allow_any_instance_of(DossierMailer)
.to receive(:notify_new_draft)
.and_raise(Net::SMTPSyntaxError)
end
it { expect(subject.message).to be_an_instance_of(ActionMailer::Base::NullMail) }
end
describe 'valid emails are sent' do
it { expect(subject.message).not_to be_an_instance_of(ActionMailer::Base::NullMail) }
end
end
end