From b6e1526f892caa6a818071816449ff95b22bf502 Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Wed, 3 May 2017 18:48:27 +0200 Subject: [PATCH 01/43] Fix #239, (refresh is needed to load charts) --- app/views/stats/index.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/stats/index.html.haml b/app/views/stats/index.html.haml index 88e596ab4..b6c0fd893 100644 --- a/app/views/stats/index.html.haml +++ b/app/views/stats/index.html.haml @@ -1,4 +1,4 @@ -= javascript_include_tag 'https://code.highcharts.com/highcharts.js', 'chartkick' += javascript_include_tag 'https://code.highcharts.com/highcharts.js', 'chartkick', "data-turbolinks-track" => true .statistiques From 988947696e3ef24ca0dd653e37ae742f1775399e Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Tue, 2 May 2017 09:48:25 +0200 Subject: [PATCH 02/43] [Fix #161] Remove incorrect commas from Dossier#text_summary --- app/models/dossier.rb | 6 +++--- spec/controllers/users/dossiers_controller_spec.rb | 2 +- spec/models/dossier_spec.rb | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/models/dossier.rb b/app/models/dossier.rb index 17c7bf03e..ac11f9fc6 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -283,16 +283,16 @@ class Dossier < ActiveRecord::Base parts = [ "Dossier en brouillon répondant à la démarche ", procedure.libelle, - ", gérée par l'organisme ", + " gérée par l'organisme ", procedure.organisation ] else parts = [ "Dossier déposé le ", initiated_at.strftime("%d/%m/%Y"), - ", sur la démarche ", + " sur la démarche ", procedure.libelle, - ", gérée par l'organisme ", + " gérée par l'organisme ", procedure.organisation ] end diff --git a/spec/controllers/users/dossiers_controller_spec.rb b/spec/controllers/users/dossiers_controller_spec.rb index f479f6eb9..31188c207 100644 --- a/spec/controllers/users/dossiers_controller_spec.rb +++ b/spec/controllers/users/dossiers_controller_spec.rb @@ -563,7 +563,7 @@ describe Users::DossiersController, type: :controller do context 'when the dossier exist' do before { get :text_summary, params: { dossier_id: dossier.id } } it 'returns the procedure name' do - expect(JSON.parse(response.body)).to eq("textSummary" => "Dossier en brouillon répondant à la démarche #{procedure.libelle}, gérée par l'organisme #{procedure.organisation}") + expect(JSON.parse(response.body)).to eq("textSummary" => "Dossier en brouillon répondant à la démarche #{procedure.libelle} gérée par l'organisme #{procedure.organisation}") end end diff --git a/spec/models/dossier_spec.rb b/spec/models/dossier_spec.rb index 576949f7b..617071c24 100644 --- a/spec/models/dossier_spec.rb +++ b/spec/models/dossier_spec.rb @@ -817,7 +817,7 @@ describe Dossier do subject { dossier.text_summary } - it { is_expected.to eq("Dossier déposé le 31/12/2010, sur la démarche Démarche, gérée par l'organisme Organisation") } + it { is_expected.to eq("Dossier déposé le 31/12/2010 sur la démarche Démarche gérée par l'organisme Organisation") } end context 'when the dossier has not been initiated' do @@ -825,7 +825,7 @@ describe Dossier do subject { dossier.text_summary } - it { is_expected.to eq("Dossier en brouillon répondant à la démarche Démarche, gérée par l'organisme Organisation") } + it { is_expected.to eq("Dossier en brouillon répondant à la démarche Démarche gérée par l'organisme Organisation") } end end From 4ce6c9239472601ca49a69677575b8417609330f Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 26 Apr 2017 12:44:32 +0200 Subject: [PATCH 03/43] Reformat the _render_list_champs template test --- .../_render_list_champs.html.haml_spec.rb | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/spec/views/users/description/champs/_render_list_champs.html.haml_spec.rb b/spec/views/users/description/champs/_render_list_champs.html.haml_spec.rb index b5a74ed58..4e8982faf 100644 --- a/spec/views/users/description/champs/_render_list_champs.html.haml_spec.rb +++ b/spec/views/users/description/champs/_render_list_champs.html.haml_spec.rb @@ -1,27 +1,29 @@ describe 'users/description/champs/render_list_champs.html.haml', type: :view do let(:type_champ) { create(:type_de_champ_public, :checkbox) } - context "with a checkbox champ with value equals nil" do - let!(:champ_checkbox_checked) { create(:champ, type_de_champ: type_champ, value: nil) } + context "with a checkbox champ" do + context "whose value equals nil" do + let!(:champ_checkbox_checked) { create(:champ, type_de_champ: type_champ, value: nil) } - before do - render 'users/description/champs/render_list_champs.html.haml', champs: Champ.all, order_place: 0 + before do + render 'users/description/champs/render_list_champs.html.haml', champs: Champ.all, order_place: 0 + end + + it 'should not render a checked checkbox' do + expect(rendered).not_to have_css('input[type=checkbox][checked]') + end end - it 'should not render a checked checkbox' do - expect(rendered).not_to have_css('input[type=checkbox][checked]') - end - end + context "whose value equals 'on'" do + let!(:champ_checkbox_checked) { create(:champ, type_de_champ: type_champ, value: 'on') } - context "with a checkbox champ with value equals 'on'" do - let!(:champ_checkbox_checked) { create(:champ, type_de_champ: type_champ, value: 'on') } + before do + render 'users/description/champs/render_list_champs.html.haml', champs: Champ.all, order_place: 0 + end - before do - render 'users/description/champs/render_list_champs.html.haml', champs: Champ.all, order_place: 0 - end - - it 'should render a checked checkbox' do - expect(rendered).to have_css('input[type=checkbox][checked]') + it 'should render a checked checkbox' do + expect(rendered).to have_css('input[type=checkbox][checked]') + end end end From fd07a88ed6e359596b565495fe87f7e63e1d9987 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 26 Apr 2017 12:46:57 +0200 Subject: [PATCH 04/43] =?UTF-8?q?Add=20a=20missing=20test=20to=20the=20=5F?= =?UTF-8?q?render=5Flist=5Fchamps=20template=E2=80=99s=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../champs/_render_list_champs.html.haml_spec.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spec/views/users/description/champs/_render_list_champs.html.haml_spec.rb b/spec/views/users/description/champs/_render_list_champs.html.haml_spec.rb index 4e8982faf..233114a9b 100644 --- a/spec/views/users/description/champs/_render_list_champs.html.haml_spec.rb +++ b/spec/views/users/description/champs/_render_list_champs.html.haml_spec.rb @@ -1,6 +1,18 @@ describe 'users/description/champs/render_list_champs.html.haml', type: :view do let(:type_champ) { create(:type_de_champ_public, :checkbox) } + context "with any champ" do + let!(:champ) { create(:champ, type_de_champ: type_champ, value: nil) } + + before do + render 'users/description/champs/render_list_champs.html.haml', champs: Champ.all, order_place: 0 + end + + it "should render the champ's libelle" do + expect(rendered).to have_content(champ.libelle) + end + end + context "with a checkbox champ" do context "whose value equals nil" do let!(:champ_checkbox_checked) { create(:champ, type_de_champ: type_champ, value: nil) } From d3a84eb20a60f3c4a526675a6c35e1e321229d22 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 26 Apr 2017 15:08:15 +0200 Subject: [PATCH 05/43] =?UTF-8?q?D=C3=A9marche=20->=20Proc=C3=A9dure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- app/models/dossier.rb | 4 ++-- app/views/cgu/index.html.haml | 14 +++++++------- app/views/commencer/archived.html.haml | 2 +- app/views/root/landing.html.haml | 4 ++-- app/views/stats/index.html.haml | 4 ++-- config/locales/fr.yml | 2 +- spec/controllers/users/dossiers_controller_spec.rb | 2 +- spec/models/dossier_spec.rb | 6 +++--- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 2d9a96a0b..77efb29e2 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ## Context -TéléProcédure Simplifiée, ou TPS pour les intimes, est une plateforme 100 % web et 0 % email, conçue afin de répondre au besoin urgent de l'État d'appliquer la directive sur le 100 % démat' à l'horizon 2018 pour les démarches administratives. +TéléProcédure Simplifiée, ou TPS pour les intimes, est une plateforme 100 % web et 0 % email, conçue afin de répondre au besoin urgent de l'État d'appliquer la directive sur le 100 % démat' à l'horizon 2018 pour les procédures administratives. ## Dépendances diff --git a/app/models/dossier.rb b/app/models/dossier.rb index ac11f9fc6..ed875bceb 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -281,7 +281,7 @@ class Dossier < ActiveRecord::Base def text_summary if brouillon? parts = [ - "Dossier en brouillon répondant à la démarche ", + "Dossier en brouillon répondant à la procédure ", procedure.libelle, " gérée par l'organisme ", procedure.organisation @@ -290,7 +290,7 @@ class Dossier < ActiveRecord::Base parts = [ "Dossier déposé le ", initiated_at.strftime("%d/%m/%Y"), - " sur la démarche ", + " sur la procédure ", procedure.libelle, " gérée par l'organisme ", procedure.organisation diff --git a/app/views/cgu/index.html.haml b/app/views/cgu/index.html.haml index 779d6ff83..5f52fee6d 100644 --- a/app/views/cgu/index.html.haml +++ b/app/views/cgu/index.html.haml @@ -44,7 +44,7 @@ %a{ :href => "https://tps.apientreprise.fr/" } %strong tps.apientreprise.fr %p - Le site internet tps.apientreprise.fr a pour objet de faciliter la création de démarches administratives en ligne par les acteurs publics, et l’examen par plusieurs services des demandes formulées par les usagers auprès d’un ou organismes publics. + Le site internet tps.apientreprise.fr a pour objet de faciliter la création de procédures administratives en ligne par les acteurs publics, et l’examen par plusieurs services des demandes formulées par les usagers auprès d’un ou organismes publics. %br %h3#acteurs Acteurs de @@ -53,8 +53,8 @@ %p Les acteurs de TPS sont les suivants : %ul %li Le SGMAP qui héberge le service TPS, le maintien en condition opérationnelle et gère les droits d’accès - %li L’administrateur au sein d’une administration donnée qui crée la démarche en ligne - %li Le ou les accompagnateurs au sein d’une administration donnée, qui reçoivent les démarches des usagers, les accompagnent le cas échéant dans le bouclage de leurs dossier, instruisent la demande et décident des suites à donner aux demandes + %li L’administrateur au sein d’une administration donnée qui crée la procédure en ligne + %li Le ou les accompagnateurs au sein d’une administration donnée, qui reçoivent les dossiers des usagers, les accompagnent le cas échéant dans le bouclage de leurs dossier, instruisent la demande et décident des suites à donner aux demandes %li Les Usagers qui formulent les demandes en ligne via le formulaire qui leur est mis à disposition %br %h3#CNIL @@ -67,10 +67,10 @@ %a{ :href => "https://www.declaration.cnil.fr/declarations/declaration/donneesSensibles_DN.display.action" } Opinions philosophiques, politiques, religieuses, syndicales, vie sexuelle, données de santé, origine raciale. %br %h3#data_collects - Données collectées et responsabilité des organismes publics à l’initiative de démarches en ligne avec TPS. + Données collectées et responsabilité des organismes publics à l’initiative de procédures en ligne avec TPS. %p Les données collectées par le service sont définis par les services publics utilisateurs du service qui arrêtent, sous leur responsabilité, la liste des informations qui seront demandées à l’usager. - %p Les organismes publics s’engagent à créer des démarches pour collecter les informations strictement nécessaires à l’examen des demandes formulées auprès des acteurs publics, dans le cadre juridique prévu par chacune des démarches. - %p Ces données sont collectées et traitées par les seuls services concernés par l’examen des demandes, et précisées dans la notice d’utilisation de chaque démarche publiée par l’organisme public. + %p Les organismes publics s’engagent à créer des procédures pour collecter les informations strictement nécessaires à l’examen des demandes formulées auprès des acteurs publics, dans le cadre juridique prévu par chacune des procédures. + %p Ces données sont collectées et traitées par les seuls services concernés par l’examen des demandes, et précisées dans la notice d’utilisation de chaque procédure publiée par l’organisme public. %br %h3#individual_data @@ -117,7 +117,7 @@ %a{ :href => "https://www.infogreffe.fr/societes/cgu-cgv.html" } Conditions générales d’utilisation des données d’infogreffe %br - %h4 TPS fait appel à d’autres services opérés par le SGMAP afin de faciliter les démarches administratives : + %h4 TPS fait appel à d’autres services opérés par le SGMAP afin de faciliter les procédures administratives : %br %p %strong> France CONNECT diff --git a/app/views/commencer/archived.html.haml b/app/views/commencer/archived.html.haml index 84c72ab34..2cdf8c7f2 100644 --- a/app/views/commencer/archived.html.haml +++ b/app/views/commencer/archived.html.haml @@ -6,7 +6,7 @@ %h3 La campagne de création de nouveau dossier %br - pour cette démarche en ligne est maintenant terminée. + pour cette procédure en ligne est maintenant terminée. %br %p diff --git a/app/views/root/landing.html.haml b/app/views/root/landing.html.haml index f49b66bb7..561246170 100644 --- a/app/views/root/landing.html.haml +++ b/app/views/root/landing.html.haml @@ -5,7 +5,7 @@ %p.hero-tagline %em.hero-tagline-em Dématérialisez %br - vos démarches administratives en quelques minutes + vos procédures administratives en quelques minutes = link_to "Demander une démo", "mailto:#{t("dynamics.contact_email")}?subject=Demande de démo TPS", @@ -135,7 +135,7 @@ %p.cta-panel-phone-cta ou nous appeler au 01 40 15 68 49 .pull-left - %h1.cta-panel-title Commencez à dématerialiser vos démarches + %h1.cta-panel-title Commencez à dématerialiser vos procédures %p.cta-panel-explanation Nous vous accompagnons dans la prise en main de l’outil .clearfix diff --git a/app/views/stats/index.html.haml b/app/views/stats/index.html.haml index b6c0fd893..b2e297797 100644 --- a/app/views/stats/index.html.haml +++ b/app/views/stats/index.html.haml @@ -12,7 +12,7 @@ Cumul %li.segmented-control-item{ :onclick => "TPS.toggleChart(event, '.flux-procedures-chart');" } Flux (30 jours) - %span.stat-card-title.pull-left Démarches dématérialisées + %span.stat-card-title.pull-left Procédures dématérialisées .clearfix .chart-container @@ -41,7 +41,7 @@ :colors => ["rgba(61, 149, 236, 1)"] .card.stat-card.stat-card-half.big-number-card.pull-left - %span.big-number-card-title TOTAL DÉMARCHES DÉMATÉRIALISÉES + %span.big-number-card-title TOTAL PROCÉDURES DÉMATÉRIALISÉES %span.big-number-card-number = number_with_delimiter(@procedures_count) diff --git a/config/locales/fr.yml b/config/locales/fr.yml index d67a7166c..4dc1def44 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -187,7 +187,7 @@ fr: france_connect: connexion: "Erreur lors de la connexion à France Connect." extension_white_list_error: "Le format de fichier de la pièce jointe n'est pas valide." - procedure_archived: "Cette démarche en ligne a été fermée, il n'est plus possible de déposer de dossier." + procedure_archived: "Cette procédure en ligne a été fermée, il n'est plus possible de déposer de dossier." date: abbr_day_names: diff --git a/spec/controllers/users/dossiers_controller_spec.rb b/spec/controllers/users/dossiers_controller_spec.rb index 31188c207..458db571f 100644 --- a/spec/controllers/users/dossiers_controller_spec.rb +++ b/spec/controllers/users/dossiers_controller_spec.rb @@ -563,7 +563,7 @@ describe Users::DossiersController, type: :controller do context 'when the dossier exist' do before { get :text_summary, params: { dossier_id: dossier.id } } it 'returns the procedure name' do - expect(JSON.parse(response.body)).to eq("textSummary" => "Dossier en brouillon répondant à la démarche #{procedure.libelle} gérée par l'organisme #{procedure.organisation}") + expect(JSON.parse(response.body)).to eq("textSummary" => "Dossier en brouillon répondant à la procédure #{procedure.libelle} gérée par l'organisme #{procedure.organisation}") end end diff --git a/spec/models/dossier_spec.rb b/spec/models/dossier_spec.rb index 617071c24..9b4ed5d78 100644 --- a/spec/models/dossier_spec.rb +++ b/spec/models/dossier_spec.rb @@ -810,14 +810,14 @@ describe Dossier do end describe "#text_summary" do - let(:procedure) { create(:procedure, libelle: "Démarche", organisation: "Organisation") } + let(:procedure) { create(:procedure, libelle: "Procédure", organisation: "Organisation") } context 'when the dossier has been initiated' do let(:dossier) { create :dossier, procedure: procedure, state: 'initiated', initiated_at: "31/12/2010".to_date } subject { dossier.text_summary } - it { is_expected.to eq("Dossier déposé le 31/12/2010 sur la démarche Démarche gérée par l'organisme Organisation") } + it { is_expected.to eq("Dossier déposé le 31/12/2010 sur la procédure Procédure gérée par l'organisme Organisation") } end context 'when the dossier has not been initiated' do @@ -825,7 +825,7 @@ describe Dossier do subject { dossier.text_summary } - it { is_expected.to eq("Dossier en brouillon répondant à la démarche Démarche gérée par l'organisme Organisation") } + it { is_expected.to eq("Dossier en brouillon répondant à la procédure Procédure gérée par l'organisme Organisation") } end end From 4303dcef2ce6148bb7ac9bb39a1cc7a7cddc5d9f Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 26 Apr 2017 15:11:50 +0200 Subject: [PATCH 06/43] Organisation -> Organisme --- app/models/preference_list_dossier.rb | 2 +- app/views/admin/procedures/_informations.html.haml | 2 +- app/views/demo/_list.html.haml | 2 +- spec/models/dossier_spec.rb | 6 +++--- spec/models/preference_list_dossier_spec.rb | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/models/preference_list_dossier.rb b/app/models/preference_list_dossier.rb index 60ec5b82c..68c627b87 100644 --- a/app/models/preference_list_dossier.rb +++ b/app/models/preference_list_dossier.rb @@ -48,7 +48,7 @@ class PreferenceListDossier < ActiveRecord::Base { libelle: create_column('Libellé procédure', table, 'libelle', 'libelle', 4), - organisation: create_column('Organisation', table, 'organisation', 'organisation', 3), + organisation: create_column('Organisme', table, 'organisation', 'organisation', 3), direction: create_column('Direction', table, 'direction', 'direction', 3) } end diff --git a/app/views/admin/procedures/_informations.html.haml b/app/views/admin/procedures/_informations.html.haml index 553457b48..253ee6729 100644 --- a/app/views/admin/procedures/_informations.html.haml +++ b/app/views/admin/procedures/_informations.html.haml @@ -2,7 +2,7 @@ .alert.alert-info Cette procédure est publiée, certains éléments de la description ne sont plus modifiables -- { libelle: 'Libellé*', description: 'Description*', organisation: 'Organisation', direction: 'Direction', lien_site_web: 'Lien site internet', lien_notice: 'Lien notice' }.each do |key, value| +- { libelle: 'Libellé*', description: 'Description*', organisation: 'Organisme', direction: 'Direction', lien_site_web: 'Lien site internet', lien_notice: 'Lien notice' }.each do |key, value| .form-group %h4 = value diff --git a/app/views/demo/_list.html.haml b/app/views/demo/_list.html.haml index 60ea99bdc..b439c7884 100644 --- a/app/views/demo/_list.html.haml +++ b/app/views/demo/_list.html.haml @@ -7,7 +7,7 @@ %th= smart_listing.sortable 'ID', 'id' %th= smart_listing.sortable 'Titre', 'libelle' %th Description - %th= smart_listing.sortable 'Organisation', 'organisation' + %th= smart_listing.sortable 'Organisme', 'organisation' - smart_listing.collection.each do |procedure| - procedure = procedure.decorate diff --git a/spec/models/dossier_spec.rb b/spec/models/dossier_spec.rb index 9b4ed5d78..e964e4b0d 100644 --- a/spec/models/dossier_spec.rb +++ b/spec/models/dossier_spec.rb @@ -810,14 +810,14 @@ describe Dossier do end describe "#text_summary" do - let(:procedure) { create(:procedure, libelle: "Procédure", organisation: "Organisation") } + let(:procedure) { create(:procedure, libelle: "Procédure", organisation: "Organisme") } context 'when the dossier has been initiated' do let(:dossier) { create :dossier, procedure: procedure, state: 'initiated', initiated_at: "31/12/2010".to_date } subject { dossier.text_summary } - it { is_expected.to eq("Dossier déposé le 31/12/2010 sur la procédure Procédure gérée par l'organisme Organisation") } + it { is_expected.to eq("Dossier déposé le 31/12/2010 sur la procédure Procédure gérée par l'organisme Organisme") } end context 'when the dossier has not been initiated' do @@ -825,7 +825,7 @@ describe Dossier do subject { dossier.text_summary } - it { is_expected.to eq("Dossier en brouillon répondant à la procédure Procédure gérée par l'organisme Organisation") } + it { is_expected.to eq("Dossier en brouillon répondant à la procédure Procédure gérée par l'organisme Organisme") } end end diff --git a/spec/models/preference_list_dossier_spec.rb b/spec/models/preference_list_dossier_spec.rb index c54163e12..cba6265a3 100644 --- a/spec/models/preference_list_dossier_spec.rb +++ b/spec/models/preference_list_dossier_spec.rb @@ -92,7 +92,7 @@ describe PreferenceListDossier do describe 'organisation' do subject { super()[:organisation] } - it { expect(subject[:libelle]).to eq 'Organisation' } + it { expect(subject[:libelle]).to eq 'Organisme' } it { expect(subject[:table]).to eq 'procedure' } it { expect(subject[:attr]).to eq 'organisation' } it { expect(subject[:attr_decorate]).to eq 'organisation' } From 77dae0462b44e7bd644ecad770f42a420e2b0cb4 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 26 Apr 2017 15:13:50 +0200 Subject: [PATCH 07/43] Utilisateur -> Usager --- app/views/admin/procedures/show.html.haml | 2 +- app/views/dossiers/_infos_dossier.html.haml | 2 +- app/views/layouts/_switch_devise_profile_module.html.haml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/admin/procedures/show.html.haml b/app/views/admin/procedures/show.html.haml index 171eb5ace..71b0c3501 100644 --- a/app/views/admin/procedures/show.html.haml +++ b/app/views/admin/procedures/show.html.haml @@ -102,7 +102,7 @@ %div = @facade.dossiers_waiting_gestionnaire_total - %h4.text-info Attente Utilisateur + %h4.text-info Attente Usager %div = @facade.dossiers_waiting_user_total diff --git a/app/views/dossiers/_infos_dossier.html.haml b/app/views/dossiers/_infos_dossier.html.haml index 15a1aa744..959f82c78 100644 --- a/app/views/dossiers/_infos_dossier.html.haml +++ b/app/views/dossiers/_infos_dossier.html.haml @@ -127,7 +127,7 @@ %table.table %thead %th - Utilisateur + Usager %th Date d'envoi %th diff --git a/app/views/layouts/_switch_devise_profile_module.html.haml b/app/views/layouts/_switch_devise_profile_module.html.haml index 6b718ca0a..ab51a0053 100644 --- a/app/views/layouts/_switch_devise_profile_module.html.haml +++ b/app/views/layouts/_switch_devise_profile_module.html.haml @@ -9,7 +9,7 @@ = link_to(users_dossiers_path, id: :menu_item_procedure) do %i.fa.fa-user   - Utilisateur + Usager - if gestionnaire_signed_in? %li = link_to(backoffice_dossiers_path) do From 402f44c5fd94717df28c7a3a6fb8b6eb5450cc08 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 26 Apr 2017 15:15:38 +0200 Subject: [PATCH 08/43] =?UTF-8?q?Champs=20priv=C3=A9s=20->=20Annotations?= =?UTF-8?q?=20priv=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/facades/admin_types_de_champ_facades.rb | 2 +- app/views/admin/procedures/show.html.haml | 2 +- .../_left_panel_admin_procedurescontroller_navbar.html.haml | 4 ++-- ...t_panel_admin_typesdechampprivatecontroller_show.html.haml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/facades/admin_types_de_champ_facades.rb b/app/facades/admin_types_de_champ_facades.rb index d6488193d..a8f7fe578 100644 --- a/app/facades/admin_types_de_champ_facades.rb +++ b/app/facades/admin_types_de_champ_facades.rb @@ -11,7 +11,7 @@ class AdminTypesDeChampFacades end def active - @private ? 'Champs privés' : 'Champs' + @private ? 'Annotations privées' : 'Champs' end def url diff --git a/app/views/admin/procedures/show.html.haml b/app/views/admin/procedures/show.html.haml index 71b0c3501..cce49b7a2 100644 --- a/app/views/admin/procedures/show.html.haml +++ b/app/views/admin/procedures/show.html.haml @@ -73,7 +73,7 @@ .champs_private.col-xs-6.col-md-3 %h4.text-info - Champs privés + Annotations privées .badge.progress-bar-info = @facade.procedure.types_de_champ_private.size %ul diff --git a/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_navbar.html.haml b/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_navbar.html.haml index 3185ce653..0bb60d458 100644 --- a/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_navbar.html.haml +++ b/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_navbar.html.haml @@ -34,8 +34,8 @@ - unless @procedure.locked? %a#onglet-private-champs{ :href => "#{url_for admin_procedure_types_de_champ_private_path(@procedure)}" } - .procedure-list-element{ class: ('active' if active == 'Champs privés') } - Champs privés + .procedure-list-element{ class: ('active' if active == 'Annotations privées') } + Annotations privées %a#onglet-inemailsfos{ :href => "#{url_for admin_procedure_mail_templates_path(@procedure)}" } .procedure-list-element{ class: ('active' if active == 'E-mails') } diff --git a/app/views/layouts/left_panels/_left_panel_admin_typesdechampprivatecontroller_show.html.haml b/app/views/layouts/left_panels/_left_panel_admin_typesdechampprivatecontroller_show.html.haml index 7c678cf26..37ee65c0f 100644 --- a/app/views/layouts/left_panels/_left_panel_admin_typesdechampprivatecontroller_show.html.haml +++ b/app/views/layouts/left_panels/_left_panel_admin_typesdechampprivatecontroller_show.html.haml @@ -1 +1 @@ -= render partial: 'layouts/left_panels/left_panel_admin_procedurescontroller_navbar', locals: { active: "Champs privés" } += render partial: 'layouts/left_panels/left_panel_admin_procedurescontroller_navbar', locals: { active: "Annotations privées" } From 0384b5d0ae7e4342426c7d8c8b2f243257aa1a31 Mon Sep 17 00:00:00 2001 From: Simon Lehericey Date: Wed, 3 May 2017 14:21:17 +0200 Subject: [PATCH 09/43] Local: add french translation for gestionnaire too_short password --- config/locales/fr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/locales/fr.yml b/config/locales/fr.yml index d67a7166c..2686bdc9a 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -121,6 +121,7 @@ fr: blank: est vide password: blank: ': Le mot de passe est vide' + too_short: ': Le mot de passe est trop court' devise: confirmations: From 4d6a3653ed4cb8b91cfa712c3aabbce8d4fbc623 Mon Sep 17 00:00:00 2001 From: Simon Lehericey Date: Thu, 4 May 2017 11:26:08 +0200 Subject: [PATCH 10/43] Gitignore: add Procfile.dev to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 8d761de27..308ee4352 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ coverage/**/* .DS_Store .byebug_history .env +Procfile.dev From 53e54166270172155777297a3b0079dcc00a4c0c Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Thu, 4 May 2017 16:01:41 +0200 Subject: [PATCH 11/43] Remove an unused file --- .../dossiers/_state_description.html.haml | 37 ------------------- 1 file changed, 37 deletions(-) delete mode 100644 app/views/backoffice/dossiers/_state_description.html.haml diff --git a/app/views/backoffice/dossiers/_state_description.html.haml b/app/views/backoffice/dossiers/_state_description.html.haml deleted file mode 100644 index 345b3fecf..000000000 --- a/app/views/backoffice/dossiers/_state_description.html.haml +++ /dev/null @@ -1,37 +0,0 @@ -#state_description.row{ style: 'width: 50%; margin-left: auto; margin-right: auto;' } - .panel.panel-info - .panel-body.center - .row - .col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1 - .fa.fa-info-circle.text-info{ style: 'font-size: 2em; margin-top: 20%;' } - .col-xs-11 - - case dossiers_list_facade.liste - - when 'nouveaux' - Tous les dossiers présents dans cette liste sont ceux qui - %b - n'ont jamais été ouvert par votre service. - Il attende une première lecture et intervention de votre part. - - when 'a_traiter' - Tous les dossiers présents dans cette liste sont ceux qui sont - %b - en cours de construction avec l'usager. - Ils ne sont pas figés et ne sont donc pas complets. - - when 'fige' - Tous les dossiers présents dans cette liste ont été déclarés - %b - complets - et ne sont - %b - plus modifiables par l'usager. - Ils attendent donc leurs dépots officiels qui doit être effectué par l'usager. - - when 'deposes' - Tous les dossiers présents dans cette liste ont été - %b - officiellement déposé par l'usager pour examen. - Il faut donc que vous confirmiez par "accusé de réception" la bonne réception de toutes les informations et documents demandés avant examen final. - - when 'a_instruire' - Tous les dossiers présents dans cette liste sont à instruire. Ceux sont tous les dossiers - %b - qui ont reçu bonne réception. - - when 'termine' - Tous les dossiers présents dans cette liste sont considérés comme cloturé car ils ont tous reçu un verdict final qui peut être "Validé", "Refusé" ou "Sans suite". From 6e1818bb7936f49470ac4355e2c9f004e6442194 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Thu, 4 May 2017 12:25:08 +0200 Subject: [PATCH 12/43] Add missing dependencies to README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 77efb29e2..4a5df7605 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,11 @@ TéléProcédure Simplifiée, ou TPS pour les intimes, est une plateforme 100 % ### Tous environnements - postgresql +- redis + +### Développement + +- Mailcatcher : `gem install mailcatcher` ### Tests From 70f717547137bea236553c90ae3d29a1e2c09f7d Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Thu, 4 May 2017 12:25:26 +0200 Subject: [PATCH 13/43] Add a Launching section to README.md --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 4a5df7605..b7a7b7412 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,14 @@ Afin de générer la BDD de l'application, il est nécessaire d'éxécuter les c rake db:create db:schema:load db:migrate RAILS_ENV=test +## Lancement de l'application + + redis-server + sidekiq + mailcatcher -f + rails s + + ## Exécution des tests (RSpec) Pour exécuter les tests de l'application, plusieurs possibilités : From 1691ce1899a62f7b8cf9148186f1d6503ef5e959 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Thu, 4 May 2017 12:27:39 +0200 Subject: [PATCH 14/43] Add a missing lint command to README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b7a7b7412..eb1164f14 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,7 @@ Pour exécuter les tests de l'application, plusieurs possibilités : ## Linting - Linter les fichiers HAML : `bundle exec haml-lint app/views/` +- Linter les fichiers SCSS : `bundle exec scss-lint app/assets/stylesheets/` ## Régénérer les binstubs From f3343f593fe51394000f6e4f8ba3b40218d3c718 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Thu, 4 May 2017 16:07:45 +0200 Subject: [PATCH 15/43] Fix some spelling mistakes --- app/views/dossiers/etapes/etape_2/_individual.html.haml | 2 +- app/views/users/dossiers/_state_description.html.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/dossiers/etapes/etape_2/_individual.html.haml b/app/views/dossiers/etapes/etape_2/_individual.html.haml index ce87a50fc..d71aa8ea9 100644 --- a/app/views/dossiers/etapes/etape_2/_individual.html.haml +++ b/app/views/dossiers/etapes/etape_2/_individual.html.haml @@ -37,7 +37,7 @@ %label{ style: 'font-weight: normal;' } = f.check_box :autorisation_donnees = " ".html_safe - Vos informations personnelles ne seront jamais utilisées dans un but lucratif ou commercial. Elles ne pourront être communiquées à de tiers personnes sans votre accord préalable. Elles pourront en revanche être communiquées aux administrations compétentes afin d'instruire votre dossier, conformément à la déclaration CNIL effectué par le service TPS. + Vos informations personnelles ne seront jamais utilisées dans un but lucratif ou commercial. Elles ne pourront être communiquées à de tierces personnes sans votre accord préalable. Elles pourront en revanche être communiquées aux administrations compétentes afin d'instruire votre dossier, conformément à la déclaration CNIL effectuée par le service TPS. = link_to 'en savoir plus', cgu_path, target: '_blank' .row .col-xs-5.col-xs-5 diff --git a/app/views/users/dossiers/_state_description.html.haml b/app/views/users/dossiers/_state_description.html.haml index da1abe824..105ca1197 100644 --- a/app/views/users/dossiers/_state_description.html.haml +++ b/app/views/users/dossiers/_state_description.html.haml @@ -25,7 +25,7 @@ - when 'en_attente' Les dossiers présents dans cette liste sont %b - en cours de relecture par les services instructeurs. + en cours de relecture par le service instructeur. Il reviendra vers vous si des informations ou documents sont manquants pour le futur examen de votre dossier. - when 'valides' Les dossiers présents dans cette liste ont été From f389bbeb5376de054e69548a63907e430096c082 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 3 May 2017 11:34:42 +0200 Subject: [PATCH 16/43] Fix indentation in mail_template_concern.rb --- app/models/concerns/mail_template_concern.rb | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/models/concerns/mail_template_concern.rb b/app/models/concerns/mail_template_concern.rb index 0da40c322..05ee8483c 100644 --- a/app/models/concerns/mail_template_concern.rb +++ b/app/models/concerns/mail_template_concern.rb @@ -5,16 +5,16 @@ module MailTemplateConcern include ActionView::Helpers::UrlHelper TAGS = { - numero_dossier: { - description: "Permet d'afficher le numéro de dossier de l'utilisateur." - }, - lien_dossier: { - description: "Permet d'afficher un lien vers le dossier de l'utilisateur." - }, - libelle_procedure: { - description: "Permet d'afficher le libellé de la procédure." - } - } + numero_dossier: { + description: "Permet d'afficher le numéro de dossier de l'utilisateur." + }, + lien_dossier: { + description: "Permet d'afficher un lien vers le dossier de l'utilisateur." + }, + libelle_procedure: { + description: "Permet d'afficher le libellé de la procédure." + } + } def object_for_dossier dossier replace_tags(object, dossier) From 43ae28de8703126c74fb837be5d4be832e95b36c Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 3 May 2017 11:50:02 +0200 Subject: [PATCH 17/43] Make the email templates tags table occupy the whole width available It improves the content formatting (no more ugly line breaks splitting a tag on several lines) --- app/views/admin/mail_templates/edit.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/admin/mail_templates/edit.html.haml b/app/views/admin/mail_templates/edit.html.haml index 99e7e7c1a..9c33687bc 100644 --- a/app/views/admin/mail_templates/edit.html.haml +++ b/app/views/admin/mail_templates/edit.html.haml @@ -15,10 +15,10 @@ = f.button :submit, 'Mettre à jour', class: "btn-success" .row - .col-md-8 + .col-md-12 %table.table %tr - %th + %th.col-md-3 Balise %th Description From 30cf475485a671fc82b312c33309191f9df0572f Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 3 May 2017 11:58:34 +0200 Subject: [PATCH 18/43] Add missing brackets in mail_template_concern.rb --- app/models/concerns/mail_template_concern.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/concerns/mail_template_concern.rb b/app/models/concerns/mail_template_concern.rb index 05ee8483c..519ad346c 100644 --- a/app/models/concerns/mail_template_concern.rb +++ b/app/models/concerns/mail_template_concern.rb @@ -16,15 +16,15 @@ module MailTemplateConcern } } - def object_for_dossier dossier + def object_for_dossier(dossier) replace_tags(object, dossier) end - def body_for_dossier dossier + def body_for_dossier(dossier) replace_tags(body, dossier) end - def replace_tags string, dossier + def replace_tags(string, dossier) TAGS.inject(string) do |acc, tag| acc.gsub!("--#{tag.first}--", replace_tag(tag.first.to_sym, dossier)) || acc end @@ -43,7 +43,7 @@ module MailTemplateConcern private - def replace_tag tag, dossier + def replace_tag(tag, dossier) case tag when :numero_dossier dossier.id.to_s From 3bd5e32dffa0781903634be66d0b76eccaa39364 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 3 May 2017 11:46:41 +0200 Subject: [PATCH 19/43] Add a system to restrain the email templates tags to specific templates --- .../admin/mail_templates_controller.rb | 1 + app/models/concerns/mail_template_concern.rb | 31 +++++++++++++++++-- app/views/admin/mail_templates/edit.html.haml | 2 +- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/app/controllers/admin/mail_templates_controller.rb b/app/controllers/admin/mail_templates_controller.rb index 7c94d4a0f..5967c3dd5 100644 --- a/app/controllers/admin/mail_templates_controller.rb +++ b/app/controllers/admin/mail_templates_controller.rb @@ -7,6 +7,7 @@ class Admin::MailTemplatesController < AdminController def edit @mail_template = find_the_right_mail params[:id] + @mail_template_name = params[:id] end def update diff --git a/app/models/concerns/mail_template_concern.rb b/app/models/concerns/mail_template_concern.rb index 519ad346c..70879b6d8 100644 --- a/app/models/concerns/mail_template_concern.rb +++ b/app/models/concerns/mail_template_concern.rb @@ -6,16 +6,41 @@ module MailTemplateConcern TAGS = { numero_dossier: { - description: "Permet d'afficher le numéro de dossier de l'utilisateur." + description: "Permet d'afficher le numéro de dossier de l'utilisateur.", + templates: [ + "initiated_mail", + "received_mail", + "closed_mail", + "refused_mail", + "without_continuation_mail" + ] }, lien_dossier: { - description: "Permet d'afficher un lien vers le dossier de l'utilisateur." + description: "Permet d'afficher un lien vers le dossier de l'utilisateur.", + templates: [ + "initiated_mail", + "received_mail", + "closed_mail", + "refused_mail", + "without_continuation_mail" + ] }, libelle_procedure: { - description: "Permet d'afficher le libellé de la procédure." + description: "Permet d'afficher le libellé de la procédure.", + templates: [ + "initiated_mail", + "received_mail", + "closed_mail", + "refused_mail", + "without_continuation_mail" + ] } } + def self.tags_for_template(template) + TAGS.select { |key, value| value[:templates].include?(template) } + end + def object_for_dossier(dossier) replace_tags(object, dossier) end diff --git a/app/views/admin/mail_templates/edit.html.haml b/app/views/admin/mail_templates/edit.html.haml index 9c33687bc..a35c13334 100644 --- a/app/views/admin/mail_templates/edit.html.haml +++ b/app/views/admin/mail_templates/edit.html.haml @@ -22,7 +22,7 @@ Balise %th Description - - MailTemplateConcern::TAGS.each do |balise| + - MailTemplateConcern.tags_for_template(@mail_template_name).each do |balise| %tr %td.center = "--#{balise.first}--" From 2582b44f070dc7f5bbdb7abdb9bc9013e239ca69 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 3 May 2017 11:50:14 +0200 Subject: [PATCH 20/43] [Fix #204] Add the date_de_decision tag --- app/models/concerns/mail_template_concern.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/models/concerns/mail_template_concern.rb b/app/models/concerns/mail_template_concern.rb index 70879b6d8..f5a41a156 100644 --- a/app/models/concerns/mail_template_concern.rb +++ b/app/models/concerns/mail_template_concern.rb @@ -34,6 +34,14 @@ module MailTemplateConcern "refused_mail", "without_continuation_mail" ] + }, + date_de_decision: { + description: "Permet d'afficher la date à laquelle la décision finale (acceptation, refus, classement sans suite) sur le dossier a été prise.", + templates: [ + "closed_mail", + "refused_mail", + "without_continuation_mail" + ] } } @@ -76,6 +84,8 @@ module MailTemplateConcern link_to users_dossier_recapitulatif_url(dossier), users_dossier_recapitulatif_url(dossier), target: '_blank' when :libelle_procedure dossier.procedure.libelle + when :date_de_decision + dossier.processed_at.present? ? dossier.processed_at.strftime("%d/%m/%Y") : "" else '--BALISE_NON_RECONNUE--' end From 849ab5191a547c3088bfcbc23344dc484820ffad Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 3 May 2017 11:52:56 +0200 Subject: [PATCH 21/43] [Fix #204] Add the date_de_decision tag in relevant email templates --- app/views/mails/closed_mail.html.haml | 2 +- app/views/mails/refused_mail.html.haml | 2 +- app/views/mails/without_continuation_mail.html.haml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/mails/closed_mail.html.haml b/app/views/mails/closed_mail.html.haml index ac3153c9a..5870fc1cf 100644 --- a/app/views/mails/closed_mail.html.haml +++ b/app/views/mails/closed_mail.html.haml @@ -1,7 +1,7 @@ Bonjour %br %br -Votre dossier nº --numero_dossier-- a été accepté. +Votre dossier nº --numero_dossier-- a été accepté le --date_de_decision--. %br %br A tout moment, vous pouvez consulter le contenu de vos dossiers et les éventuels commentaires de l'administration à cette adresse : --lien_dossier-- diff --git a/app/views/mails/refused_mail.html.haml b/app/views/mails/refused_mail.html.haml index 900942f26..b2796bf3c 100644 --- a/app/views/mails/refused_mail.html.haml +++ b/app/views/mails/refused_mail.html.haml @@ -1,7 +1,7 @@ Bonjour %br %br -Votre dossier nº --numero_dossier-- a été refusé. +Votre dossier nº --numero_dossier-- a été refusé le --date_de_decision--. %br %br Pour en savoir plus sur le motif du refus, vous pouvez consulter le contenu de vos dossiers et les éventuels commentaires de l'administration à cette adresse : --lien_dossier-- diff --git a/app/views/mails/without_continuation_mail.html.haml b/app/views/mails/without_continuation_mail.html.haml index 03ab071cc..ddac75477 100644 --- a/app/views/mails/without_continuation_mail.html.haml +++ b/app/views/mails/without_continuation_mail.html.haml @@ -1,7 +1,7 @@ Bonjour %br %br -Votre dossier nº --numero_dossier-- a été classé sans suite. +Votre dossier nº --numero_dossier-- a été classé sans suite le --date_de_decision--. %br %br Pour en savoir plus sur les raisons de ce classement sans suite, vous pouvez consulter le contenu de vos dossiers et les éventuels commentaires de l'administration à cette adresse : --lien_dossier-- From 250c47e1458eee4a78c3dc54fa549c85d6923b05 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 3 May 2017 14:33:53 +0200 Subject: [PATCH 22/43] [Fix #126] Remove the now useless as_csv gem --- Gemfile | 1 - Gemfile.lock | 5 ----- 2 files changed, 6 deletions(-) diff --git a/Gemfile b/Gemfile index 945efbb3a..246e589dd 100644 --- a/Gemfile +++ b/Gemfile @@ -78,7 +78,6 @@ gem 'smart_listing' gem 'bootstrap-wysihtml5-rails', '~> 0.3.3.8' -gem 'as_csv' gem 'spreadsheet_architect' gem 'apipie-rails' diff --git a/Gemfile.lock b/Gemfile.lock index d2da50210..07225ea01 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -74,10 +74,6 @@ GEM apipie-rails (0.3.7) json arel (7.1.4) - as_csv (2.0.2) - actionpack (>= 3.0) - activemodel (>= 3.0) - responders ast (2.3.0) attr_required (1.0.1) autoprefixer-rails (6.5.4) @@ -669,7 +665,6 @@ DEPENDENCIES actioncable (= 5.0.0.1) active_model_serializers apipie-rails - as_csv bootstrap-datepicker-rails bootstrap-sass (~> 3.3.5) bootstrap-wysihtml5-rails (~> 0.3.3.8) From 9a0df71887460c6d62f881a591a9fca7ff37b95f Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Tue, 2 May 2017 15:32:39 +0200 Subject: [PATCH 23/43] Change the link to a linked dossier depending on the user profile --- app/decorators/champ_decorator.rb | 1 - app/decorators/dossier_decorator.rb | 12 ++++++++ app/views/dossiers/_infos_dossier.html.haml | 2 +- spec/decorators/dossier_decorator_spec.rb | 32 +++++++++++++++++++++ 4 files changed, 45 insertions(+), 2 deletions(-) diff --git a/app/decorators/champ_decorator.rb b/app/decorators/champ_decorator.rb index 8c95b8183..1688c5f91 100644 --- a/app/decorators/champ_decorator.rb +++ b/app/decorators/champ_decorator.rb @@ -10,5 +10,4 @@ class ChampDecorator < Draper::Decorator def description_with_links description.gsub(URI.regexp, '\0').html_safe if description end - end diff --git a/app/decorators/dossier_decorator.rb b/app/decorators/dossier_decorator.rb index 8bf76769b..438c67061 100644 --- a/app/decorators/dossier_decorator.rb +++ b/app/decorators/dossier_decorator.rb @@ -1,4 +1,6 @@ class DossierDecorator < Draper::Decorator + include Rails.application.routes.url_helpers + delegate :current_page, :per_page, :offset, :total_entries, :total_pages delegate_all @@ -14,6 +16,16 @@ class DossierDecorator < Draper::Decorator DossierDecorator.case_state_fr state end + def url(gestionnaire_signed_in) + if gestionnaire_signed_in + backoffice_dossier_path(id) + elsif brouillon? + users_dossier_description_path(id) + else + users_dossier_recapitulatif_path(id) + end + end + def self.case_state_fr state=self.state h.t("activerecord.attributes.dossier.state.#{state}") end diff --git a/app/views/dossiers/_infos_dossier.html.haml b/app/views/dossiers/_infos_dossier.html.haml index 959f82c78..7de372ba2 100644 --- a/app/views/dossiers/_infos_dossier.html.haml +++ b/app/views/dossiers/_infos_dossier.html.haml @@ -41,7 +41,7 @@ - if champ.type_champ == 'dossier_link' - dossier = Dossier.includes(:procedure).find_by(id: champ.decorate.value) - if dossier - = link_to("Dossier #{dossier.id}", backoffice_dossier_path(champ.decorate.value), target: '_blank') + = link_to("Dossier #{dossier.id}", dossier.decorate.url(gestionnaire_signed_in?), target: '_blank') %br = dossier.text_summary - else diff --git a/spec/decorators/dossier_decorator_spec.rb b/spec/decorators/dossier_decorator_spec.rb index 31a32b161..9920a89b4 100644 --- a/spec/decorators/dossier_decorator_spec.rb +++ b/spec/decorators/dossier_decorator_spec.rb @@ -57,4 +57,36 @@ describe DossierDecorator do expect(subject).to eq('Refusé') end end + + describe '#url' do + context "when a gestionnaire is signed_in" do + subject { super().url(true) } + + it { is_expected.to eq("/backoffice/dossiers/#{dossier.id}") } + end + + context "when a gestionnaire is not signed_in" do + context "when the dossier is in brouillon state" do + before do + dossier.state = 'draft' + dossier.save + end + + subject { super().url(false) } + + it { is_expected.to eq("/users/dossiers/#{dossier.id}/description") } + end + + context "when the dossier is not in brouillon state" do + before do + dossier.state = 'updated' + dossier.save + end + + subject { super().url(false) } + + it { is_expected.to eq("/users/dossiers/#{dossier.id}/recapitulatif") } + end + end + end end From 4591f2fdbeaf6ac08f7244007c9ece14a8cfdb17 Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Thu, 4 May 2017 18:07:55 +0200 Subject: [PATCH 24/43] =?UTF-8?q?T=C3=A9l=C3=A9Proc=C3=A9dure=20Simplifi?= =?UTF-8?q?=C3=A9e=20=3D>=20T=C3=A9l=C3=A9Proc=C3=A9dures=20Simplifi=C3=A9?= =?UTF-8?q?es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index eb1164f14..a2a31b699 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# TPS - TéléProcédure Simplifiée +# TPS - TéléProcédures Simplifiées ## Context From 6b25d25a9adc1c94f79d527238d836423eddb3f6 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Thu, 4 May 2017 18:19:13 +0200 Subject: [PATCH 25/43] =?UTF-8?q?The=20correct=20app=20name=20is=20?= =?UTF-8?q?=E2=80=9CT=C3=A9l=C3=A9proc=C3=A9dures=20Simplifi=C3=A9es?= =?UTF-8?q?=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- app/views/cgu/index.html.haml | 2 +- config/newrelic.yml | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a2a31b699..61d22b1c9 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# TPS - TéléProcédures Simplifiées +# TPS - Téléprocédures Simplifiées ## Context -TéléProcédure Simplifiée, ou TPS pour les intimes, est une plateforme 100 % web et 0 % email, conçue afin de répondre au besoin urgent de l'État d'appliquer la directive sur le 100 % démat' à l'horizon 2018 pour les procédures administratives. +Téléprocédures Simplifiées, ou TPS pour les intimes, est une plateforme 100 % web et 0 % email, conçue afin de répondre au besoin urgent de l'État d'appliquer la directive sur le 100 % démat' à l'horizon 2018 pour les procédures administratives. ## Dépendances diff --git a/app/views/cgu/index.html.haml b/app/views/cgu/index.html.haml index 5f52fee6d..9d537bc95 100644 --- a/app/views/cgu/index.html.haml +++ b/app/views/cgu/index.html.haml @@ -1,6 +1,6 @@ #cgu %h2 - Condition d’utilisation du service « TPS » pour téléprocédure simplifiée + Condition d’utilisation du service « TPS » pour téléprocédures simplifiées %br %h3#editeur Editeur diff --git a/config/newrelic.yml b/config/newrelic.yml index be46869da..865ea7e27 100644 --- a/config/newrelic.yml +++ b/config/newrelic.yml @@ -16,7 +16,7 @@ common: &default_settings # Your application name. Renaming here affects where data displays in New # Relic. For more details, see https://docs.newrelic.com/docs/apm/new-relic-apm/maintenance/renaming-applications - app_name: Téléprocédure Simplifiée + app_name: Téléprocédures Simplifiées # To disable the agent regardless of other settings, uncomment the following: # agent_enabled: false @@ -30,7 +30,7 @@ common: &default_settings # If your application has other named environments, configure them here. development: <<: *default_settings - app_name: Téléprocédure Simplifiée (Development) + app_name: Téléprocédures Simplifiées (Development) # NOTE: There is substantial overhead when running in developer mode. # Do not use for production or load testing. @@ -43,7 +43,7 @@ test: staging: <<: *default_settings - app_name: Téléprocédure Simplifiée (Staging) + app_name: Téléprocédures Simplifiées (Staging) production: <<: *default_settings From 38dcf5c74d2d76382aea0418fa44a9ac36b414d2 Mon Sep 17 00:00:00 2001 From: Simon Lehericey Date: Tue, 2 May 2017 18:47:46 +0200 Subject: [PATCH 26/43] Application.scss: replace require_tree by explicit import Change needed for futur new_application.scss and corresponding style --- app/assets/stylesheets/application.scss | 44 ++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index adf15f626..39db474b7 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -12,7 +12,49 @@ // defined in the other CSS/SCSS files in this directory. It is generally better to create a new // file per style scope. // -// = require_tree . +// = require _card +// = require _colors +// = require _constants +// = require _helpers +// = require _mixins +// = require _placeholders +// = require _turbolinks +// = require _typography +// = require admin_procedures_modal +// = require admin_type_de_champ +// = require backoffice +// = require carte +// = require cgu +// = require custom-mails +// = require default_data_block +// = require description +// = require dossier_show +// = require dossiers +// = require etapes +// = require fonts +// = require france_connect_particulier +// = require header +// = require landing +// = require left_panel +// = require login +// = require main_container +// = require navbar +// = require new_footer +// = require notification_alert +// = require pieces_justificatives_fields +// = require pj_modal +// = require pref_list_menu +// = require print +// = require procedure +// = require recapitulatif +// = require search +// = require siret +// = require stats +// = require support_navigator_banner +// = require switch_menu +// = require typeahead +// = require users + // = require_self // = require bootstrap-datepicker3 // = require leaflet From e7383c7c85a05c24d2deef3e0f900b90b2dd5f65 Mon Sep 17 00:00:00 2001 From: Simon Lehericey Date: Wed, 3 May 2017 16:48:23 +0200 Subject: [PATCH 27/43] CSS: add Meyer's reset.scss --- .scss-lint.yml | 2 ++ app/assets/stylesheets/reset.scss | 48 +++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 app/assets/stylesheets/reset.scss diff --git a/.scss-lint.yml b/.scss-lint.yml index 918c14c70..7ee185bb3 100644 --- a/.scss-lint.yml +++ b/.scss-lint.yml @@ -1,3 +1,5 @@ +exclude: 'app/assets/stylesheets/reset.scss' + linters: BangFormat: enabled: true diff --git a/app/assets/stylesheets/reset.scss b/app/assets/stylesheets/reset.scss new file mode 100644 index 000000000..e29c0f5f4 --- /dev/null +++ b/app/assets/stylesheets/reset.scss @@ -0,0 +1,48 @@ +/* http://meyerweb.com/eric/tools/css/reset/ + v2.0 | 20110126 + License: none (public domain) +*/ + +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td, +article, aside, canvas, details, embed, +figure, figcaption, footer, header, hgroup, +menu, nav, output, ruby, section, summary, +time, mark, audio, video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; +} +/* HTML5 display-role reset for older browsers */ +article, aside, details, figcaption, figure, +footer, header, hgroup, menu, nav, section { + display: block; +} +body { + line-height: 1; +} +ol, ul { + list-style: none; +} +blockquote, q { + quotes: none; +} +blockquote:before, blockquote:after, +q:before, q:after { + content: ''; + content: none; +} +table { + border-collapse: collapse; + border-spacing: 0; +} From aee17c5b193b87f6cecfd4e52dcfbd058c8e7973 Mon Sep 17 00:00:00 2001 From: Simon Lehericey Date: Thu, 4 May 2017 14:49:18 +0200 Subject: [PATCH 28/43] CSS: CSS filenames should not contain dashes --- app/assets/stylesheets/application.scss | 2 +- app/assets/stylesheets/{custom-mails.scss => custom_mails.scss} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename app/assets/stylesheets/{custom-mails.scss => custom_mails.scss} (100%) diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 39db474b7..dd8e19bbe 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -25,7 +25,7 @@ // = require backoffice // = require carte // = require cgu -// = require custom-mails +// = require custom_mails // = require default_data_block // = require description // = require dossier_show diff --git a/app/assets/stylesheets/custom-mails.scss b/app/assets/stylesheets/custom_mails.scss similarity index 100% rename from app/assets/stylesheets/custom-mails.scss rename to app/assets/stylesheets/custom_mails.scss From dc371b83b871f7c9c11aef22159e71e118b0ddcc Mon Sep 17 00:00:00 2001 From: Simon Lehericey Date: Wed, 3 May 2017 16:50:36 +0200 Subject: [PATCH 29/43] CSS: add new application layout + CSS Without bootstrap! --- app/assets/stylesheets/application.scss | 2 -- app/assets/stylesheets/common.scss | 7 +++++ app/assets/stylesheets/custom_reset.scss | 27 +++++++++++++++++++ app/assets/stylesheets/landing.scss | 2 -- app/assets/stylesheets/new_application.scss | 9 +++++++ app/assets/stylesheets/new_footer.scss | 3 +-- .../{header.scss => new_header.scss} | 4 --- app/assets/stylesheets/utils.scss | 11 ++++++++ app/views/layouts/new_application.html.haml | 2 +- config/initializers/assets.rb | 2 +- 10 files changed, 57 insertions(+), 12 deletions(-) create mode 100644 app/assets/stylesheets/common.scss create mode 100644 app/assets/stylesheets/custom_reset.scss create mode 100644 app/assets/stylesheets/new_application.scss rename app/assets/stylesheets/{header.scss => new_header.scss} (88%) create mode 100644 app/assets/stylesheets/utils.scss diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index dd8e19bbe..33338dbdb 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -33,13 +33,11 @@ // = require etapes // = require fonts // = require france_connect_particulier -// = require header // = require landing // = require left_panel // = require login // = require main_container // = require navbar -// = require new_footer // = require notification_alert // = require pieces_justificatives_fields // = require pj_modal diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss new file mode 100644 index 000000000..bbf87837b --- /dev/null +++ b/app/assets/stylesheets/common.scss @@ -0,0 +1,7 @@ +@import "typography"; + +body { + @extend %new-type; + font-size: 16px; + line-height: 1.42857143; +} diff --git a/app/assets/stylesheets/custom_reset.scss b/app/assets/stylesheets/custom_reset.scss new file mode 100644 index 000000000..009fd7c0d --- /dev/null +++ b/app/assets/stylesheets/custom_reset.scss @@ -0,0 +1,27 @@ +html, +body { + height: 100%; +} + +html { + box-sizing: border-box; +} + +*, +*::before, +*::after { + box-sizing: inherit; +} + +a { + text-decoration: none; +} + +// remove dotted outline on firefox +:focus { + outline: none; +} + +::-moz-focus-inner { + border: none; +} diff --git a/app/assets/stylesheets/landing.scss b/app/assets/stylesheets/landing.scss index bc8481080..e5f6b2251 100644 --- a/app/assets/stylesheets/landing.scss +++ b/app/assets/stylesheets/landing.scss @@ -2,10 +2,8 @@ @import "colors"; @import "mixins"; @import "placeholders"; -@import "typography"; .landing { - @extend %new-type; background-color: #FFFFFF; } diff --git a/app/assets/stylesheets/new_application.scss b/app/assets/stylesheets/new_application.scss new file mode 100644 index 000000000..839ecd613 --- /dev/null +++ b/app/assets/stylesheets/new_application.scss @@ -0,0 +1,9 @@ +// = require reset +// = require custom_reset +// = require common +// = require utils +// = require fonts +// = require new_header +// = require new_footer +// = require landing +// = require navbar diff --git a/app/assets/stylesheets/new_footer.scss b/app/assets/stylesheets/new_footer.scss index ffdaa9e6b..de93cd97d 100644 --- a/app/assets/stylesheets/new_footer.scss +++ b/app/assets/stylesheets/new_footer.scss @@ -1,10 +1,9 @@ +@import "colors"; @import "constants"; @import "mixins"; @import "placeholders"; -@import "typography"; .footer { - @extend %new-type; @include vertical-padding(72px); background-color: $light-grey; } diff --git a/app/assets/stylesheets/header.scss b/app/assets/stylesheets/new_header.scss similarity index 88% rename from app/assets/stylesheets/header.scss rename to app/assets/stylesheets/new_header.scss index fdc9e81c8..3213bb3c1 100644 --- a/app/assets/stylesheets/header.scss +++ b/app/assets/stylesheets/new_header.scss @@ -1,15 +1,11 @@ @import "constants"; @import "colors"; @import "mixins"; -@import "typography"; // FIXME: Rename when the header is generalized .new-header { - @extend %new-type; height: 72px; background-color: #FFFFFF; - // FIXME: Delete when the header is generalized - margin-top: -60px; } .header-inner-content { diff --git a/app/assets/stylesheets/utils.scss b/app/assets/stylesheets/utils.scss new file mode 100644 index 000000000..cb9f55abd --- /dev/null +++ b/app/assets/stylesheets/utils.scss @@ -0,0 +1,11 @@ +.pull-left { + float: left; +} + +.pull-right { + float: right; +} + +.clearfix { + clear: both; +} diff --git a/app/views/layouts/new_application.html.haml b/app/views/layouts/new_application.html.haml index 9908098f3..2c9204012 100644 --- a/app/views/layouts/new_application.html.haml +++ b/app/views/layouts/new_application.html.haml @@ -13,7 +13,7 @@ = favicon_link_tag(image_url("favicons/32x32.png"), type: "image/png", sizes: "32x32") = favicon_link_tag(image_url("favicons/96x96.png"), type: "image/png", sizes: "96x96") - = stylesheet_link_tag "application", :media => "all", "data-turbolinks-track" => true + = stylesheet_link_tag "new_application", :media => "all", "data-turbolinks-track" => true = stylesheet_link_tag "print", :media => "print", "data-turbolinks-track" => true %body diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 76333b2be..882590de7 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -8,4 +8,4 @@ Rails.application.config.assets.version = '1.0' # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. -Rails.application.config.assets.precompile += %w(print.css) +Rails.application.config.assets.precompile += %w(print.css new_application.css) From c7999b9691d4714b1467c5e612c78c275ad14d2f Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 26 Apr 2017 14:24:48 +0200 Subject: [PATCH 30/43] Add a date_attribute argument to StatsController#thirty_days_flow --- app/controllers/stats_controller.rb | 6 +-- spec/controllers/stats_controller_spec.rb | 51 +++++++++++++++++------ 2 files changed, 41 insertions(+), 16 deletions(-) diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb index 04a1f303c..cd29b1404 100644 --- a/app/controllers/stats_controller.rb +++ b/app/controllers/stats_controller.rb @@ -16,13 +16,13 @@ class StatsController < ApplicationController private - def thirty_days_flow_hash(association) + def thirty_days_flow_hash(association, date_attribute = :created_at) min_date = 30.days.ago.to_date max_date = Time.now.to_date thirty_days_flow_hash = association - .where(:created_at => min_date..max_date) - .group("date_trunc('day', created_at)") + .where(date_attribute => min_date..max_date) + .group("date_trunc('day', #{date_attribute.to_s})") .count clean_hash(thirty_days_flow_hash, min_date, max_date) diff --git a/spec/controllers/stats_controller_spec.rb b/spec/controllers/stats_controller_spec.rb index 58727e970..584a54cf4 100644 --- a/spec/controllers/stats_controller_spec.rb +++ b/spec/controllers/stats_controller_spec.rb @@ -2,26 +2,51 @@ require 'spec_helper' describe StatsController, type: :controller do describe '#thirty_days_flow_hash' do - before do - FactoryGirl.create(:procedure, :created_at => 45.days.ago) - FactoryGirl.create(:procedure, :created_at => 15.days.ago) - FactoryGirl.create(:procedure, :created_at => 1.day.ago) + context "without a date_attribut" do + before do + FactoryGirl.create(:procedure, :created_at => 45.days.ago) + FactoryGirl.create(:procedure, :created_at => 15.days.ago) + FactoryGirl.create(:procedure, :created_at => 1.day.ago) - @expected_hash = {} - (30.days.ago.to_date..Time.now.to_date).each do |day| - if [15.days.ago.to_date, 1.day.ago.to_date].include?(day) - @expected_hash[day] = 1 - else - @expected_hash[day] = 0 + @expected_hash = {} + (30.days.ago.to_date..Time.now.to_date).each do |day| + if [15.days.ago.to_date, 1.day.ago.to_date].include?(day) + @expected_hash[day] = 1 + else + @expected_hash[day] = 0 + end end end + + let (:association) { Procedure.all } + + subject { StatsController.new.send(:thirty_days_flow_hash, association) } + + it { expect(subject).to eq(@expected_hash) } end - let (:association) { Procedure.all } + context "with a date_attribut" do + before do + FactoryGirl.create(:procedure, :created_at => 45.days.ago, :updated_at => 50.days.ago) + FactoryGirl.create(:procedure, :created_at => 15.days.ago, :updated_at => 10.days.ago) + FactoryGirl.create(:procedure, :created_at => 1.day.ago, :updated_at => 3.days.ago) - subject { StatsController.new.send(:thirty_days_flow_hash, association) } + @expected_hash = {} + (30.days.ago.to_date..Time.now.to_date).each do |day| + if [10.days.ago.to_date, 3.day.ago.to_date].include?(day) + @expected_hash[day] = 1 + else + @expected_hash[day] = 0 + end + end + end - it { expect(subject).to eq(@expected_hash) } + let (:association) { Procedure.all } + + subject { StatsController.new.send(:thirty_days_flow_hash, association, :updated_at) } + + it { expect(subject).to eq(@expected_hash) } + end end describe '#cumulative_hash' do From dbf891b333fda03d08ffd900155743a7a5b139a9 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 26 Apr 2017 14:26:03 +0200 Subject: [PATCH 31/43] Use the initialisation date for the dossiers 30 days flow We want to show when dossiers were published, not created --- app/controllers/stats_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb index cd29b1404..b2e22e7cc 100644 --- a/app/controllers/stats_controller.rb +++ b/app/controllers/stats_controller.rb @@ -5,7 +5,7 @@ class StatsController < ApplicationController dossiers = Dossier.where.not(:state => :draft) @procedures_30_days_flow = thirty_days_flow_hash(procedures) - @dossiers_30_days_flow = thirty_days_flow_hash(dossiers) + @dossiers_30_days_flow = thirty_days_flow_hash(dossiers, :initiated_at) @procedures_cumulative = cumulative_hash(procedures) @dossiers_cumulative = cumulative_hash(dossiers) From 06714b5fc346870b0ae4286986cca119ea1e82cc Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 26 Apr 2017 14:28:39 +0200 Subject: [PATCH 32/43] Add a date_attribute argument to StatsController#cumulative_hash --- app/controllers/stats_controller.rb | 4 +-- spec/controllers/stats_controller_spec.rb | 31 ++++++++++++++++++----- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb index b2e22e7cc..293e6b46e 100644 --- a/app/controllers/stats_controller.rb +++ b/app/controllers/stats_controller.rb @@ -42,10 +42,10 @@ class StatsController < ApplicationController h end - def cumulative_hash(association) + def cumulative_hash(association, date_attribute = :created_at) sum = 0 association - .group("DATE_TRUNC('month', created_at)") + .group("DATE_TRUNC('month', #{date_attribute.to_s})") .count .to_a .sort{ |x, y| x[0] <=> y[0] } diff --git a/spec/controllers/stats_controller_spec.rb b/spec/controllers/stats_controller_spec.rb index 584a54cf4..6cbaf91bd 100644 --- a/spec/controllers/stats_controller_spec.rb +++ b/spec/controllers/stats_controller_spec.rb @@ -50,19 +50,38 @@ describe StatsController, type: :controller do end describe '#cumulative_hash' do + context "without a date attribute" do + before do + FactoryGirl.create(:procedure, :created_at => 45.days.ago) + FactoryGirl.create(:procedure, :created_at => 15.days.ago) + FactoryGirl.create(:procedure, :created_at => 15.days.ago) + end + + let (:association) { Procedure.all } + + subject { StatsController.new.send(:cumulative_hash, association) } + + it { expect(subject).to eq({ + 45.days.ago.beginning_of_month => 1, + 15.days.ago.beginning_of_month => 3 + }) } + end + end + + context "with a date attribute" do before do - FactoryGirl.create(:procedure, :created_at => 45.days.ago) - FactoryGirl.create(:procedure, :created_at => 15.days.ago) - FactoryGirl.create(:procedure, :created_at => 15.days.ago) + FactoryGirl.create(:procedure, :created_at => 45.days.ago, :updated_at => 20.days.ago) + FactoryGirl.create(:procedure, :created_at => 15.days.ago, :updated_at => 20.days.ago) + FactoryGirl.create(:procedure, :created_at => 15.days.ago, :updated_at => 10.days.ago) end let (:association) { Procedure.all } - subject { StatsController.new.send(:cumulative_hash, association) } + subject { StatsController.new.send(:cumulative_hash, association, :updated_at) } it { expect(subject).to eq({ - 45.days.ago.beginning_of_month => 1, - 15.days.ago.beginning_of_month => 3 + 20.days.ago.beginning_of_month => 2, + 10.days.ago.beginning_of_month => 3 }) } end end From 02a8cf3fe186fd51a4cb85fd82768a935cfb23f0 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 26 Apr 2017 14:29:22 +0200 Subject: [PATCH 33/43] Use the initialisation date for the cumulative dossiers We want to show when dossiers were published, not created --- app/controllers/stats_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb index 293e6b46e..66d1bf202 100644 --- a/app/controllers/stats_controller.rb +++ b/app/controllers/stats_controller.rb @@ -8,7 +8,7 @@ class StatsController < ApplicationController @dossiers_30_days_flow = thirty_days_flow_hash(dossiers, :initiated_at) @procedures_cumulative = cumulative_hash(procedures) - @dossiers_cumulative = cumulative_hash(dossiers) + @dossiers_cumulative = cumulative_hash(dossiers, :initiated_at) @procedures_count = procedures.count @dossiers_count = dossiers.count From 9d16c0365a7bdd109824163cd92a83695f78e0ae Mon Sep 17 00:00:00 2001 From: Simon Lehericey Date: Fri, 5 May 2017 14:08:36 +0200 Subject: [PATCH 34/43] Notification: remove useless notification system --- .../javascripts/channels/notifications.js | 23 ------------------- .../layouts/_notifications_alert.html.haml | 1 - app/views/layouts/application.html.haml | 1 - app/views/layouts/new_application.html.haml | 1 - 4 files changed, 26 deletions(-) delete mode 100644 app/assets/javascripts/channels/notifications.js delete mode 100644 app/views/layouts/_notifications_alert.html.haml diff --git a/app/assets/javascripts/channels/notifications.js b/app/assets/javascripts/channels/notifications.js deleted file mode 100644 index f1f2d519d..000000000 --- a/app/assets/javascripts/channels/notifications.js +++ /dev/null @@ -1,23 +0,0 @@ -//App.messages = App.cable.subscriptions.create('NotificationsChannel', { -// received: function (data) { -// if (window.location.href.indexOf('backoffice') !== -1) { -// $("#notification-alert").html(data['message']); -// -// slideIn_notification_alert(); -// } -// } -//}); - -function slideIn_notification_alert (){ - $("#notification-alert").animate({ - right: '20px' - }, 250); - - setTimeout(slideOut_notification_alert, 3500); -} - -function slideOut_notification_alert (){ - $("#notification-alert").animate({ - right: '-250px' - }, 200); -} diff --git a/app/views/layouts/_notifications_alert.html.haml b/app/views/layouts/_notifications_alert.html.haml deleted file mode 100644 index 99c4a4682..000000000 --- a/app/views/layouts/_notifications_alert.html.haml +++ /dev/null @@ -1 +0,0 @@ -#notification-alert.alert.alert-success diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index e6aeea5e5..d4278bc3d 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -54,7 +54,6 @@ %i.fa.fa-times{ style: 'position: fixed; top: 10; right: 30; color: white;' } = render partial: 'layouts/switch_devise_profile_module' - = render partial: 'layouts/notifications_alert' = render partial: 'layouts/footer', locals: { main_container_size: main_container_size } = render partial: 'layouts/google_analytics' diff --git a/app/views/layouts/new_application.html.haml b/app/views/layouts/new_application.html.haml index 2c9204012..5310f24cf 100644 --- a/app/views/layouts/new_application.html.haml +++ b/app/views/layouts/new_application.html.haml @@ -30,7 +30,6 @@ = yield = render :partial => "layouts/switch_devise_profile_module" - = render :partial => "layouts/notifications_alert" = render partial: "layouts/new_footer" = render partial: "layouts/google_analytics" From a26965f41b991d7a27ce1d497c6a583fc66e937d Mon Sep 17 00:00:00 2001 From: Simon Lehericey Date: Fri, 5 May 2017 14:37:59 +0200 Subject: [PATCH 35/43] Cable: remove useless js logic --- app/assets/javascripts/cable.js | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 app/assets/javascripts/cable.js diff --git a/app/assets/javascripts/cable.js b/app/assets/javascripts/cable.js deleted file mode 100644 index 32eb6c12f..000000000 --- a/app/assets/javascripts/cable.js +++ /dev/null @@ -1,13 +0,0 @@ -// Action Cable provides the framework to deal with WebSockets in Rails. -// You can generate new channels where WebSocket features live using the rails generate channel command. -// -//= require action_cable -//= require_self -//= require_tree ./channels - -//(function() { -// this.App || (this.App = {}); -// -// App.cable = ActionCable.createConsumer(); -// -//}).call(this); From 2668b036b460f596abd9c4670a42a3334ab7d8fd Mon Sep 17 00:00:00 2001 From: Simon Lehericey Date: Fri, 5 May 2017 14:59:00 +0200 Subject: [PATCH 36/43] Css: add center class in new style --- app/assets/stylesheets/utils.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/assets/stylesheets/utils.scss b/app/assets/stylesheets/utils.scss index cb9f55abd..04a4559bf 100644 --- a/app/assets/stylesheets/utils.scss +++ b/app/assets/stylesheets/utils.scss @@ -9,3 +9,7 @@ .clearfix { clear: both; } + +.center { + text-align: center; +} From bf68814f7a97e6819fdaf9ba66e9a403637a9dd6 Mon Sep 17 00:00:00 2001 From: Simon Lehericey Date: Fri, 5 May 2017 14:55:05 +0200 Subject: [PATCH 37/43] Css: add alert css to new style --- app/assets/stylesheets/_colors.scss | 3 +++ app/assets/stylesheets/new_alert.scss | 10 ++++++++++ app/assets/stylesheets/new_application.scss | 1 + 3 files changed, 14 insertions(+) create mode 100644 app/assets/stylesheets/new_alert.scss diff --git a/app/assets/stylesheets/_colors.scss b/app/assets/stylesheets/_colors.scss index 0d72dde62..c53a09506 100644 --- a/app/assets/stylesheets/_colors.scss +++ b/app/assets/stylesheets/_colors.scss @@ -3,3 +3,6 @@ $light-blue: rgba(61, 149, 236, 0.8); $black: #333333; $grey: #999999; $light-grey: #F8F8F8; +$dark-red: #A94442; +$ligt-red: #EBCCD1; +$lighter-red: #F2DEDE; diff --git a/app/assets/stylesheets/new_alert.scss b/app/assets/stylesheets/new_alert.scss new file mode 100644 index 000000000..bf176c628 --- /dev/null +++ b/app/assets/stylesheets/new_alert.scss @@ -0,0 +1,10 @@ +.alert { + padding: 15px; + border: 1px solid transparent; +} + +.alert-danger { + background-color: $lighter-red; + border-color: $light-red; + color: $dark-red; +} diff --git a/app/assets/stylesheets/new_application.scss b/app/assets/stylesheets/new_application.scss index 839ecd613..db2e8c65c 100644 --- a/app/assets/stylesheets/new_application.scss +++ b/app/assets/stylesheets/new_application.scss @@ -3,6 +3,7 @@ // = require common // = require utils // = require fonts +// = require new_alert // = require new_header // = require new_footer // = require landing From 029186fdf76fd2c41998774bf4e9ff3c64029861 Mon Sep 17 00:00:00 2001 From: Simon Lehericey Date: Tue, 9 May 2017 12:18:52 +0200 Subject: [PATCH 38/43] Css: fix color import --- app/assets/stylesheets/_colors.scss | 2 +- app/assets/stylesheets/new_alert.scss | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/_colors.scss b/app/assets/stylesheets/_colors.scss index c53a09506..8661f29b0 100644 --- a/app/assets/stylesheets/_colors.scss +++ b/app/assets/stylesheets/_colors.scss @@ -4,5 +4,5 @@ $black: #333333; $grey: #999999; $light-grey: #F8F8F8; $dark-red: #A94442; -$ligt-red: #EBCCD1; +$light-red: #EBCCD1; $lighter-red: #F2DEDE; diff --git a/app/assets/stylesheets/new_alert.scss b/app/assets/stylesheets/new_alert.scss index bf176c628..c57594c31 100644 --- a/app/assets/stylesheets/new_alert.scss +++ b/app/assets/stylesheets/new_alert.scss @@ -1,3 +1,5 @@ +@import "colors"; + .alert { padding: 15px; border: 1px solid transparent; From 9f1217c84372dc7da0df4ad88ca7e7a02587a327 Mon Sep 17 00:00:00 2001 From: Simon Lehericey Date: Fri, 5 May 2017 13:59:32 +0200 Subject: [PATCH 39/43] FlashMessage: center flash message otherwise the #flash_message.center is useless --- app/views/layouts/_flash_messages.html.haml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/views/layouts/_flash_messages.html.haml b/app/views/layouts/_flash_messages.html.haml index a661dcdbd..730c11fde 100644 --- a/app/views/layouts/_flash_messages.html.haml +++ b/app/views/layouts/_flash_messages.html.haml @@ -1,7 +1,8 @@ -#flash_message.center -- if flash.notice - .alert.alert-success - = flash.notice -- if flash.alert - .alert.alert-danger - = flash.alert.html_safe +- if flash.notice.present? || flash.alert.present? + #flash_message.center + - if flash.notice.present? + .alert.alert-success + = flash.notice + - if flash.alert.present? + .alert.alert-danger + = flash.alert.html_safe From 5d915ada8897f58ea0dd13c1362ea197abaa17cf Mon Sep 17 00:00:00 2001 From: Simon Lehericey Date: Fri, 5 May 2017 12:29:19 +0200 Subject: [PATCH 40/43] Css: add border on header and footer Remove headers border on homepage --- app/assets/stylesheets/_colors.scss | 1 + app/assets/stylesheets/new_footer.scss | 1 + app/assets/stylesheets/new_header.scss | 4 ++++ app/views/layouts/_new_header.haml | 2 +- 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/_colors.scss b/app/assets/stylesheets/_colors.scss index 8661f29b0..ab61a6c21 100644 --- a/app/assets/stylesheets/_colors.scss +++ b/app/assets/stylesheets/_colors.scss @@ -3,6 +3,7 @@ $light-blue: rgba(61, 149, 236, 0.8); $black: #333333; $grey: #999999; $light-grey: #F8F8F8; +$border-grey: #CCCCCC; $dark-red: #A94442; $light-red: #EBCCD1; $lighter-red: #F2DEDE; diff --git a/app/assets/stylesheets/new_footer.scss b/app/assets/stylesheets/new_footer.scss index de93cd97d..ccfab7146 100644 --- a/app/assets/stylesheets/new_footer.scss +++ b/app/assets/stylesheets/new_footer.scss @@ -6,6 +6,7 @@ .footer { @include vertical-padding(72px); background-color: $light-grey; + border-top: 1px solid $border-grey; } .footer-inner-content { diff --git a/app/assets/stylesheets/new_header.scss b/app/assets/stylesheets/new_header.scss index 3213bb3c1..a76bbf9a1 100644 --- a/app/assets/stylesheets/new_header.scss +++ b/app/assets/stylesheets/new_header.scss @@ -8,6 +8,10 @@ background-color: #FFFFFF; } +.new-header-with-border { + border-bottom: 1px solid $border-grey; +} + .header-inner-content { width: $page-width; margin: 0 auto; diff --git a/app/views/layouts/_new_header.haml b/app/views/layouts/_new_header.haml index 73f1946c6..82554fd60 100644 --- a/app/views/layouts/_new_header.haml +++ b/app/views/layouts/_new_header.haml @@ -1,4 +1,4 @@ -.new-header +.new-header{ class: current_page?(root_path) ? nil : 'new-header-with-border' } .header-inner-content %img.header-logo.pull-left{ src: image_url("header/logo-tps.svg") } From ecca3b3f372f7358b67bba9042af81b83a75ec2f Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Fri, 5 May 2017 12:36:33 +0200 Subject: [PATCH 41/43] Add a missing test for _pieces_justificatives.html.haml --- .../_pieces_justificatives.html.haml_spec.rb | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 spec/views/users/description/_pieces_justificatives.html.haml_spec.rb diff --git a/spec/views/users/description/_pieces_justificatives.html.haml_spec.rb b/spec/views/users/description/_pieces_justificatives.html.haml_spec.rb new file mode 100644 index 000000000..415f3acd6 --- /dev/null +++ b/spec/views/users/description/_pieces_justificatives.html.haml_spec.rb @@ -0,0 +1,30 @@ +require 'spec_helper' + +describe 'users/description/_pieces_justificatives.html.haml', type: :view do + let!(:procedure) { create(:procedure) } + let!(:tpj1) { create(:type_de_piece_justificative, + procedure: procedure, + libelle: "Première pièce jointe", + order_place: 1, + mandatory: true + )} + let!(:tpj2) { create(:type_de_piece_justificative, + procedure: procedure, + libelle: "Seconde pièce jointe", + order_place: 2, + lien_demarche: "https://www.google.fr" + )} + let!(:dossier) { create(:dossier, :procedure => procedure) } + + before do + render 'users/description/pieces_justificatives.html.haml', dossier: dossier + end + + it 'should render two PJ with their title, mandatory status and description' do + expect(rendered).to include("Première pièce jointe *") + expect(rendered).to include("Seconde pièce jointe") + expect(rendered.index("Première pièce jointe")).to be < rendered.index("Seconde pièce jointe") + + expect(rendered).to have_selector("input[type=file]", count: 2) + end +end From 1a5f9fd06778a3f91b0fa755c0f36bf0c421abd7 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Fri, 5 May 2017 12:37:11 +0200 Subject: [PATCH 42/43] =?UTF-8?q?[Fix=20#105]=20Show=20the=20pieces=20just?= =?UTF-8?q?ificative=E2=80=99=20descriptions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/stylesheets/description.scss | 8 ++++++++ .../users/description/_pieces_justificatives.html.haml | 2 ++ .../description/_pieces_justificatives.html.haml_spec.rb | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/app/assets/stylesheets/description.scss b/app/assets/stylesheets/description.scss index 6ad2f4339..3efa4d01b 100644 --- a/app/assets/stylesheets/description.scss +++ b/app/assets/stylesheets/description.scss @@ -138,3 +138,11 @@ width: 160px; } } + +.piece-description { + display: block; + margin-top: 5px; + margin-bottom: 10px; + color: #737373; + font-weight: normal; +} diff --git a/app/views/users/description/_pieces_justificatives.html.haml b/app/views/users/description/_pieces_justificatives.html.haml index d480fdbf8..75e7054e1 100644 --- a/app/views/users/description/_pieces_justificatives.html.haml +++ b/app/views/users/description/_pieces_justificatives.html.haml @@ -22,6 +22,8 @@ %tr %th.piece-libelle = tpj.mandatory ? tpj.libelle + ' *' : tpj.libelle + %br + .piece-description= tpj.description %td - unless tpj.lien_demarche.blank? diff --git a/spec/views/users/description/_pieces_justificatives.html.haml_spec.rb b/spec/views/users/description/_pieces_justificatives.html.haml_spec.rb index 415f3acd6..d0bcacd86 100644 --- a/spec/views/users/description/_pieces_justificatives.html.haml_spec.rb +++ b/spec/views/users/description/_pieces_justificatives.html.haml_spec.rb @@ -5,12 +5,14 @@ describe 'users/description/_pieces_justificatives.html.haml', type: :view do let!(:tpj1) { create(:type_de_piece_justificative, procedure: procedure, libelle: "Première pièce jointe", + description: "Première description", order_place: 1, mandatory: true )} let!(:tpj2) { create(:type_de_piece_justificative, procedure: procedure, libelle: "Seconde pièce jointe", + description: "Seconde description", order_place: 2, lien_demarche: "https://www.google.fr" )} @@ -25,6 +27,9 @@ describe 'users/description/_pieces_justificatives.html.haml', type: :view do expect(rendered).to include("Seconde pièce jointe") expect(rendered.index("Première pièce jointe")).to be < rendered.index("Seconde pièce jointe") + expect(rendered).to include("Première description") + expect(rendered).to include("Seconde description") + expect(rendered).to have_selector("input[type=file]", count: 2) end end From c6d0ea76bbddb90369db0abdf4db73c3a34b638a Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Fri, 5 May 2017 16:45:49 +0200 Subject: [PATCH 43/43] [Fix #174] Make .default-data-block header titles take the full width --- app/assets/stylesheets/default_data_block.scss | 8 ++++++-- .../users/description/champs/_header_section.html.haml | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/default_data_block.scss b/app/assets/stylesheets/default_data_block.scss index 1f37e839f..dbf7c0bd5 100644 --- a/app/assets/stylesheets/default_data_block.scss +++ b/app/assets/stylesheets/default_data_block.scss @@ -33,7 +33,7 @@ .header { background-color: #003C92; - height: 40px; + min-height: 40px; color: #FFFFFF; font-size: 18px; font-weight: bold; @@ -42,7 +42,6 @@ .title-no-expanse, .action, .count { - height: 100%; line-height: 40px; padding: 0px; text-transform: uppercase; @@ -58,6 +57,11 @@ cursor: pointer; } + .title-content { + width: calc(100% - 50px); + float: left; + } + .action { background-color: #E45B51; text-align: center; diff --git a/app/views/users/description/champs/_header_section.html.haml b/app/views/users/description/champs/_header_section.html.haml index b75094c2a..cafbe73ae 100644 --- a/app/views/users/description/champs/_header_section.html.haml +++ b/app/views/users/description/champs/_header_section.html.haml @@ -4,6 +4,8 @@ .col-xs-12.title .carret-right .carret-down - = libelle + .title-content + = libelle + .clearfix .body = render partial: 'users/description/champs/render_list_champs', locals: { champs: champs, order_place: order_place }