From 51cfd3d7ad0d1698628a3d1451d8201a644fc384 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Vantomme?= Date: Wed, 26 Jan 2022 16:02:51 +0100 Subject: [PATCH] feat(env): add env variables for the provider data --- app/assets/stylesheets/new_footer.scss | 9 +-------- app/views/layouts/_footer.html.haml | 2 +- .../layouts/mailers/notifications_layout.html.erb | 2 +- app/views/root/_footer.html.haml | 9 +++++---- config/env.example.optional | 10 ++++++++++ config/initializers/provider.rb | 10 ++++++++++ 6 files changed, 28 insertions(+), 14 deletions(-) create mode 100644 config/initializers/provider.rb diff --git a/app/assets/stylesheets/new_footer.scss b/app/assets/stylesheets/new_footer.scss index e0e5b65d1..2f894fdc0 100644 --- a/app/assets/stylesheets/new_footer.scss +++ b/app/assets/stylesheets/new_footer.scss @@ -68,19 +68,12 @@ footer { opacity: 0.8; } -.footer-logo-dinum { - @include ie-compatible-background-image("footer/logo-dinum.png"); - - height: 150px; - width: 202px; - margin-bottom: 14px; -} - .footer-logo-beta-gouv-fr { @include ie-compatible-background-image("footer/logo-beta-gouv-fr.svg"); width: 150px; height: 25px; + margin-top: 14px; } .footer-logo-france { diff --git a/app/views/layouts/_footer.html.haml b/app/views/layouts/_footer.html.haml index 3609163f0..ee65d5c93 100644 --- a/app/views/layouts/_footer.html.haml +++ b/app/views/layouts/_footer.html.haml @@ -1,6 +1,6 @@ #footer %p{ class: "copyright col-md-push-#{12-main_container_size} col-md-#{main_container_size} col-lg-push-#{12-main_container_size} col-lg-#{main_container_size} text-muted small" } - = link_to 'DINUM', 'https://www.numerique.gouv.fr/dinum/' + = link_to PROVIDER_NAME, PROVIDER_URL = Time.zone.now.year \- = link_to 'Nouveautés', DOC_NOUVEAUTES_URL, target: '_blank' diff --git a/app/views/layouts/mailers/notifications_layout.html.erb b/app/views/layouts/mailers/notifications_layout.html.erb index 9a84f54da..e05bdafbc 100644 --- a/app/views/layouts/mailers/notifications_layout.html.erb +++ b/app/views/layouts/mailers/notifications_layout.html.erb @@ -145,7 +145,7 @@
- <%= "#{APPLICATION_NAME}" %> est un service fourni par la DINUM + <%= "#{APPLICATION_NAME}" %> est un service fourni par <%= PROVIDED_BY %>
diff --git a/app/views/root/_footer.html.haml b/app/views/root/_footer.html.haml index 11a9d2a01..3da49bb49 100644 --- a/app/views/root/_footer.html.haml +++ b/app/views/root/_footer.html.haml @@ -5,12 +5,13 @@ %li.footer-column %ul.footer-logos %li.footer-text - Un service fourni par la - = link_to "DINUM", "https://numerique.gouv.fr/", title: "Direction Interministérielle au Numérique" + Un service fourni par + = link_to PROVIDED_BY, PROVIDER_URL, title: PROVIDER_TITLE %br %li - = link_to "https://numerique.gouv.fr/", title: "DINUM", 'aria-label': 'DINUM' do - %span.footer-logo.footer-logo-dinum{ role: 'img', 'aria-label': 'Logo DINUM' } + = link_to PROVIDER_URL, title: PROVIDER_NAME, 'aria-label': PROVIDER_NAME do + %span.footer-logo{ role: 'img', 'aria-label': PROVIDER_LOGO_ALT } + = image_tag PROVIDER_LOGO_SRC, alt: PROVIDER_LOGO_ALT, width: PROVIDER_LOGO_WIDTH, height: PROVIDER_LOGO_HEIGHT, loading: 'lazy' = link_to "https://beta.gouv.fr", title: "le site de Beta.gouv.fr", 'aria-label': 'beta.gouv.fr' do %span.footer-logo.footer-logo-beta-gouv-fr{ role: 'img', 'aria-label': 'Logo beta.gouv.fr' } diff --git a/config/env.example.optional b/config/env.example.optional index eb344c0f3..1c66ecdfd 100644 --- a/config/env.example.optional +++ b/config/env.example.optional @@ -89,3 +89,13 @@ DS_ENV="staging" # Admins and instructeurs can freely change their email to these domains # LEGIT_ADMIN_DOMAINS = "domaine_1.com;domaine_2.com" + +# Instance provider +# PROVIDED_BY="la DINUM" +# PROVIDER_NAME="DINUM" +# PROVIDER_TITLE="Direction Interministérielle au Numérique" +# PROVIDER_URL="https://numerique.gouv.fr/" +# PROVIDER_LOGO_SRC="footer/logo-dinum.png" +# PROVIDER_LOGO_ALT="Logo DINUM" +# PROVIDER_LOGO_HEIGHT="161" +# PROVIDER_LOGO_WIDTH="138" diff --git a/config/initializers/provider.rb b/config/initializers/provider.rb new file mode 100644 index 000000000..679fcf193 --- /dev/null +++ b/config/initializers/provider.rb @@ -0,0 +1,10 @@ +# Instance provider +PROVIDED_BY = ENV.fetch("PROVIDED_BY", "la DINUM") +PROVIDER_NAME = ENV.fetch("PROVIDER_NAME", "DINUM") +PROVIDER_TITLE = ENV.fetch("PROVIDER_TITLE", "Direction Interministérielle au Numérique") +PROVIDER_URL = ENV.fetch("PROVIDER_URL", "https://numerique.gouv.fr/") + +PROVIDER_LOGO_SRC = ENV.fetch("PROVIDER_LOGO_SRC", "footer/logo-dinum.png") +PROVIDER_LOGO_ALT = ENV.fetch("PROVIDER_LOGO_ALT", "Logo DINUM") +PROVIDER_LOGO_HEIGHT = ENV.fetch("PROVIDER_LOGO_HEIGHT", "161") +PROVIDER_LOGO_WIDTH = ENV.fetch("PROVIDER_LOGO_WIDTH", "138")