From 06aed4bcf24847021b85d3741a2329726548e2d6 Mon Sep 17 00:00:00 2001 From: philemon95 <40801449+philemon95@users.noreply.github.com> Date: Tue, 19 Feb 2019 16:12:29 +0100 Subject: [PATCH 01/29] Update _general_footer_row.html.haml --- app/views/new_user/_general_footer_row.html.haml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/views/new_user/_general_footer_row.html.haml b/app/views/new_user/_general_footer_row.html.haml index f0cf078d3..e00bed4af 100644 --- a/app/views/new_user/_general_footer_row.html.haml +++ b/app/views/new_user/_general_footer_row.html.haml @@ -5,3 +5,7 @@ = link_to "Mentions légales", MENTIONS_LEGALES_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer" – = contact_link "Contact technique", class: "footer-link", dossier_id: dossier&.id +- += link_to 'FAQ', "https://faq.demarches-simplifiees.fr" +- += link_to 'Documentation', "http://doc.demarches-simplifiees.fr" From f7650135f4c9b60d1e60081ae0f5d60e18d2480c Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Tue, 5 Feb 2019 20:57:58 +0100 Subject: [PATCH 02/29] [Fix #3375] on the API display safe files only --- .../champs/piece_justificative_champ.rb | 2 +- .../champs/piece_justificative_champ_spec.rb | 24 +++++++++++++++++++ spec/serializers/champ_serializer_spec.rb | 5 +++- 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 spec/models/champs/piece_justificative_champ_spec.rb diff --git a/app/models/champs/piece_justificative_champ.rb b/app/models/champs/piece_justificative_champ.rb index 7e7e897b6..8f140c8e4 100644 --- a/app/models/champs/piece_justificative_champ.rb +++ b/app/models/champs/piece_justificative_champ.rb @@ -49,7 +49,7 @@ class Champs::PieceJustificativeChamp < Champ end def for_api - if piece_justificative_file.attached? + if piece_justificative_file.attached? && virus_scan&.safe? Rails.application.routes.url_helpers.url_for(piece_justificative_file) end end diff --git a/spec/models/champs/piece_justificative_champ_spec.rb b/spec/models/champs/piece_justificative_champ_spec.rb new file mode 100644 index 000000000..3c44c791b --- /dev/null +++ b/spec/models/champs/piece_justificative_champ_spec.rb @@ -0,0 +1,24 @@ +describe Champs::PieceJustificativeChamp do + describe '#for_api' do + let(:champ_pj) { create(:champ_piece_justificative) } + + before { champ_pj.virus_scan.update(status: status) } + + subject { champ_pj.for_api } + + context 'when file is safe' do + let(:status) { 'safe' } + it { is_expected.to include("/rails/active_storage/blobs/") } + end + + context 'when file is not scanned' do + let(:status) { 'pending' } + it { is_expected.to be_nil } + end + + context 'when file is infected' do + let(:status) { 'infected' } + it { is_expected.to be_nil } + end + end +end diff --git a/spec/serializers/champ_serializer_spec.rb b/spec/serializers/champ_serializer_spec.rb index d88916685..af119ca69 100644 --- a/spec/serializers/champ_serializer_spec.rb +++ b/spec/serializers/champ_serializer_spec.rb @@ -8,7 +8,10 @@ describe ChampSerializer do let(:champ) { create(:champ_piece_justificative) } - before { champ.piece_justificative_file.attach({ filename: __FILE__, io: File.open(__FILE__) }) } + before do + champ.piece_justificative_file.attach({ filename: __FILE__, io: File.open(__FILE__) }) + champ.reload.virus_scan.safe! + end after { champ.piece_justificative_file.purge } it { is_expected.to include(value: url_for(champ.piece_justificative_file)) } From 3f11f65d73782376e9d8f69e644b9f7b8a42a815 Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Wed, 20 Feb 2019 11:17:40 +0100 Subject: [PATCH 03/29] Revert "Update _general_footer_row.html.haml" --- app/views/new_user/_general_footer_row.html.haml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/views/new_user/_general_footer_row.html.haml b/app/views/new_user/_general_footer_row.html.haml index e00bed4af..f0cf078d3 100644 --- a/app/views/new_user/_general_footer_row.html.haml +++ b/app/views/new_user/_general_footer_row.html.haml @@ -5,7 +5,3 @@ = link_to "Mentions légales", MENTIONS_LEGALES_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer" – = contact_link "Contact technique", class: "footer-link", dossier_id: dossier&.id -- -= link_to 'FAQ', "https://faq.demarches-simplifiees.fr" -- -= link_to 'Documentation', "http://doc.demarches-simplifiees.fr" From a7ba01a02aab538b4152c469672c29dc135dc386 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Wed, 20 Feb 2019 16:26:12 +0100 Subject: [PATCH 04/29] Fix champ spec fix #3257 --- spec/models/champ_spec.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spec/models/champ_spec.rb b/spec/models/champ_spec.rb index 1b634348e..339a3600a 100644 --- a/spec/models/champ_spec.rb +++ b/spec/models/champ_spec.rb @@ -426,6 +426,10 @@ describe Champ do expect(champ.champs.first.dossier).to eq(dossier) + # Make champs ordered + champ_integer_number.type_de_champ.update(order_place: 0) + champ_text.type_de_champ.update(order_place: 1) + champ.champs << champ_integer_number row = champ.reload.rows.first expect(row.size).to eq(1) From 84383fc3c192e78b904be505f08720929e040d71 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Tue, 29 Jan 2019 11:49:28 +0100 Subject: [PATCH 05/29] Assigne admins to procedure.administrateurs --- app/controllers/admin/procedures_controller.rb | 2 +- app/models/procedure.rb | 8 +++++++- lib/tasks/support.rake | 6 ++++++ spec/factories/procedure.rb | 4 ++++ spec/models/procedure_spec.rb | 14 +++++++++++++- 5 files changed, 31 insertions(+), 3 deletions(-) diff --git a/app/controllers/admin/procedures_controller.rb b/app/controllers/admin/procedures_controller.rb index 6b9a347a8..ba277ae29 100644 --- a/app/controllers/admin/procedures_controller.rb +++ b/app/controllers/admin/procedures_controller.rb @@ -67,7 +67,7 @@ class Admin::ProceduresController < AdminController end def create - @procedure = Procedure.new(procedure_params) + @procedure = current_administrateur.admin_procedures.build(procedure_params) @path = @procedure.path @availability = Procedure.path_availability(current_administrateur, @procedure.path) diff --git a/app/models/procedure.rb b/app/models/procedure.rb index 992f273db..59943c98a 100644 --- a/app/models/procedure.rb +++ b/app/models/procedure.rb @@ -189,7 +189,7 @@ class Procedure < ApplicationRecord end def clone(admin, from_library) - is_different_admin = self.administrateur_id != admin.id + is_different_admin = !admin.owns?(self) populate_champ_stable_ids procedure = self.deep_clone(include: @@ -214,6 +214,12 @@ class Procedure < ApplicationRecord procedure.types_de_champ.each { |tdc| tdc.options&.delete(:old_pj) } end + if is_different_admin + procedure.administrateurs = [admin] + else + procedure.administrateurs = administrateurs + end + procedure.administrateur = admin procedure.initiated_mail = initiated_mail&.dup procedure.received_mail = received_mail&.dup diff --git a/lib/tasks/support.rake b/lib/tasks/support.rake index 6bf178709..27122a09e 100644 --- a/lib/tasks/support.rake +++ b/lib/tasks/support.rake @@ -26,6 +26,8 @@ namespace :support do procedure = Procedure.find(procedure_id) rake_puts("Changing owner of procedure ##{procedure_id} from ##{procedure.administrateur_id} to ##{new_owner.id}") + procedure.administrateurs.delete(procedure.administrateur) + procedure.administrateurs << new_owner procedure.update(administrateur: new_owner) end @@ -68,6 +70,10 @@ namespace :support do fail "Must specify a new owner" end + procedures.each do |procedure| + procedure.administrateurs.delete(procedure.administrateur) + procedure.administrateurs << new_owner + end procedures.update_all(administrateur_id: new_owner.id) end diff --git a/spec/factories/procedure.rb b/spec/factories/procedure.rb index 0e6d44c41..e58849594 100644 --- a/spec/factories/procedure.rb +++ b/spec/factories/procedure.rb @@ -12,6 +12,10 @@ FactoryBot.define do duree_conservation_dossiers_hors_ds { 6 } ask_birthday { false } + after(:build) do |procedure| + procedure.administrateurs = [procedure.administrateur] + end + factory :procedure_with_dossiers do transient do dossiers_count { 1 } diff --git a/spec/models/procedure_spec.rb b/spec/models/procedure_spec.rb index f69fffc46..7ff80f12f 100644 --- a/spec/models/procedure_spec.rb +++ b/spec/models/procedure_spec.rb @@ -404,7 +404,9 @@ describe Procedure do context 'when the procedure is cloned from the library' do let(:from_library) { true } - it { expect(subject.cloned_from_library).to be(true) } + it 'should set cloned_from_library to true' do + expect(subject.cloned_from_library).to be(true) + end it 'should set service_id to nil' do expect(subject.service).to eq(nil) @@ -415,6 +417,11 @@ describe Procedure do expect(stc.old_pj).to be_nil end end + + it 'should have one administrateur' do + expect(subject.administrateur).to eq(administrateur) + expect(subject.administrateurs).to eq([administrateur]) + end end it 'should keep service_id' do @@ -435,6 +442,11 @@ describe Procedure do expect(stc.old_pj).to be_nil end end + + it 'should have one administrateur' do + expect(subject.administrateur).to eq(administrateur) + expect(subject.administrateurs).to eq([administrateur]) + end end it 'should duplicate existing mail_templates' do From 12e93391c966173d6fb2b28a12cac757ac7bab7b Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Thu, 14 Feb 2019 11:54:46 +0100 Subject: [PATCH 06/29] Task to add administrateur to administrateurs --- ...dure_administrateur_to_administrateurs.rake | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 lib/tasks/deployment/20190214101524_add_procedure_administrateur_to_administrateurs.rake diff --git a/lib/tasks/deployment/20190214101524_add_procedure_administrateur_to_administrateurs.rake b/lib/tasks/deployment/20190214101524_add_procedure_administrateur_to_administrateurs.rake new file mode 100644 index 000000000..78683c2c2 --- /dev/null +++ b/lib/tasks/deployment/20190214101524_add_procedure_administrateur_to_administrateurs.rake @@ -0,0 +1,18 @@ +namespace :after_party do + desc 'Deployment task: add_procedure_administrateur_to_administrateurs' + task add_procedure_administrateur_to_administrateurs: :environment do + rake_puts "Running deploy task: 'add_procedure_administrateur_to_administrateurs'" + procedures = Procedure.includes(:administrateurs) + progress = ProgressReport.new(procedures.count) + + procedures.find_each do |procedure| + if !procedure.administrateurs.include?(procedure.administrateur) + procedure.administrateurs << procedure.administrateur + end + progress.inc + end + + progress.finish + AfterParty::TaskRecord.create version: '20190214101524' + end +end From aa8e28b2c0160a8480a57588706829347de7a9ed Mon Sep 17 00:00:00 2001 From: clemkeirua Date: Thu, 21 Feb 2019 11:45:39 +0100 Subject: [PATCH 07/29] =?UTF-8?q?ajout=20de=20pr=C3=A9cisions=20concernant?= =?UTF-8?q?=20les=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 2e693451d..9d41c3937 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,8 @@ Pour mettre à jour votre environnement de développement, installer les nouvell ### Exécution des tests (RSpec) +Les tests ont besoin de leur propre base de données et certains d'entre eux utilisent Selenium pour s'exécuter dans un navigateur. N'oubliez pas de créer la base de test et d'installer chrome et chromedriver pour exécuter tous les tests. + Pour exécuter les tests de l'application, plusieurs possibilités : - Lancer tous les tests From 236f73f838fb21723b771fc42f9a65cb57ae21fc Mon Sep 17 00:00:00 2001 From: clemkeirua Date: Wed, 20 Feb 2019 11:48:08 +0100 Subject: [PATCH 08/29] ajout d'une balise pour le nom du service --- app/models/concerns/tags_substitution_concern.rb | 6 ++++++ spec/models/concern/tags_substitution_concern_spec.rb | 11 ++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/models/concerns/tags_substitution_concern.rb b/app/models/concerns/tags_substitution_concern.rb index 1162beb0e..390555775 100644 --- a/app/models/concerns/tags_substitution_concern.rb +++ b/app/models/concerns/tags_substitution_concern.rb @@ -40,6 +40,12 @@ module TagsSubstitutionConcern description: '', target: :id, available_for_states: Dossier::SOUMIS + }, + { + libelle: 'nom du service', + description: 'Le nom du service instructeur qui traite le dossier', + lambda: -> (d) { d.procedure.organisation_name || '' }, + available_for_states: Dossier::SOUMIS } ] diff --git a/spec/models/concern/tags_substitution_concern_spec.rb b/spec/models/concern/tags_substitution_concern_spec.rb index b2a640214..95010a657 100644 --- a/spec/models/concern/tags_substitution_concern_spec.rb +++ b/spec/models/concern/tags_substitution_concern_spec.rb @@ -4,12 +4,15 @@ describe TagsSubstitutionConcern, type: :model do let(:for_individual) { false } let(:state) { Dossier.states.fetch(:accepte) } + let(:service) { create(:service, nom: 'Service instructeur') } + let(:procedure) do create(:procedure, libelle: 'Une magnifique démarche', types_de_champ: types_de_champ, types_de_champ_private: types_de_champ_private, - for_individual: for_individual) + for_individual: for_individual, + service: service) end let(:template_concern) do @@ -144,6 +147,12 @@ describe TagsSubstitutionConcern, type: :model do end end + context 'when the dossier has a service' do + let(:template) { 'Dossier traité par --nom du service--' } + + it { is_expected.to eq("Dossier traité par #{service.nom}") } + end + context 'when the dossier has a motivation' do let(:dossier) { create(:dossier, motivation: 'motivation') } From 71bff0812c61f258aa68445ca645188d46d31f3c Mon Sep 17 00:00:00 2001 From: clemkeirua Date: Thu, 21 Feb 2019 11:24:56 +0000 Subject: [PATCH 09/29] =?UTF-8?q?ajout=20d'un=20test=20pour=20caract=C3=A9?= =?UTF-8?q?riser=20le=20cas=20service=20=3D=20null?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../concern/tags_substitution_concern_spec.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/spec/models/concern/tags_substitution_concern_spec.rb b/spec/models/concern/tags_substitution_concern_spec.rb index 95010a657..6ae053824 100644 --- a/spec/models/concern/tags_substitution_concern_spec.rb +++ b/spec/models/concern/tags_substitution_concern_spec.rb @@ -12,7 +12,8 @@ describe TagsSubstitutionConcern, type: :model do types_de_champ: types_de_champ, types_de_champ_private: types_de_champ_private, for_individual: for_individual, - service: service) + service: service, + organisation: nil) end let(:template_concern) do @@ -147,10 +148,17 @@ describe TagsSubstitutionConcern, type: :model do end end - context 'when the dossier has a service' do + context 'when the user requests the service' do let(:template) { 'Dossier traité par --nom du service--' } - it { is_expected.to eq("Dossier traité par #{service.nom}") } + context 'and there is a service' do + it { is_expected.to eq("Dossier traité par #{service.nom}") } + end + + context 'and there is no service yet' do + let(:service) { nil } + it { is_expected.to eq("Dossier traité par ") } + end end context 'when the dossier has a motivation' do From 2e2424ec3fb055d34a9eda379e6f75fffcf4c27d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chai=CC=88b=20Martinez?= Date: Tue, 12 Feb 2019 16:18:29 +0100 Subject: [PATCH 10/29] Minor html/css change --- app/assets/stylesheets/switch_menu.scss | 13 ++++++- .../_switch_devise_profile_module.html.haml | 38 +++++++------------ 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/app/assets/stylesheets/switch_menu.scss b/app/assets/stylesheets/switch_menu.scss index e9c18733c..adf6b15df 100644 --- a/app/assets/stylesheets/switch_menu.scss +++ b/app/assets/stylesheets/switch_menu.scss @@ -1,6 +1,17 @@ #switch-menu { position: fixed; - left: 10px; bottom: 10px; z-index: 300; + color:#ffffff; + list-style: none; + text-decoration : none; + padding-left: 20px; + } + +#switch-menu a, #switch-menu a:link , #switch-menu a:visited , #switch-menu a:hover { + text-decoration : none; + color:#ffffff; + +} + diff --git a/app/views/layouts/_switch_devise_profile_module.html.haml b/app/views/layouts/_switch_devise_profile_module.html.haml index 2b13779b5..e70e11ffa 100644 --- a/app/views/layouts/_switch_devise_profile_module.html.haml +++ b/app/views/layouts/_switch_devise_profile_module.html.haml @@ -1,25 +1,15 @@ - if SwitchDeviseProfileService.new(warden).multiple_devise_profile_connect? - #switch-menu.dropdown.dropup - %button.btn.btn-default.dropdown-toggle{ type: :button, 'data-toggle' => 'dropdown', 'aria-haspopup' => true, 'aria-expanded' => false } - %i.fa.fa-toggle-on - %span.caret - %ul.dropdown-menu.dropdown-menu-left - - if user_signed_in? - %li - = link_to(dossiers_path, id: :menu_item_procedure) do - %i.fa.fa-user -   - Usager - - if gestionnaire_signed_in? - %li - = link_to(gestionnaire_procedures_path) do - %i.fa.fa-user -   - Instructeur - - - if administrateur_signed_in? - %li - = link_to(admin_procedures_path) do - %i.fa.fa-user -   - Administrateur + %ul#switch-menu + %li Tester en tant que... + - if user_signed_in? + %li + = link_to(dossiers_path, id: :menu_item_procedure, title:'Aller dans votre espace usager. Vous pourrez revenir ici ensuite') do + %i.fa.fa-users +   + Usager + - if gestionnaire_signed_in? + %li + = link_to(gestionnaire_procedures_path, title:'Aller dans votre espace instructeur. Vous pourrez revenir ici ensuite.') do + %i.fa.fa-user +   + Instructeur From e29415d4013b0dceba54add5bc72f3f1bdb55440 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chai=CC=88b=20Martinez?= Date: Wed, 20 Feb 2019 14:49:42 +0100 Subject: [PATCH 11/29] remove switch button MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Chaïb Martinez --- app/views/layouts/application_old.html.haml | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/views/layouts/application_old.html.haml b/app/views/layouts/application_old.html.haml index a5a6a67b8..633e368dc 100644 --- a/app/views/layouts/application_old.html.haml +++ b/app/views/layouts/application_old.html.haml @@ -48,6 +48,4 @@ %h1 %i.fa.fa-times{ style: 'position: fixed; top: 10; right: 30; color: white;' } - = render partial: 'layouts/switch_devise_profile_module' - = render partial: 'layouts/footer', locals: { main_container_size: main_container_size } From 97fda013c0ec03a34d78c8bbd15f6df82424899a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chai=CC=88b=20Martinez?= Date: Wed, 20 Feb 2019 14:49:56 +0100 Subject: [PATCH 12/29] Minor texte changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Chaïb Martinez --- app/views/layouts/_switch_devise_profile_module.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/_switch_devise_profile_module.html.haml b/app/views/layouts/_switch_devise_profile_module.html.haml index e70e11ffa..6cbcdbad1 100644 --- a/app/views/layouts/_switch_devise_profile_module.html.haml +++ b/app/views/layouts/_switch_devise_profile_module.html.haml @@ -1,6 +1,6 @@ - if SwitchDeviseProfileService.new(warden).multiple_devise_profile_connect? %ul#switch-menu - %li Tester en tant que... + %li Changer de rôle... - if user_signed_in? %li = link_to(dossiers_path, id: :menu_item_procedure, title:'Aller dans votre espace usager. Vous pourrez revenir ici ensuite') do @@ -12,4 +12,4 @@ = link_to(gestionnaire_procedures_path, title:'Aller dans votre espace instructeur. Vous pourrez revenir ici ensuite.') do %i.fa.fa-user   - Instructeur + Instructeur \ No newline at end of file From b532d6521ebb482cf3afef863810c743c3571ce4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chai=CC=88b=20Martinez?= Date: Wed, 20 Feb 2019 14:50:28 +0100 Subject: [PATCH 13/29] Add switch account type layout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Chaïb Martinez --- .../_left_panel_admin_procedurescontroller_index.html.haml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_index.html.haml b/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_index.html.haml index bdf47c5e3..30c64b9bf 100644 --- a/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_index.html.haml +++ b/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_index.html.haml @@ -31,6 +31,7 @@ = current_administrateur.procedures.archivees.count .split-hr-left + = render partial: 'layouts/switch_devise_profile_module' #infos-block From 221ed952d191a008c63c489962a78a4a1641e34b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chai=CC=88b=20Martinez?= Date: Tue, 12 Feb 2019 16:18:29 +0100 Subject: [PATCH 14/29] Redesign admin roles menu --- app/assets/stylesheets/switch_menu.scss | 16 ++++++++-------- .../_switch_devise_profile_module.html.haml | 13 ++++++------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/app/assets/stylesheets/switch_menu.scss b/app/assets/stylesheets/switch_menu.scss index adf6b15df..8333eef90 100644 --- a/app/assets/stylesheets/switch_menu.scss +++ b/app/assets/stylesheets/switch_menu.scss @@ -2,16 +2,16 @@ position: fixed; bottom: 10px; z-index: 300; - color:#ffffff; + color: #FFFFFF; list-style: none; - text-decoration : none; + text-decoration: none; padding-left: 20px; - } -#switch-menu a, #switch-menu a:link , #switch-menu a:visited , #switch-menu a:hover { - text-decoration : none; - color:#ffffff; - +#switch-menu a, +#switch-menu a:link, +#switch-menu a:visited, +#switch-menu a:hover { + text-decoration: none; + color: #FFFFFF; } - diff --git a/app/views/layouts/_switch_devise_profile_module.html.haml b/app/views/layouts/_switch_devise_profile_module.html.haml index 6cbcdbad1..02f2678a2 100644 --- a/app/views/layouts/_switch_devise_profile_module.html.haml +++ b/app/views/layouts/_switch_devise_profile_module.html.haml @@ -1,15 +1,14 @@ - if SwitchDeviseProfileService.new(warden).multiple_devise_profile_connect? %ul#switch-menu - %li Changer de rôle... + %li + Changer de rôle - if user_signed_in? %li - = link_to(dossiers_path, id: :menu_item_procedure, title:'Aller dans votre espace usager. Vous pourrez revenir ici ensuite') do + = link_to(dossiers_path, id: :menu_item_procedure, title: 'Aller dans votre espace usager. Vous pourrez revenir ici ensuite') do %i.fa.fa-users -   - Usager +   Usager - if gestionnaire_signed_in? %li - = link_to(gestionnaire_procedures_path, title:'Aller dans votre espace instructeur. Vous pourrez revenir ici ensuite.') do + = link_to(gestionnaire_procedures_path, title: 'Aller dans votre espace instructeur. Vous pourrez revenir ici ensuite.') do %i.fa.fa-user -   - Instructeur \ No newline at end of file +   Instructeur From 9f1c089b304b134913ad644d255bdfbf4ed0b1bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chai=CC=88b=20Martinez?= Date: Wed, 20 Feb 2019 14:53:19 +0100 Subject: [PATCH 15/29] Minor css changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Chaïb Martinez --- app/assets/stylesheets/switch_menu.scss | 1 - 1 file changed, 1 deletion(-) diff --git a/app/assets/stylesheets/switch_menu.scss b/app/assets/stylesheets/switch_menu.scss index 8333eef90..bd8e913ea 100644 --- a/app/assets/stylesheets/switch_menu.scss +++ b/app/assets/stylesheets/switch_menu.scss @@ -1,7 +1,6 @@ #switch-menu { position: fixed; bottom: 10px; - z-index: 300; color: #FFFFFF; list-style: none; text-decoration: none; From 066672803b2d7c9a98450fcace75db15126d7d2d Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Wed, 20 Feb 2019 13:08:53 +0000 Subject: [PATCH 16/29] pj_link: fix an exception when the scan is not associated yet --- .../piece_justificative/_pj_link.html.haml | 6 +-- spec/factories/virus_scan.rb | 13 +++++ .../_pj_link.html.haml_spec.rb | 51 +++++++++++++++++++ 3 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 spec/views/shared/champs/piece_justificative/_pj_link.html.haml_spec.rb diff --git a/app/views/shared/champs/piece_justificative/_pj_link.html.haml b/app/views/shared/champs/piece_justificative/_pj_link.html.haml index 5e7fd5dc8..4a49defbf 100644 --- a/app/views/shared/champs/piece_justificative/_pj_link.html.haml +++ b/app/views/shared/champs/piece_justificative/_pj_link.html.haml @@ -1,12 +1,12 @@ - pj = champ.piece_justificative_file .pj-link - - if champ.virus_scan.safe? || champ.virus_scan.blank? + - if champ.virus_scan.blank? || champ.virus_scan.safe? = link_to url_for(pj), target: '_blank', title: "Télécharger la pièce jointe" do %span.icon.attachment = pj.filename.to_s - if champ.virus_scan.blank? - (ce fichier n'a pas été analysé par notre antivirus, téléchargez-le avec précaution) + (ce fichier n’a pas été analysé par notre antivirus, téléchargez-le avec précaution) - else = pj.filename.to_s @@ -16,6 +16,6 @@ ) - elsif champ.virus_scan.infected? - if user_can_upload - (virus détecté, merci d'envoyer un autre fichier) + (virus détecté, merci d’envoyer un autre fichier) - else (virus détecté, le téléchargement de ce fichier est bloqué) diff --git a/spec/factories/virus_scan.rb b/spec/factories/virus_scan.rb index 198f63ee8..1ffade312 100644 --- a/spec/factories/virus_scan.rb +++ b/spec/factories/virus_scan.rb @@ -1,4 +1,17 @@ FactoryBot.define do factory :virus_scan do + add_attribute(:status) { VirusScan.statuses.fetch(:pending) } + + trait :pending do + add_attribute(:status) { VirusScan.statuses.fetch(:pending) } + end + + trait :safe do + add_attribute(:status) { VirusScan.statuses.fetch(:safe) } + end + + trait :infected do + add_attribute(:status) { VirusScan.statuses.fetch(:infected) } + end end end diff --git a/spec/views/shared/champs/piece_justificative/_pj_link.html.haml_spec.rb b/spec/views/shared/champs/piece_justificative/_pj_link.html.haml_spec.rb new file mode 100644 index 000000000..4eb6c12d4 --- /dev/null +++ b/spec/views/shared/champs/piece_justificative/_pj_link.html.haml_spec.rb @@ -0,0 +1,51 @@ +require 'rails_helper' + +describe 'shared/champs/piece_justificative/_pj_link.html.haml', type: :view do + let(:champ) { create(:champ, :piece_justificative, :with_piece_justificative_file) } + let(:virus_scan) { nil } + + before do + if virus_scan + champ.update(virus_scan: virus_scan) + end + end + + subject { render 'shared/champs/piece_justificative/pj_link', champ: champ, user_can_upload: false } + + context 'when there is no anti-virus scan' do + let(:virus_scan) { nil } + + it 'allows to download the file' do + expect(subject).to have_link(champ.piece_justificative_file.filename.to_s) + expect(subject).to have_text('ce fichier n’a pas été analysé par notre antivirus') + end + end + + context 'when the anti-virus scan is pending' do + let(:virus_scan) { create(:virus_scan, :pending) } + + it 'displays the filename, but doesn’t allow to download the file' do + expect(subject).to have_text(champ.piece_justificative_file.filename.to_s) + expect(subject).not_to have_link(champ.piece_justificative_file.filename.to_s) + expect(subject).to have_text('analyse antivirus en cours') + end + end + + context 'when the file is scanned and safe' do + let(:virus_scan) { create(:virus_scan, :safe) } + + it 'allows to download the file' do + expect(subject).to have_link(champ.piece_justificative_file.filename.to_s) + end + end + + context 'when the file is scanned and infected' do + let(:virus_scan) { create(:virus_scan, :infected) } + + it 'displays the filename, but doesn’t allow to download the file' do + expect(subject).to have_text(champ.piece_justificative_file.filename.to_s) + expect(subject).not_to have_link(champ.piece_justificative_file.filename.to_s) + expect(subject).to have_text('virus détecté') + end + end +end From fb5e24028fdae6a8ea717455b524c3f5cd5294c9 Mon Sep 17 00:00:00 2001 From: philemon95 <40801449+philemon95@users.noreply.github.com> Date: Thu, 21 Feb 2019 11:56:17 +0100 Subject: [PATCH 17/29] Update new.html.haml --- app/views/demandes/new.html.haml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/views/demandes/new.html.haml b/app/views/demandes/new.html.haml index 14f0e3789..09a7bf4c3 100644 --- a/app/views/demandes/new.html.haml +++ b/app/views/demandes/new.html.haml @@ -9,6 +9,8 @@ %p.intro Attention, la création de compte administrateur est réservée uniquement aux organismes publics. Elle ne concerne ni les particuliers, ni les entreprises, ni les associations (sauf celles reconnues d'utilité publique), ni les personnes souhaitant remplir un dossier ou faire une démarche en ligne. Ce compte vous permettra de créer des démarches sur demarches-simplifiees.fr, vous pourrez ensuite les diffuser en ligne auprès de vos usagers. %p.intro Pour obtenir un compte administrateur sur demarches-simplifiees.fr, veuillez remplir le formulaire ci-dessous et un membre de notre équipe vous contactera dès que possible. %p.intro Tous les champs sont obligatoires. + %p.intro Si vous souhaitez seulement compléter une démarche sur notre site, vous n'avez pas besoin de compte administrateur! + %hr From 0820db0161656591b05c02f3a7f96bcca00e1e44 Mon Sep 17 00:00:00 2001 From: philemon95 <40801449+philemon95@users.noreply.github.com> Date: Thu, 21 Feb 2019 15:16:46 +0000 Subject: [PATCH 18/29] demande: add text to prevent users from creating an admin account --- app/views/demandes/new.html.haml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/views/demandes/new.html.haml b/app/views/demandes/new.html.haml index 09a7bf4c3..a1a44cda0 100644 --- a/app/views/demandes/new.html.haml +++ b/app/views/demandes/new.html.haml @@ -6,6 +6,20 @@ .container.demande %h1 Demande de compte administrateur + .card + .card-title + Vous souhaitez seulement compléter une démarche sur notre site ? + %p + Vous n'avez pas besoin de compte administrateur ! + %p + Cliquez plutôt sur le + %strong lien direct + vers votre démarche que doit vous communiquer l'administration – par exemple https://www.demarches-simplifiees.fr/commencer/NOM_DE_LA_DEMARCHE. + %p + Vous pouvez aussi consulter la + = succeed '.' do + = link_to "liste des démarches disponibles", "https://doc.demarches-simplifiees.fr/listes-des-demarches" + %p.intro Attention, la création de compte administrateur est réservée uniquement aux organismes publics. Elle ne concerne ni les particuliers, ni les entreprises, ni les associations (sauf celles reconnues d'utilité publique), ni les personnes souhaitant remplir un dossier ou faire une démarche en ligne. Ce compte vous permettra de créer des démarches sur demarches-simplifiees.fr, vous pourrez ensuite les diffuser en ligne auprès de vos usagers. %p.intro Pour obtenir un compte administrateur sur demarches-simplifiees.fr, veuillez remplir le formulaire ci-dessous et un membre de notre équipe vous contactera dès que possible. %p.intro Tous les champs sont obligatoires. From 8f3d4de6c3172b9bcddbc13fbfc2b2d7cf3fc442 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Thu, 21 Feb 2019 16:21:20 +0100 Subject: [PATCH 19/29] patron: don't override `p` style on the patron page It adds a global styles that messes with the elements we are trying to present. --- app/assets/stylesheets/new_design/patron.scss | 2 +- app/views/root/patron.html.haml | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/assets/stylesheets/new_design/patron.scss b/app/assets/stylesheets/new_design/patron.scss index 90f4931f4..ae160adab 100644 --- a/app/assets/stylesheets/new_design/patron.scss +++ b/app/assets/stylesheets/new_design/patron.scss @@ -1,7 +1,7 @@ @import "colors"; .patron { - p { + .patron-section { margin-bottom: 20px; } diff --git a/app/views/root/patron.html.haml b/app/views/root/patron.html.haml index 2988473e2..871899932 100644 --- a/app/views/root/patron.html.haml +++ b/app/views/root/patron.html.haml @@ -46,7 +46,7 @@ %h1 Boutons - %p + .patron-section = link_to ".button", "#", class: "button" = link_to ".button.primary", "#", class: "button primary" @@ -62,7 +62,7 @@ = link_to "#", class: "button icon-only" do %span.icon.follow - %p + .patron-section %button.button{ disabled: true } .button.disabled %button.button.primary{ disabled: true } .button.primary.disabled @@ -71,24 +71,24 @@ %button.button.danger{ disabled: true } .button.danger.disabled - %p + .patron-section = link_to ".button.accepted", "#", class: "button accepted" = link_to ".button.refused", "#", class: "button refused" = link_to ".button.without-continuation", "#", class: "button without-continuation" - %p + .patron-section = link_to ".button.small", "#", class: "button small" = link_to ".button.small.primary", "#", class: "button small primary" - %p + .patron-section = link_to ".button.large", "#", class: "button large" = link_to ".button.large.primary", "#", class: "button large primary" - %p + .patron-section = link_to ".button.primary.expand", "#", class: "button primary expand" %h1 Labels @@ -111,17 +111,17 @@ .card .card-title Titre de la carte - Et voici le contenu de la carte + %p Et voici le contenu de la carte .card.featured .card-title Titre de la carte mise en avant - Et voici le contenu de la carte + %p Et voici le contenu de la carte .card.feedback .card-title Titre de la carte pour demander un avis - Utilisez cette carte pour informer d’une nouveauté produit ou demander l’avis des utilisateurs. + %p Utilisez cette carte pour informer d’une nouveauté produit ou demander l’avis des utilisateurs. %h1 Table From d384b6b07fc1dbace80f69559eb685037081fd7e Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Thu, 21 Feb 2019 16:23:03 +0100 Subject: [PATCH 20/29] card: add spacing to paragraphs --- app/assets/stylesheets/new_design/card.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/assets/stylesheets/new_design/card.scss b/app/assets/stylesheets/new_design/card.scss index 61128cb72..c745f88a0 100644 --- a/app/assets/stylesheets/new_design/card.scss +++ b/app/assets/stylesheets/new_design/card.scss @@ -33,4 +33,8 @@ margin-bottom: $default-spacer; } } + + p:not(:last-of-type) { + margin-bottom: $default-spacer; + } } From 93a0edcce00deafd1c0f59c33f5dc8d34cc5c21d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chai=CC=88b=20Martinez?= Date: Tue, 12 Feb 2019 16:59:37 +0100 Subject: [PATCH 21/29] =?UTF-8?q?Il=20y=20avait=20une=20issue=20cr=C3=A9e,?= =?UTF-8?q?=20je=20push=20sur=20une=20nouvelle=20branche?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/support_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/support_controller.rb b/app/controllers/support_controller.rb index d69bb5444..b907e20a5 100644 --- a/app/controllers/support_controller.rb +++ b/app/controllers/support_controller.rb @@ -53,7 +53,7 @@ class SupportController < ApplicationController phone: params[:phone], text: params[:text], file: params[:file], - dossier_id: params[:dossier_id], + dossier_id: dossier&.id, browser: browser_name, tags: tags ).send_form From 9edc7ab2be827e959e36ea8b0ed84c6e7a331cde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chai=CC=88b=20Martinez?= Date: Tue, 12 Feb 2019 18:52:19 +0100 Subject: [PATCH 22/29] Minor css changes --- app/assets/stylesheets/new_design/stats.scss | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/assets/stylesheets/new_design/stats.scss b/app/assets/stylesheets/new_design/stats.scss index 9eb1e5d2d..6794a6b04 100644 --- a/app/assets/stylesheets/new_design/stats.scss +++ b/app/assets/stylesheets/new_design/stats.scss @@ -155,3 +155,11 @@ $big-number-card-padding: 2 * $segmented-control-item-border-radius; text-align: center; color: $blue; } + +.hide { + display:none; +} + +.show{ + display: block; +} \ No newline at end of file From 7124965ba8e68268f61b3126164b58710aa7f999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chai=CC=88b=20Martinez?= Date: Tue, 12 Feb 2019 18:52:55 +0100 Subject: [PATCH 23/29] Add JS script --- app/views/support/index.html.haml | 63 ++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 2 deletions(-) diff --git a/app/views/support/index.html.haml b/app/views/support/index.html.haml index ac566f292..1f8bbbacb 100644 --- a/app/views/support/index.html.haml +++ b/app/views/support/index.html.haml @@ -6,7 +6,7 @@ .description Contactez-nous via ce formulaire et nous vous répondrons dans les plus brefs délais. - Pensez bien à nous donner le plus d'informations possible pour que nous puissions vous aider au mieux. + Pensez bien à nous donner le plus d'informations possible pour que nous puissions vous aider au mieux = form_tag contact_path, method: :post, multipart: true, class: 'form' do |f| - if !logged_in? @@ -20,7 +20,24 @@ = label_tag :type do Votre problème %span.mandatory * - = select_tag :type, options_for_select(@options, params[:type]) + = select_tag :type, options_for_select(@options, params[:type]),include_blank:"Choisir un problème", onchange:"show()" + + + #info_demarche.contact-champ.aidesupport.hide + Mon texte info_demarche + %br + %br + + #usager_perdu.contact-champ.aidesupport.hide + Mon texte usager_perdu + %br + %br + + #info_instruction.contact-champ.aidesupport.hide + Mon texte info_instruction + %br + %br + .contact-champ = label_tag :dossier_id, 'Numéro du dossier concerné' @@ -46,3 +63,45 @@ .send-wrapper = button_tag 'Envoyer le message', type: :submit, class: 'button send primary' + + :javascript + function show(){ + var e = document.getElementById ("type"); + var choix = e.options [e.selectedIndex] .value; + var divid = choix.replace(' ','_'); + var div_info_demarche = document.getElementById("info_demarche"); + var div_usager_perdu_ = document.getElementById("usager_perdu"); + var div_info_instruction = document.getElementById("info_instruction"); + + + console.log(divid); + switch (divid) { + case 'info_demarche': + console.log('info_demarche'); + document.getElementById("info_demarche").classList.add("show"); + + break; + + case 'usager_perdu': + console.log('usager_perdu'); + document.getElementById("usager_perdu").classList.add("show"); + + break; + + case 'info_instruction': + console.log('info_instruction'); + document.getElementById("info_instruction").classList.add("show"); + + break; + + default: + console.log('defaut'); + + } + + + + + + } + From e9c4ff41a76df1304d5fad36619696f46e719125 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chai=CC=88b=20Martinez?= Date: Thu, 14 Feb 2019 12:11:28 +0100 Subject: [PATCH 24/29] Minor changes --- app/views/support/index.html.haml | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/app/views/support/index.html.haml b/app/views/support/index.html.haml index 1f8bbbacb..a365aa29c 100644 --- a/app/views/support/index.html.haml +++ b/app/views/support/index.html.haml @@ -20,23 +20,10 @@ = label_tag :type do Votre problème %span.mandatory * - = select_tag :type, options_for_select(@options, params[:type]),include_blank:"Choisir un problème", onchange:"show()" + = select_tag :type, options_for_select(@options, params[:type]),include_blank:"Choisir un problème",onchange:"show()", required: true - #info_demarche.contact-champ.aidesupport.hide - Mon texte info_demarche - %br - %br - - #usager_perdu.contact-champ.aidesupport.hide - Mon texte usager_perdu - %br - %br - - #info_instruction.contact-champ.aidesupport.hide - Mon texte info_instruction - %br - %br + #aidesupport .contact-champ @@ -65,6 +52,7 @@ = button_tag 'Envoyer le message', type: :submit, class: 'button send primary' :javascript + function show(){ var e = document.getElementById ("type"); var choix = e.options [e.selectedIndex] .value; @@ -73,29 +61,26 @@ var div_usager_perdu_ = document.getElementById("usager_perdu"); var div_info_instruction = document.getElementById("info_instruction"); - - console.log(divid); switch (divid) { case 'info_demarche': console.log('info_demarche'); - document.getElementById("info_demarche").classList.add("show"); - + document.getElementById("aidesupport").innerHTML = "aaaaa"; break; case 'usager_perdu': console.log('usager_perdu'); - document.getElementById("usager_perdu").classList.add("show"); - + document.getElementById("aidesupport").innerHTML = "bbbbb"; break; case 'info_instruction': console.log('info_instruction'); - document.getElementById("info_instruction").classList.add("show"); + document.getElementById("aidesupport").innerHTML = "cccc"; break; default: console.log('defaut'); + document.getElementById("aidesupport").innerHTML = ""; } From 6f727f4cb167988bbfaca246375dc5af4ec7b992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chai=CC=88b=20Martinez?= Date: Fri, 15 Feb 2019 14:38:40 +0100 Subject: [PATCH 25/29] Add responses messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Chaïb Martinez --- app/assets/stylesheets/new_design/stats.scss | 8 -------- app/views/support/index.html.haml | 8 ++++---- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/app/assets/stylesheets/new_design/stats.scss b/app/assets/stylesheets/new_design/stats.scss index 6794a6b04..2b69e7138 100644 --- a/app/assets/stylesheets/new_design/stats.scss +++ b/app/assets/stylesheets/new_design/stats.scss @@ -154,12 +154,4 @@ $big-number-card-padding: 2 * $segmented-control-item-border-radius; display: block; text-align: center; color: $blue; -} - -.hide { - display:none; -} - -.show{ - display: block; } \ No newline at end of file diff --git a/app/views/support/index.html.haml b/app/views/support/index.html.haml index a365aa29c..526f84a74 100644 --- a/app/views/support/index.html.haml +++ b/app/views/support/index.html.haml @@ -23,7 +23,7 @@ = select_tag :type, options_for_select(@options, params[:type]),include_blank:"Choisir un problème",onchange:"show()", required: true - #aidesupport + #aidesupport.new-h2 .contact-champ @@ -64,17 +64,17 @@ switch (divid) { case 'info_demarche': console.log('info_demarche'); - document.getElementById("aidesupport").innerHTML = "aaaaa"; + document.getElementById("aidesupport").innerHTML = "👉 Notre réponse :
Avez-vous bien vérifié que votre navigateur était à jour et que tous les champs obligatoire (*) étaient remplis ?
Si vous avez des questions sur les informations à saisir, contactez les services en charge de la démarche

"; break; case 'usager_perdu': console.log('usager_perdu'); - document.getElementById("aidesupport").innerHTML = "bbbbb"; + document.getElementById("aidesupport").innerHTML = "👉 Notre réponse :
Nous vous invitons à contacter l’administration en charge de votre démarche pour qu’elle vous indique le lien à suivre. Celui-ci devrait ressembler à cela : https://www.demarches-simplifiees.fr/commencer/NOM_DE_LA_DEMARCHE .

Vous pouvez aussi consulter ici la liste de nos démarches les plus frequentes (permis, detr etc) : https://doc.demarches-simplifiees.fr/listes-des-demarches

"; break; case 'info_instruction': console.log('info_instruction'); - document.getElementById("aidesupport").innerHTML = "cccc"; + document.getElementById("aidesupport").innerHTML = "👉 Notre réponse :
Nous n’avons pas réponse à tout ! Nous nous occupons de la partie technique du site demarches-simplifiees.fr . Si vous avez des questions sur l’instruction de votre dossier, nous vous invitons à contacter directement les services qui instruisent votre dossier par votre messagerie

Pour cela, cliquez sur votre dossier dans votre tableau de bord puis sur l'onglet 'Messagerie'. Pour vous connecter cliquez-ici "; break; From 0a3d87f461fd987e636572f913574f8805a2b21e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chai=CC=88b=20Martinez?= Date: Fri, 15 Feb 2019 14:52:37 +0100 Subject: [PATCH 26/29] Texte change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Chaïb Martinez --- app/views/support/index.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/support/index.html.haml b/app/views/support/index.html.haml index 526f84a74..b23c56579 100644 --- a/app/views/support/index.html.haml +++ b/app/views/support/index.html.haml @@ -64,7 +64,7 @@ switch (divid) { case 'info_demarche': console.log('info_demarche'); - document.getElementById("aidesupport").innerHTML = "👉 Notre réponse :
Avez-vous bien vérifié que votre navigateur était à jour et que tous les champs obligatoire (*) étaient remplis ?
Si vous avez des questions sur les informations à saisir, contactez les services en charge de la démarche

"; + document.getElementById("aidesupport").innerHTML = "👉 Notre réponse :
Avez-vous bien vérifié que votre navigateur était à jour et que tous les champs obligatoire (*) étaient remplis ?
Si vous avez des questions sur les informations à saisir, contactez les services en charge de la démarche.
En savoir plus

"; break; case 'usager_perdu': @@ -74,7 +74,7 @@ case 'info_instruction': console.log('info_instruction'); - document.getElementById("aidesupport").innerHTML = "👉 Notre réponse :
Nous n’avons pas réponse à tout ! Nous nous occupons de la partie technique du site demarches-simplifiees.fr . Si vous avez des questions sur l’instruction de votre dossier, nous vous invitons à contacter directement les services qui instruisent votre dossier par votre messagerie

Pour cela, cliquez sur votre dossier dans votre tableau de bord puis sur l'onglet 'Messagerie'. Pour vous connecter cliquez-ici "; + document.getElementById("aidesupport").innerHTML = "👉 Notre réponse :
Nous n’avons pas réponse à tout ! Nous nous occupons de la partie technique du site demarches-simplifiees.fr . Si vous avez des questions sur l’instruction de votre dossier, nous vous invitons à contacter directement les services qui instruisent votre dossier par votre messagerie

En savoir plus "; break; From 62d7e328c9d9c95cfd8195e15078ca9ceefae85f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chai=CC=88b=20Martinez?= Date: Wed, 20 Feb 2019 17:25:55 +0100 Subject: [PATCH 27/29] New design MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Chaïb Martinez --- app/views/support/index.html.haml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/views/support/index.html.haml b/app/views/support/index.html.haml index b23c56579..152504e3b 100644 --- a/app/views/support/index.html.haml +++ b/app/views/support/index.html.haml @@ -23,8 +23,7 @@ = select_tag :type, options_for_select(@options, params[:type]),include_blank:"Choisir un problème",onchange:"show()", required: true - #aidesupport.new-h2 - + #aidesupport .contact-champ = label_tag :dossier_id, 'Numéro du dossier concerné' @@ -64,17 +63,17 @@ switch (divid) { case 'info_demarche': console.log('info_demarche'); - document.getElementById("aidesupport").innerHTML = "👉 Notre réponse :
Avez-vous bien vérifié que votre navigateur était à jour et que tous les champs obligatoire (*) étaient remplis ?
Si vous avez des questions sur les informations à saisir, contactez les services en charge de la démarche.
En savoir plus

"; + document.getElementById("aidesupport").innerHTML = ""; break; case 'usager_perdu': console.log('usager_perdu'); - document.getElementById("aidesupport").innerHTML = "👉 Notre réponse :
Nous vous invitons à contacter l’administration en charge de votre démarche pour qu’elle vous indique le lien à suivre. Celui-ci devrait ressembler à cela : https://www.demarches-simplifiees.fr/commencer/NOM_DE_LA_DEMARCHE .

Vous pouvez aussi consulter ici la liste de nos démarches les plus frequentes (permis, detr etc) : https://doc.demarches-simplifiees.fr/listes-des-demarches

"; + document.getElementById("aidesupport").innerHTML = ""; break; case 'info_instruction': console.log('info_instruction'); - document.getElementById("aidesupport").innerHTML = "👉 Notre réponse :
Nous n’avons pas réponse à tout ! Nous nous occupons de la partie technique du site demarches-simplifiees.fr . Si vous avez des questions sur l’instruction de votre dossier, nous vous invitons à contacter directement les services qui instruisent votre dossier par votre messagerie

En savoir plus "; + document.getElementById("aidesupport").innerHTML = ""; break; From 146e8ba2aa5593ec4b931d5fc936b6ea5f94d9b3 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Thu, 21 Feb 2019 17:50:18 +0100 Subject: [PATCH 28/29] Revrite with unobtrusive js --- app/assets/stylesheets/new_design/stats.scss | 2 +- app/javascript/new_design/support.js | 18 ++++++ app/javascript/packs/application.js | 5 +- app/views/support/index.html.haml | 67 ++++++++------------ 4 files changed, 47 insertions(+), 45 deletions(-) create mode 100644 app/javascript/new_design/support.js diff --git a/app/assets/stylesheets/new_design/stats.scss b/app/assets/stylesheets/new_design/stats.scss index 2b69e7138..9eb1e5d2d 100644 --- a/app/assets/stylesheets/new_design/stats.scss +++ b/app/assets/stylesheets/new_design/stats.scss @@ -154,4 +154,4 @@ $big-number-card-padding: 2 * $segmented-control-item-border-radius; display: block; text-align: center; color: $blue; -} \ No newline at end of file +} diff --git a/app/javascript/new_design/support.js b/app/javascript/new_design/support.js new file mode 100644 index 000000000..100b71240 --- /dev/null +++ b/app/javascript/new_design/support.js @@ -0,0 +1,18 @@ +import { show, hide, delegate } from '@utils'; + +delegate('change', '#contact-form #type', event => { + const type = event.target.value; + const answer = document.querySelector(`[data-answer="${type}"]`); + const card = document.querySelector('.support.card'); + + for (let element of document.querySelectorAll('.card-content')) { + hide(element); + } + + if (answer) { + show(card); + show(answer); + } else { + hide(card); + } +}); diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index 8bac1343f..75f75f5d0 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -14,11 +14,12 @@ import '../shared/remote-input'; import '../shared/franceconnect'; import '../shared/toggle-target'; -import '../new_design/spinner'; +import '../new_design/carto'; import '../new_design/dropdown'; import '../new_design/form-validation'; -import '../new_design/carto'; import '../new_design/select2'; +import '../new_design/spinner'; +import '../new_design/support'; import '../new_design/champs/carte'; import '../new_design/champs/linked-drop-down-list'; diff --git a/app/views/support/index.html.haml b/app/views/support/index.html.haml index 152504e3b..fb52b1d04 100644 --- a/app/views/support/index.html.haml +++ b/app/views/support/index.html.haml @@ -20,10 +20,33 @@ = label_tag :type do Votre problème %span.mandatory * - = select_tag :type, options_for_select(@options, params[:type]),include_blank:"Choisir un problème",onchange:"show()", required: true + = select_tag :type, options_for_select(@options, params[:type]), include_blank: "Choisir un problème", required: true + .support.card.featured.hidden + .card-title + 👉 Notre réponse + .card-content.hidden{ data: { answer: "info demarche" } } + %p Avez-vous bien vérifié que tous les champs obligatoires (*) sont bien remplis ? + %p Si vous avez des questions sur les informations à saisir, contactez les services en charge de la démarche. + %p + %a{ href: 'https://faq.demarches-simplifiees.fr/article/12-contacter-le-service-en-charge-de-ma-demarche' } + En savoir plus - #aidesupport + .card-content.hidden{ data: { answer: "usager perdu" } } + %p Nous vous invitons à contacter l’administration en charge de votre démarche pour qu’elle vous indique le lien à suivre. Celui-ci devrait ressembler à cela : https://www.demarches-simplifiees.fr/commencer/NOM_DE_LA_DEMARCHE . + %br + %p Vous pouvez aussi consulter ici la liste de nos démarches les plus frequentes (permis, detr etc) : + %p + %a{ href: 'https://doc.demarches-simplifiees.fr/listes-des-demarches' } + https://doc.demarches-simplifiees.fr/listes-des-demarches + + .card-content.hidden{ data: { answer: "info instruction" } } + %p Si vous avez des questions sur l’instruction de votre dossier (par exemple sur les délais), nous vous invitons à contacter directement les services qui instruisent votre dossier par votre messagerie + %p + %a{ href: 'https://faq.demarches-simplifiees.fr/article/11-je-veux-savoir-ou-en-est-linstruction-de-ma-demarche' } + En savoir plus + %br + %p Si vous souhaitez poser une question pour un problème technique sur le site, utilisez le formulaire ci-dessous. Nous ne pourrons pas vous renseigner sur l'instruction de votre dossier. .contact-champ = label_tag :dossier_id, 'Numéro du dossier concerné' @@ -49,43 +72,3 @@ .send-wrapper = button_tag 'Envoyer le message', type: :submit, class: 'button send primary' - - :javascript - - function show(){ - var e = document.getElementById ("type"); - var choix = e.options [e.selectedIndex] .value; - var divid = choix.replace(' ','_'); - var div_info_demarche = document.getElementById("info_demarche"); - var div_usager_perdu_ = document.getElementById("usager_perdu"); - var div_info_instruction = document.getElementById("info_instruction"); - - switch (divid) { - case 'info_demarche': - console.log('info_demarche'); - document.getElementById("aidesupport").innerHTML = ""; - break; - - case 'usager_perdu': - console.log('usager_perdu'); - document.getElementById("aidesupport").innerHTML = ""; - break; - - case 'info_instruction': - console.log('info_instruction'); - document.getElementById("aidesupport").innerHTML = ""; - - break; - - default: - console.log('defaut'); - document.getElementById("aidesupport").innerHTML = ""; - - } - - - - - - } - From 28fd9051d78db95e500218438d76d033f26bc1b8 Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Mon, 25 Feb 2019 12:01:47 +0100 Subject: [PATCH 29/29] Gem update bootstrap-sass (>= 3.4.1) --- Gemfile | 2 +- Gemfile.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 693759995..ab377aff5 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,7 @@ gem 'administrate' gem 'after_party' gem 'axlsx', '~> 3.0.0.pre' # https://github.com/randym/axlsx/issues/501#issuecomment-373640365 gem 'bcrypt' -gem 'bootstrap-sass', '~> 3.3.5' +gem 'bootstrap-sass', '>= 3.4.1' gem 'bootstrap-wysihtml5-rails', '~> 0.3.3.8' gem 'browser' gem 'carrierwave' diff --git a/Gemfile.lock b/Gemfile.lock index a04b2d384..b973dc7d7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -101,9 +101,9 @@ GEM axlsx (>= 2.0, < 4) bcrypt (3.1.12) bindata (2.4.4) - bootstrap-sass (3.3.7) + bootstrap-sass (3.4.1) autoprefixer-rails (>= 5.2.1) - sass (>= 3.3.4) + sassc (>= 2.0.0) bootstrap-wysihtml5-rails (0.3.3.8) railties (>= 3.0) brakeman (4.3.1) @@ -652,7 +652,7 @@ DEPENDENCIES after_party axlsx (~> 3.0.0.pre) bcrypt - bootstrap-sass (~> 3.3.5) + bootstrap-sass (>= 3.4.1) bootstrap-wysihtml5-rails (~> 0.3.3.8) brakeman browser