From 1b545123fa00ab6f843c94b1a15162df87bd6b32 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Mon, 3 Sep 2018 11:35:08 +0200 Subject: [PATCH 01/14] Improve the outdated browser support banner style - In the new design, it is now at the top of the page - In the new design, it no longer covers up the UI - In the new design, the text is now left-aligned which makes it easier to read - In the new design, its height has been reduced which makes it less annoying --- .../stylesheets/new_design/support_navigator_banner.scss | 3 --- app/views/layouts/_support_navigator_banner.html.haml | 9 +++------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/app/assets/stylesheets/new_design/support_navigator_banner.scss b/app/assets/stylesheets/new_design/support_navigator_banner.scss index 36189f7d1..327efbcfd 100644 --- a/app/assets/stylesheets/new_design/support_navigator_banner.scss +++ b/app/assets/stylesheets/new_design/support_navigator_banner.scss @@ -2,16 +2,13 @@ @import "constants"; #support-navigator-banner { - position: fixed; width: 100%; bottom: 0; left: 0; margin: 0; padding: $default-padding; - text-align: center; color: #FFFFFF; background-color: $medium-red; - z-index: 1000; a { color: $lighter-blue; diff --git a/app/views/layouts/_support_navigator_banner.html.haml b/app/views/layouts/_support_navigator_banner.html.haml index fff24dcfd..9e183ebc8 100644 --- a/app/views/layouts/_support_navigator_banner.html.haml +++ b/app/views/layouts/_support_navigator_banner.html.haml @@ -1,11 +1,8 @@ -# See config/browser.rb - if !browser.modern? - #support-navigator-banner.row - .col-xs-12 - Attention, votre navigateur (#{browser.name} #{browser.version}) est trop ancien pour utiliser demarches-simplifiees.fr : certaines parties du site ne fonctionneront pas correctement. - %br/ - %br/ - Nous vous recommendons fortement de + #support-navigator-banner + .container + Attention, votre navigateur (#{browser.name} #{browser.version}) est trop ancien pour utiliser demarches-simplifiees.fr : certaines parties du site ne fonctionneront pas correctement. Nous vous recommendons fortement de %a{ href: "https://browser-update.org/fr/update.html", target: "_blank" }mettre à jour votre navigateur %span<> \. From bdb961f28044cb5feb2e211f5c5870eb14ade6b2 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Mon, 3 Sep 2018 11:40:08 +0200 Subject: [PATCH 02/14] Rename support-navigator-banner to outdated-browser-banner --- app/assets/stylesheets/application.scss | 2 +- ...pport_navigator_banner.scss => outdated_browser_banner.scss} | 2 +- ...pport_navigator_banner.scss => outdated_browser_banner.scss} | 2 +- ...ator_banner.html.haml => _outdated_browser_banner.html.haml} | 2 +- app/views/layouts/application.html.haml | 2 +- app/views/layouts/new_application.html.haml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) rename app/assets/stylesheets/new_design/{support_navigator_banner.scss => outdated_browser_banner.scss} (89%) rename app/assets/stylesheets/{support_navigator_banner.scss => outdated_browser_banner.scss} (88%) rename app/views/layouts/{_support_navigator_banner.html.haml => _outdated_browser_banner.html.haml} (93%) diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 85627b3b1..46390dbaf 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -38,7 +38,7 @@ // = require recapitulatif // = require search // = require siret -// = require support_navigator_banner +// = require outdated_browser_banner // = require switch_menu // = require autocomplete // = require users diff --git a/app/assets/stylesheets/new_design/support_navigator_banner.scss b/app/assets/stylesheets/new_design/outdated_browser_banner.scss similarity index 89% rename from app/assets/stylesheets/new_design/support_navigator_banner.scss rename to app/assets/stylesheets/new_design/outdated_browser_banner.scss index 327efbcfd..3630c80b9 100644 --- a/app/assets/stylesheets/new_design/support_navigator_banner.scss +++ b/app/assets/stylesheets/new_design/outdated_browser_banner.scss @@ -1,7 +1,7 @@ @import "colors"; @import "constants"; -#support-navigator-banner { +#outdated-browser-banner { width: 100%; bottom: 0; left: 0; diff --git a/app/assets/stylesheets/support_navigator_banner.scss b/app/assets/stylesheets/outdated_browser_banner.scss similarity index 88% rename from app/assets/stylesheets/support_navigator_banner.scss rename to app/assets/stylesheets/outdated_browser_banner.scss index bfb8a21fe..6ec1c0590 100644 --- a/app/assets/stylesheets/support_navigator_banner.scss +++ b/app/assets/stylesheets/outdated_browser_banner.scss @@ -1,4 +1,4 @@ -#support-navigator-banner { +#outdated-browser-banner { position: fixed; text-align: center; line-height: 2em; diff --git a/app/views/layouts/_support_navigator_banner.html.haml b/app/views/layouts/_outdated_browser_banner.html.haml similarity index 93% rename from app/views/layouts/_support_navigator_banner.html.haml rename to app/views/layouts/_outdated_browser_banner.html.haml index 9e183ebc8..67c08e26b 100644 --- a/app/views/layouts/_support_navigator_banner.html.haml +++ b/app/views/layouts/_outdated_browser_banner.html.haml @@ -1,6 +1,6 @@ -# See config/browser.rb - if !browser.modern? - #support-navigator-banner + #outdated-browser-banner .container Attention, votre navigateur (#{browser.name} #{browser.version}) est trop ancien pour utiliser demarches-simplifiees.fr : certaines parties du site ne fonctionneront pas correctement. Nous vous recommendons fortement de %a{ href: "https://browser-update.org/fr/update.html", target: "_blank" }mettre à jour votre navigateur diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 714c643bb..5ea2ebf56 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -21,7 +21,7 @@ sentry: #{raw(sentry_config)} }]; %body - = render partial: 'layouts/support_navigator_banner' + = render partial: 'layouts/outdated_browser_banner' = render partial: 'layouts/pre_maintenance' - if staging? #beta diff --git a/app/views/layouts/new_application.html.haml b/app/views/layouts/new_application.html.haml index 5664fbf75..164b26452 100644 --- a/app/views/layouts/new_application.html.haml +++ b/app/views/layouts/new_application.html.haml @@ -27,7 +27,7 @@ }]; %body .page-wrapper - = render partial: "layouts/support_navigator_banner" + = render partial: "layouts/outdated_browser_banner" = render partial: 'layouts/pre_maintenance' - if staging? #beta From e927f56e0dda0752bd6b6057f0ce51ed8ea8271b Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Mon, 3 Sep 2018 11:41:25 +0200 Subject: [PATCH 03/14] Use a proper HAML comment --- app/views/layouts/_outdated_browser_banner.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/_outdated_browser_banner.html.haml b/app/views/layouts/_outdated_browser_banner.html.haml index 67c08e26b..aace06b01 100644 --- a/app/views/layouts/_outdated_browser_banner.html.haml +++ b/app/views/layouts/_outdated_browser_banner.html.haml @@ -1,4 +1,4 @@ --# See config/browser.rb +/ See config/browser.rb - if !browser.modern? #outdated-browser-banner .container From 20df1076200e21fb86ee4dc7be91ca0f4950b403 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 3 Sep 2018 14:03:58 +0200 Subject: [PATCH 04/14] update: update yarn dependencies --- bin/update | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bin/update b/bin/update index 58bfaed51..4ada00a43 100755 --- a/bin/update +++ b/bin/update @@ -16,9 +16,7 @@ chdir APP_ROOT do puts '== Installing dependencies ==' system! 'gem install bundler --conservative' system('bundle check') || system!('bundle install') - - # Install JavaScript dependencies if using Yarn - # system('bin/yarn') + system! 'bin/yarn install' puts "\n== Updating database ==" system! 'bin/rails db:migrate' From a33e2cd3fb06ab9c8a05e7961976c9e948afa9e2 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 3 Sep 2018 14:04:38 +0200 Subject: [PATCH 05/14] update: don't clear tmp files There is no strict need for this, and cached files take a long time to be regenerated when restarting the server. --- bin/update | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/update b/bin/update index 4ada00a43..3698a4b42 100755 --- a/bin/update +++ b/bin/update @@ -21,8 +21,8 @@ chdir APP_ROOT do puts "\n== Updating database ==" system! 'bin/rails db:migrate' - puts "\n== Removing old logs and tempfiles ==" - system! 'bin/rails log:clear tmp:clear' + puts "\n== Removing old logs ==" + system! 'bin/rails log:clear' puts "\n== Restarting application server ==" system! 'bin/rails restart' From 291baad96b6c895e7f5e40ddc86ca089f070fddf Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 3 Sep 2018 14:05:35 +0200 Subject: [PATCH 06/14] update: don't restart the server The server is typically started using `overmind start`: better to handle the update and the startup separately. --- bin/update | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/update b/bin/update index 3698a4b42..34bd0bdcd 100755 --- a/bin/update +++ b/bin/update @@ -24,6 +24,6 @@ chdir APP_ROOT do puts "\n== Removing old logs ==" system! 'bin/rails log:clear' - puts "\n== Restarting application server ==" - system! 'bin/rails restart' + puts "\n== Done ==" + puts "You can now start (or restart) the application server with `overmind start`." end From f52822b75bcb2bdfa61cf8de892a45ee5d53d5b9 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 3 Sep 2018 14:19:55 +0200 Subject: [PATCH 07/14] update: install yarn dependencies --- bin/setup | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/setup b/bin/setup index 94fd4d797..3e509a89a 100755 --- a/bin/setup +++ b/bin/setup @@ -16,6 +16,7 @@ chdir APP_ROOT do puts '== Installing dependencies ==' system! 'gem install bundler --conservative' system('bundle check') || system!('bundle install') + system! 'bin/yarn install' # Install JavaScript dependencies if using Yarn # system('bin/yarn') From 2f1e47a7a5a68c0d2a196b9fdb9869ca3e26097c Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 3 Sep 2018 14:20:32 +0200 Subject: [PATCH 08/14] setup: install mailcatcher --- README.md | 3 +-- bin/setup | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1630cf873..1aa709766 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,10 @@ demarches-simplifiees.fr est un site web conçu afin de répondre au besoin urge ### Développement -- Mailcatcher : `gem install mailcatcher` +- Yarn : voir https://yarnpkg.com/en/docs/install - Overmind : * Mac : `brew install overmind` * Linux : voir https://github.com/DarthSim/overmind#installation -- Yarn : voir https://yarnpkg.com/en/docs/install ### Tests diff --git a/bin/setup b/bin/setup index 3e509a89a..cf5d1c425 100755 --- a/bin/setup +++ b/bin/setup @@ -13,7 +13,10 @@ chdir APP_ROOT do # This script is a starting point to setup your application. # Add necessary setup steps to this file. - puts '== Installing dependencies ==' + puts '== Installing global tools ==' + system! 'gem install mailcatcher --conservative' + + puts "\n== Installing dependencies ==" system! 'gem install bundler --conservative' system('bundle check') || system!('bundle install') system! 'bin/yarn install' From 2e536e90f2f413cebc9c9dc1cb603bcfbf259c9e Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 3 Sep 2018 12:21:38 +0000 Subject: [PATCH 09/14] setup: initialize .env file --- README.md | 6 ------ bin/setup | 8 ++++---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 1aa709766..14b1d3faf 100644 --- a/README.md +++ b/README.md @@ -49,13 +49,7 @@ Afin de générer la BDD de l'application, il est nécessaire d'exécuter les co # Migrate the development database and the test database bin/rails db:migrate -## Bouchonnage de la configuration -Créer le fichier de configuration avec les valeurs par défaut : - - cp config/env.example .env - -*Note : les vraies valeurs pour ces paramètres sont renseignées dans le Keepass* ## Lancement de l'application diff --git a/bin/setup b/bin/setup index cf5d1c425..1b0ed6b12 100755 --- a/bin/setup +++ b/bin/setup @@ -24,10 +24,10 @@ chdir APP_ROOT do # Install JavaScript dependencies if using Yarn # system('bin/yarn') - # puts "\n== Copying sample files ==" - # unless File.exist?('config/database.yml') - # cp 'config/database.yml.sample', 'config/database.yml' - # end + puts "\n== Copying sample files ==" + unless File.exist?('.env') + cp 'config/env.example', '.env' + end puts "\n== Preparing database ==" system! 'bin/rails db:setup' From 18fd99c1f25059d6ef3e33a08b88d339ff184722 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 3 Sep 2018 14:22:35 +0200 Subject: [PATCH 10/14] setup: explain what initializing the database does --- bin/setup | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/setup b/bin/setup index 1b0ed6b12..865d2be0a 100755 --- a/bin/setup +++ b/bin/setup @@ -29,6 +29,7 @@ chdir APP_ROOT do cp 'config/env.example', '.env' end + # Create the database, load the schema, and initialize it with the seed data puts "\n== Preparing database ==" system! 'bin/rails db:setup' From a89cfe79040c6b6ac137c15c14852c71e7ac72fd Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 3 Sep 2018 14:23:08 +0200 Subject: [PATCH 11/14] setup: use overmind to start the application server --- bin/setup | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/setup b/bin/setup index 865d2be0a..3b1abf9db 100755 --- a/bin/setup +++ b/bin/setup @@ -36,6 +36,6 @@ chdir APP_ROOT do puts "\n== Removing old logs and tempfiles ==" system! 'bin/rails log:clear tmp:clear' - puts "\n== Restarting application server ==" - system! 'bin/rails restart' + puts "\n== Done ==" + puts "You can now start the application server with `overmind start`." end From 46d04fc131b4deafc1ce54d665efaf7278385907 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 3 Sep 2018 14:23:35 +0200 Subject: [PATCH 12/14] README: recommand `bin/setup` to initialize a development environment --- README.md | 19 ++++--------------- bin/setup | 2 -- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 14b1d3faf..ef0585fab 100644 --- a/README.md +++ b/README.md @@ -24,14 +24,7 @@ demarches-simplifiees.fr est un site web conçu afin de répondre au besoin urge * Mac : `brew install chromedriver` * Linux : voir https://sites.google.com/a/chromium.org/chromedriver/downloads -## Initialisation de l'environnement de développement - -Afin d'initialiser l'environnement de développement, exécutez la commande suivante : - - bundle install - yarn install - -## Création de la base de données +## Création des rôles de la base de données Les informations nécessaire à l'initialisation de la base doivent être pré-configurées à la main grâce à la procédure suivante : @@ -41,15 +34,11 @@ Les informations nécessaire à l'initialisation de la base doivent être pré-c > create user tps_test with password 'tps_test' superuser; > \q -Afin de générer la BDD de l'application, il est nécessaire d'exécuter les commandes suivantes : - - # Create and initialize the database - bin/rails db:create db:schema:load db:seed - - # Migrate the development database and the test database - bin/rails db:migrate +## Initialisation de l'environnement de développement +Afin d'initialiser l'environnement de développement, exécutez la commande suivante : + bin/setup ## Lancement de l'application diff --git a/bin/setup b/bin/setup index 3b1abf9db..86ae494c9 100755 --- a/bin/setup +++ b/bin/setup @@ -21,8 +21,6 @@ chdir APP_ROOT do system('bundle check') || system!('bundle install') system! 'bin/yarn install' - # Install JavaScript dependencies if using Yarn - # system('bin/yarn') puts "\n== Copying sample files ==" unless File.exist?('.env') From d690735223adc8e0ed6ce2cd0b7f5a1bf26cdc3a Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 3 Sep 2018 14:33:26 +0200 Subject: [PATCH 13/14] README: recommand `bin/update` to update the development environment --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index ef0585fab..57d9d161c 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,12 @@ L'application tourne à l'adresse `http://localhost:3000`. Un utilisateur de tes FindDubiousProceduresJob.set(cron: "0 0 * * *").perform_later Administrateurs::ActivateBeforeExpirationJob.set(cron: "0 8 * * *").perform_later +## Mise à jour de l'application + +Pour mettre à jour votre environnement de développement, installer les nouvelles dépendances et faire jouer les migrations, exécutez : + + bin/update + ## Exécution des tests (RSpec) Pour exécuter les tests de l'application, plusieurs possibilités : From df742421a873e4f07e4aea0853200c5df4755688 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Mon, 3 Sep 2018 15:47:12 +0200 Subject: [PATCH 14/14] Remove an env var --- app/uploaders/remote_downloader.rb | 2 +- config/initializers/urls.rb | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/uploaders/remote_downloader.rb b/app/uploaders/remote_downloader.rb index 73aef5579..1e6dbcd66 100644 --- a/app/uploaders/remote_downloader.rb +++ b/app/uploaders/remote_downloader.rb @@ -10,6 +10,6 @@ class RemoteDownloader protected def base_url - Rails.application.secrets.fog[:base_url] + FOG_BASE_URL end end diff --git a/config/initializers/urls.rb b/config/initializers/urls.rb index aa4624896..156397c6b 100644 --- a/config/initializers/urls.rb +++ b/config/initializers/urls.rb @@ -5,6 +5,9 @@ API_GEO_URL = "https://geo.api.gouv.fr" HELPSCOUT_API_URL = 'https://api.helpscout.net/v2' PIPEDRIVE_API_URL = 'https://api.pipedrive.com/v1' +# Internal URLs +FOG_BASE_URL = 'https://storage.apientreprise.fr' + # External services URLs DOC_URL = "https://doc.demarches-simplifiees.fr" LISTE_DES_DEMARCHES_URL = [DOC_URL, "listes-des-demarches"].join("/")