From 859d8896f89d007a6e9301d6adcb92f8b46ffbdb Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Thu, 14 Jun 2018 11:21:03 +0200 Subject: [PATCH 1/9] [#1421] use same order as in TypeDeChamp enum --- config/locales/models/type_de_champ/fr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/models/type_de_champ/fr.yml b/config/locales/models/type_de_champ/fr.yml index e740448d3..5788ae712 100644 --- a/config/locales/models/type_de_champ/fr.yml +++ b/config/locales/models/type_de_champ/fr.yml @@ -17,13 +17,13 @@ fr: address: 'Adresse' yes_no: 'Oui/Non' drop_down_list: 'Menu déroulant' + multiple_drop_down_list: 'Menu déroulant à choix multiples' pays: 'Pays' regions: 'Régions' departements: 'Départements' engagement: 'Engagement' header_section: 'Titre de section' explication: 'Explication' - multiple_drop_down_list: 'Menu déroulant à choix multiples' dossier_link: 'Lien vers un autre dossier' piece_justificative: 'Pièce justificative' siret: 'SIRET' From 15e8d8af058e9b22df13aee34cd1bdb6c0094f89 Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Thu, 14 Jun 2018 12:53:27 +0200 Subject: [PATCH 2/9] [#1421] Add linked dropown fields --- app/assets/javascripts/old_design/admin.js | 1 + app/models/champs/linked_drop_down_list_champ.rb | 2 ++ app/models/type_de_champ.rb | 1 + .../types_de_champ/linked_drop_down_list_type_de_champ.rb | 2 ++ app/views/admin/types_de_champ/_fields.html.haml | 2 +- config/locales/models/type_de_champ/fr.yml | 1 + spec/factories/type_de_champ.rb | 4 ++++ 7 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 app/models/champs/linked_drop_down_list_champ.rb create mode 100644 app/models/types_de_champ/linked_drop_down_list_type_de_champ.rb diff --git a/app/assets/javascripts/old_design/admin.js b/app/assets/javascripts/old_design/admin.js index 0e50d577e..981032ec3 100644 --- a/app/assets/javascripts/old_design/admin.js +++ b/app/assets/javascripts/old_design/admin.js @@ -38,6 +38,7 @@ function on_change_type_de_champ_select (){ break; case 'drop_down_list': case 'multiple_drop_down_list': + case 'linked_drop_down_list': parent.children(".drop-down-list").addClass('show-inline'); break; case 'piece_justificative': diff --git a/app/models/champs/linked_drop_down_list_champ.rb b/app/models/champs/linked_drop_down_list_champ.rb new file mode 100644 index 000000000..20fb7455a --- /dev/null +++ b/app/models/champs/linked_drop_down_list_champ.rb @@ -0,0 +1,2 @@ +class Champs::LinkedDropDownListChamp < Champ +end diff --git a/app/models/type_de_champ.rb b/app/models/type_de_champ.rb index 55358132e..f78ce2884 100644 --- a/app/models/type_de_champ.rb +++ b/app/models/type_de_champ.rb @@ -13,6 +13,7 @@ class TypeDeChamp < ApplicationRecord yes_no: 'yes_no', drop_down_list: 'drop_down_list', multiple_drop_down_list: 'multiple_drop_down_list', + linked_drop_down_list: 'linked_drop_down_list', pays: 'pays', regions: 'regions', departements: 'departements', diff --git a/app/models/types_de_champ/linked_drop_down_list_type_de_champ.rb b/app/models/types_de_champ/linked_drop_down_list_type_de_champ.rb new file mode 100644 index 000000000..e54cbef7f --- /dev/null +++ b/app/models/types_de_champ/linked_drop_down_list_type_de_champ.rb @@ -0,0 +1,2 @@ +class TypesDeChamp::LinkedDropDownListTypeDeChamp < TypeDeChamp +end diff --git a/app/views/admin/types_de_champ/_fields.html.haml b/app/views/admin/types_de_champ/_fields.html.haml index c9bb08b9e..4472a2c8d 100644 --- a/app/views/admin/types_de_champ/_fields.html.haml +++ b/app/views/admin/types_de_champ/_fields.html.haml @@ -14,7 +14,7 @@ %h4 Description = ff.text_area :description, class: 'form-control description', placeholder: 'Description', rows: 3 - .form-group.drop-down-list{ class: (%w(drop_down_list multiple_drop_down_list).include?(type_champ) ? 'show-inline' : nil), style: 'margin-right: 5px;' } + .form-group.drop-down-list{ class: (%w(drop_down_list multiple_drop_down_list linked_drop_down_list).include?(type_champ) ? 'show-inline' : nil), style: 'margin-right: 5px;' } %h4 Liste déroulante = ff.fields_for :drop_down_list_attributes, ff.object.object.drop_down_list do |fff| ~ fff.text_area :value, class: 'form-control drop_down_list', placeholder: "Ecrire une valeur par ligne et --valeur-- pour un séparateur.", rows: 3, cols: 30 diff --git a/config/locales/models/type_de_champ/fr.yml b/config/locales/models/type_de_champ/fr.yml index 5788ae712..465fa0745 100644 --- a/config/locales/models/type_de_champ/fr.yml +++ b/config/locales/models/type_de_champ/fr.yml @@ -18,6 +18,7 @@ fr: yes_no: 'Oui/Non' drop_down_list: 'Menu déroulant' multiple_drop_down_list: 'Menu déroulant à choix multiples' + linked_drop_down_list: 'Deux menus déroulants liés' pays: 'Pays' regions: 'Régions' departements: 'Départements' diff --git a/spec/factories/type_de_champ.rb b/spec/factories/type_de_champ.rb index b42acc7a1..eb75bfea2 100644 --- a/spec/factories/type_de_champ.rb +++ b/spec/factories/type_de_champ.rb @@ -50,6 +50,10 @@ FactoryBot.define do type_champ 'multiple_drop_down_list' drop_down_list { create(:drop_down_list) } end + factory :type_de_champ_linked_drop_down_list, class: 'TypesDeChamp::LinkedDropDownListTypeDeChamp' do + type_champ 'linked_drop_down_list' + drop_down_list { create(:drop_down_list) } + end factory :type_de_champ_pays, class: 'TypesDeChamp::PaysTypeDeChamp' do type_champ 'pays' end From d3df6e813c552be2fc02dbedf068e678e4f4ea1d Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Thu, 14 Jun 2018 15:22:47 +0200 Subject: [PATCH 3/9] [#1421] DRY up type de champ toggles --- app/helpers/type_de_champ_helper.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/helpers/type_de_champ_helper.rb b/app/helpers/type_de_champ_helper.rb index 846ba7a9b..71454ab96 100644 --- a/app/helpers/type_de_champ_helper.rb +++ b/app/helpers/type_de_champ_helper.rb @@ -1,13 +1,15 @@ module TypeDeChampHelper + TOGGLES = { + 'piece_justificative' => :champ_pj?, + 'siret' => :champ_siret? + } + def tdc_options tdcs = TypeDeChamp.type_de_champs_list_fr - if !Flipflop.champ_pj? - tdcs.reject! { |tdc| tdc.last == "piece_justificative" } - end - - if !Flipflop.champ_siret? - tdcs.reject! { |tdc| tdc.last == "siret" } + tdcs.select! do |tdc| + toggle = TOGGLES[tdc.last] + toggle.blank? || Flipflop.send(toggle) end tdcs From 226e3ca562df0dfc35823317a49e18ff47f7b92a Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Thu, 14 Jun 2018 15:43:18 +0200 Subject: [PATCH 4/9] [#1421] Subject linked dropdown field to feature toggle --- app/helpers/type_de_champ_helper.rb | 3 ++- config/features.rb | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/helpers/type_de_champ_helper.rb b/app/helpers/type_de_champ_helper.rb index 71454ab96..4882d34d4 100644 --- a/app/helpers/type_de_champ_helper.rb +++ b/app/helpers/type_de_champ_helper.rb @@ -1,7 +1,8 @@ module TypeDeChampHelper TOGGLES = { 'piece_justificative' => :champ_pj?, - 'siret' => :champ_siret? + 'siret' => :champ_siret?, + 'linked_drop_down_list' => :champ_linked_dropdown? } def tdc_options diff --git a/config/features.rb b/config/features.rb index 2ef08cc14..f5bcb649f 100644 --- a/config/features.rb +++ b/config/features.rb @@ -11,6 +11,8 @@ Flipflop.configure do title: "Champ pièce justificative" feature :champ_siret, title: "Champ SIRET" + feature :champ_linked_dropdown, + title: "Champ double menu déroulant" end feature :web_hook From 51e256e1229b82225d20f08b12d18507c4f89b43 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 25 Jun 2018 11:26:37 +0200 Subject: [PATCH 5/9] header: fix link to the contact email --- app/views/layouts/_new_header.haml | 3 ++- spec/views/layouts/_new_header_spec.rb | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/views/layouts/_new_header.haml b/app/views/layouts/_new_header.haml index f865b5f9f..abf0f3ba0 100644 --- a/app/views/layouts/_new_header.haml +++ b/app/views/layouts/_new_header.haml @@ -29,7 +29,8 @@ %br – par téléphone : 01 76 42 02 87 %br - = "– par email : #{CONTACT_EMAIL}" + – par email : + = link_to CONTACT_EMAIL, "mailto:#{CONTACT_EMAIL}" - if nav_bar_profile == :user %ul.header-tabs diff --git a/spec/views/layouts/_new_header_spec.rb b/spec/views/layouts/_new_header_spec.rb index 39a9ae58e..8ccbec46f 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 + sign_in user allow(controller).to receive(:nav_bar_profile).and_return(profile) render end @@ -10,15 +11,22 @@ describe 'layouts/_new_header.html.haml', type: :view do subject { rendered } context 'when rendering for user' do + let(:user) { create(:user) } let(:profile) { :user } it { is_expected.to have_css("a.header-logo[href=\"#{users_dossiers_path}\"]") } end context 'when rendering for gestionnaire' do + let(:user) { create(:gestionnaire) } let(:profile) { :gestionnaire } it { is_expected.to have_css("a.header-logo[href=\"#{gestionnaire_procedures_path}\"]") } + + it "displays the contact infos" do + expect(rendered).to have_text("Contact") + expect(rendered).to have_link(CONTACT_EMAIL, href: "mailto:#{CONTACT_EMAIL}") + end end end end From 956c3fe36c5b589ffa4c055f4994bac0d89f5ea1 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 25 Jun 2018 11:12:42 +0200 Subject: [PATCH 6/9] Replace hardcoded phone numbers by a CONTACT_PHONE constant --- app/views/administration_mailer/invite_admin.html.haml | 4 +++- app/views/layouts/_new_header.haml | 3 ++- app/views/layouts/mailers/_bizdev_signature.html.haml | 3 ++- config/initializers/{emails.rb => contacts.rb} | 2 ++ config/initializers/devise.rb | 2 +- lib/mailers/attestation_closed_mail_discrepancy_mailer.rb | 2 +- 6 files changed, 11 insertions(+), 5 deletions(-) rename config/initializers/{emails.rb => contacts.rb} (86%) diff --git a/app/views/administration_mailer/invite_admin.html.haml b/app/views/administration_mailer/invite_admin.html.haml index 1b0c515cf..425d5f5de 100644 --- a/app/views/administration_mailer/invite_admin.html.haml +++ b/app/views/administration_mailer/invite_admin.html.haml @@ -13,7 +13,9 @@ %p Afin de vous accompagner dans la découverte de demarches-simplifiees.fr, je vous propose de m’appeler pour faire un point sur vos besoins de dématérialisation. %br - Vous pouvez me joindre au numéro suivant : 01 76 42 02 87. + Vous pouvez me joindre au numéro suivant : + = CONTACT_PHONE + \. %p Je vous invite également à consulter notre site de documentation qui regroupe l'ensemble des informations relatives à demarches-simplifiees.fr ainsi que des tutoriels d’utilisation : diff --git a/app/views/layouts/_new_header.haml b/app/views/layouts/_new_header.haml index abf0f3ba0..c984ee4e5 100644 --- a/app/views/layouts/_new_header.haml +++ b/app/views/layouts/_new_header.haml @@ -27,7 +27,8 @@ .contact-details Vous avez besoin d’aide ? Contactez-nous : %br - – par téléphone : 01 76 42 02 87 + – par téléphone : + = link_to CONTACT_PHONE, "tel:#{CONTACT_PHONE}" %br – par email : = link_to CONTACT_EMAIL, "mailto:#{CONTACT_EMAIL}" diff --git a/app/views/layouts/mailers/_bizdev_signature.html.haml b/app/views/layouts/mailers/_bizdev_signature.html.haml index adff09cbb..4e1652a20 100644 --- a/app/views/layouts/mailers/_bizdev_signature.html.haml +++ b/app/views/layouts/mailers/_bizdev_signature.html.haml @@ -6,7 +6,8 @@ Cordialement, %br Équipe demarches-simplifiees.fr %br -Téléphone (standard) : 01 76 42 02 87 +Téléphone (standard) : += CONTACT_PHONE %br Incubateur de Services Numériques / beta.gouv.fr %br diff --git a/config/initializers/emails.rb b/config/initializers/contacts.rb similarity index 86% rename from config/initializers/emails.rb rename to config/initializers/contacts.rb index 9d81d1719..736a51dfc 100644 --- a/config/initializers/emails.rb +++ b/config/initializers/contacts.rb @@ -3,5 +3,7 @@ if !defined?(CONTACT_EMAIL) EQUIPE_EMAIL = "equipe@demarches-simplifiees.fr" TECH_EMAIL = "tech@demarches-simplifiees.fr" + CONTACT_PHONE = "01 76 42 02 87" + OLD_CONTACT_EMAIL = "contact@tps.apientreprise.fr" end diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 79919ad70..46e0b9663 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -1,4 +1,4 @@ -require_relative "emails" +require_relative "contacts" # Use this hook to configure devise mailer, warden hooks and so forth. # Many of these configuration options can be set straight in your model. diff --git a/lib/mailers/attestation_closed_mail_discrepancy_mailer.rb b/lib/mailers/attestation_closed_mail_discrepancy_mailer.rb index cf8e38026..9812740ec 100644 --- a/lib/mailers/attestation_closed_mail_discrepancy_mailer.rb +++ b/lib/mailers/attestation_closed_mail_discrepancy_mailer.rb @@ -34,7 +34,7 @@ module Mailers #{detail_procedures(procedures)} - Pour toute question vous pouvez nous joindre par téléphone au 01 76 42 02 87 + Pour toute question vous pouvez nous joindre par téléphone au #{CONTACT_PHONE} ou sur l’adresse email #{CONTACT_EMAIL}. -- \nL’équipe demarches-simplifiees.fr HEREDOC From a1f8baefdc61ae2f80522e909b753fa5a733676c Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Tue, 19 Jun 2018 17:18:38 +0200 Subject: [PATCH 7/9] auth: fit the signup button on a single line --- app/assets/stylesheets/new_design/auth.scss | 4 ++++ app/views/users/sessions/new.html.haml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/new_design/auth.scss b/app/assets/stylesheets/new_design/auth.scss index 4aae42a3d..78d1c3e47 100644 --- a/app/assets/stylesheets/new_design/auth.scss +++ b/app/assets/stylesheets/new_design/auth.scss @@ -110,6 +110,10 @@ $auth-breakpoint: $two-columns-breakpoint; font-weight: bold; } } + + .auth-signup-button { + white-space: nowrap; + } } .identity-form { diff --git a/app/views/users/sessions/new.html.haml b/app/views/users/sessions/new.html.haml index 5a2e4a025..3412a0439 100644 --- a/app/views/users/sessions/new.html.haml +++ b/app/views/users/sessions/new.html.haml @@ -57,4 +57,4 @@ %p.register %span Nouveau sur demarches-simplifiees.fr ? - = link_to "Créer un compte", new_registration_path(resource_name), class: "button" + = link_to "Créer un compte", new_registration_path(resource_name), class: "button auth-signup-button" From 805ea0595b61620533f47092ed0ec847688e5dce Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Tue, 19 Jun 2018 17:27:01 +0200 Subject: [PATCH 8/9] identite: add mandatory asterisk to CGU field --- app/views/new_user/dossiers/identite.html.haml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/new_user/dossiers/identite.html.haml b/app/views/new_user/dossiers/identite.html.haml index 5e5aa4349..de65aefb1 100644 --- a/app/views/new_user/dossiers/identite.html.haml +++ b/app/views/new_user/dossiers/identite.html.haml @@ -44,5 +44,6 @@ = df.check_box :autorisation_donnees, required: true J'accepte = link_to "les CGU", CGU_URL, target: :blank + %span.mandatory * = f.submit "Continuer", class: "button large primary expand" From 202a1dd7ceaf4a49fc4a34bd04b80a5a5904b512 Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Tue, 26 Jun 2018 17:45:18 +0200 Subject: [PATCH 9/9] Show siege social siret in accompagnateur view --- .../new_gestionnaire/dossiers/_identite_entreprise.html.haml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/views/new_gestionnaire/dossiers/_identite_entreprise.html.haml b/app/views/new_gestionnaire/dossiers/_identite_entreprise.html.haml index ae149afc2..8dfe73487 100644 --- a/app/views/new_gestionnaire/dossiers/_identite_entreprise.html.haml +++ b/app/views/new_gestionnaire/dossiers/_identite_entreprise.html.haml @@ -6,6 +6,11 @@ %tr %th.libelle SIRET : %td= etablissement.siret + + - if etablissement.siret != etablissement.entreprise.siret_siege_social + %tr + %th.libelle SIRET du siège social: + %td= etablissement.entreprise.siret_siege_social %tr %th.libelle Forme juridique : %td= sanitize(etablissement.entreprise.forme_juridique)