From 3dd2b7fd1d43e1d916ff8b31bafbbabad1834e0a Mon Sep 17 00:00:00 2001 From: Simon Lehericey Date: Fri, 17 Nov 2017 19:23:46 +0100 Subject: [PATCH 1/9] [fix #879] Yes_No: use standard order and display inline --- app/assets/stylesheets/new_design/forms.scss | 11 +++++++++++ .../dossiers/champs/_yes_no.html.haml | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/new_design/forms.scss b/app/assets/stylesheets/new_design/forms.scss index 759b8b643..d57bfbd32 100644 --- a/app/assets/stylesheets/new_design/forms.scss +++ b/app/assets/stylesheets/new_design/forms.scss @@ -23,6 +23,17 @@ } } + .radios { + label { + display: inline; + margin-left: $default-padding; + + &:first-child { + margin-left: 0; + } + } + } + input[type=text]:not([data-address='true']), input[type=email], input[type=password], diff --git a/app/views/new_gestionnaire/dossiers/champs/_yes_no.html.haml b/app/views/new_gestionnaire/dossiers/champs/_yes_no.html.haml index 9e9207f86..7893c60b8 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_yes_no.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_yes_no.html.haml @@ -1,6 +1,6 @@ = render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ } -%div +.radios %label = form.radio_button :value, true Oui From 68ea1ca1bdcb468623d6467b74227cca763348c7 Mon Sep 17 00:00:00 2001 From: Simon Lehericey Date: Fri, 17 Nov 2017 19:29:51 +0100 Subject: [PATCH 2/9] [fix #879] Civilite: display inline --- app/views/new_gestionnaire/dossiers/champs/_civilite.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/new_gestionnaire/dossiers/champs/_civilite.html.haml b/app/views/new_gestionnaire/dossiers/champs/_civilite.html.haml index 01952292d..b968388f6 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_civilite.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_civilite.html.haml @@ -1,6 +1,6 @@ = render partial: 'new_gestionnaire/dossiers/champs/champ_label', locals: { form: form, champ: champ } -%div +.radios %label = form.radio_button :value, 'M.' Monsieur From d5954c7423b74ed469eacde7ddd41c2ba749a7f7 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Tue, 21 Nov 2017 14:09:37 +0100 Subject: [PATCH 3/9] Show links to uploaded pieces justificatives in drafts --- app/views/users/description/_pieces_justificatives.html.haml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/views/users/description/_pieces_justificatives.html.haml b/app/views/users/description/_pieces_justificatives.html.haml index f69131005..dc07f9502 100644 --- a/app/views/users/description/_pieces_justificatives.html.haml +++ b/app/views/users/description/_pieces_justificatives.html.haml @@ -38,6 +38,9 @@ - if !dossier.was_piece_justificative_uploaded_for_type_id?(tpj.id) = file_field_tag "piece_justificative_#{tpj.id}", accept: PieceJustificative.accept_format, :max_file_size => 6.megabytes - else + - pj = dossier.retrieve_last_piece_justificative_by_type(tpj.id) + %a{ href: pj.content_url, target: '_blank' } + = pj.original_filename %span.btn.btn-sm.btn-file.btn-success Modifier = file_field_tag "piece_justificative_#{tpj.id}", accept: PieceJustificative.accept_format, :max_file_size => 6.megabytes From 496087ead9ddd1f7352d2ea57a905364a91c09a3 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Tue, 21 Nov 2017 16:36:26 +0100 Subject: [PATCH 4/9] Use CSS variables when possible --- app/assets/stylesheets/new_design/forms.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/stylesheets/new_design/forms.scss b/app/assets/stylesheets/new_design/forms.scss index d57bfbd32..b5f428c2e 100644 --- a/app/assets/stylesheets/new_design/forms.scss +++ b/app/assets/stylesheets/new_design/forms.scss @@ -164,7 +164,7 @@ } .header-section { - color: #4393F3; + color: $blue; font-weight: bold; font-size: 20px; margin-bottom: 2 * $default-padding; From a46aa83f00610200c691259ee240e73356729759 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Tue, 21 Nov 2017 16:14:34 +0100 Subject: [PATCH 5/9] Use a class instead of a tag as a tab link selector --- app/assets/stylesheets/new_design/new_header.scss | 2 +- app/views/layouts/_new_header.haml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/assets/stylesheets/new_design/new_header.scss b/app/assets/stylesheets/new_design/new_header.scss index 772bd4201..606d8f859 100644 --- a/app/assets/stylesheets/new_design/new_header.scss +++ b/app/assets/stylesheets/new_design/new_header.scss @@ -30,7 +30,7 @@ display: inline-block; } - a { + .tab-link { display: inline-block; height: 72px; line-height: 72px; diff --git a/app/views/layouts/_new_header.haml b/app/views/layouts/_new_header.haml index 27b381fa1..fa46c607d 100644 --- a/app/views/layouts/_new_header.haml +++ b/app/views/layouts/_new_header.haml @@ -11,16 +11,16 @@ %ul.header-tabs - if current_gestionnaire.procedures.count > 0 %li - = link_to "Procédures", procedures_path, class: (controller_name != 'avis') ? "active" : nil + = link_to "Procédures", procedures_path, class: (controller_name != 'avis') ? "tab-link active" : 'tab-link' - if current_gestionnaire.avis.count > 0 %li - = link_to avis_index_path, class: (controller_name == 'avis') ? "active" : nil do + = link_to avis_index_path, class: (controller_name == 'avis') ? "tab-link active" : 'tab-link' do Avis - avis_counter = current_gestionnaire.avis.without_answer.count - if avis_counter > 0 %span.badge.warning= avis_counter %li - = link_to "Ancienne interface", backoffice_dossiers_path + = link_to "Ancienne interface", backoffice_dossiers_path, class: 'tab-link' %ul.header-right-content - if gestionnaire_signed_in? From 481c38dee263b98f6c1e9b8fe27752e56762339d Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Tue, 21 Nov 2017 16:26:12 +0100 Subject: [PATCH 6/9] [Fix #896] Add a visible contact dialog for gestionnaires --- .../stylesheets/new_design/new_header.scss | 53 +++++++++++++++++++ app/views/layouts/_new_header.haml | 9 ++++ 2 files changed, 62 insertions(+) diff --git a/app/assets/stylesheets/new_design/new_header.scss b/app/assets/stylesheets/new_design/new_header.scss index 606d8f859..8ee3adb68 100644 --- a/app/assets/stylesheets/new_design/new_header.scss +++ b/app/assets/stylesheets/new_design/new_header.scss @@ -41,10 +41,63 @@ &:hover { color: $blue; border-bottom: 2px solid $blue; + + &.contact-link { + border-bottom: none; + + .contact-details { + display: block; + } + } } } } +.contact-details { + display: none; + position: absolute; + left: -165px; + background: #FFFFFF; + border: 2px solid $blue; + border-radius: 5px; + padding: 15px; + width: 400px; + color: $black; + z-index: 100; + font-size: initial; + line-height: 1.6; + + &::after, + &::before { + bottom: 100%; + left: 50%; + border: solid transparent; + content: " "; + height: 0; + width: 0; + position: absolute; + pointer-events: none; + } + + &::after { + border-color: rgba(255, 255, 255, 0); + border-bottom-color: #FFFFFF; + border-width: 15px; + margin-left: -15px; + } + + &::before { + border-color: rgba(255, 255, 255, 0); + border-bottom-color: $blue; + border-width: 18px; + margin-left: -18px; + } + + ul { + list-style-type: disc; + } +} + .header-right-content { display: flex; align-items: center; diff --git a/app/views/layouts/_new_header.haml b/app/views/layouts/_new_header.haml index fa46c607d..9f91cf01b 100644 --- a/app/views/layouts/_new_header.haml +++ b/app/views/layouts/_new_header.haml @@ -21,6 +21,15 @@ %span.badge.warning= avis_counter %li = link_to "Ancienne interface", backoffice_dossiers_path, class: 'tab-link' + %li + .tab-link.contact-link + Contact + .contact-details + Vous avez besoin d’aide ? Contactez-nous : + %br + – par téléphone : 09 72 62 57 12 + %br + – par email : contact@tps.apientreprise.fr %ul.header-right-content - if gestionnaire_signed_in? From a71574b8ddf364f668962d0c5843702901d60202 Mon Sep 17 00:00:00 2001 From: Simon Lehericey Date: Fri, 17 Nov 2017 23:40:51 +0100 Subject: [PATCH 7/9] [fix #445]: add title to pages --- app/models/dossier.rb | 8 +++++++ app/views/layouts/new_application.html.haml | 2 +- .../new_gestionnaire/avis/index.html.haml | 3 +++ .../avis/instruction.html.haml | 2 ++ .../avis/messagerie.html.haml | 2 ++ .../new_gestionnaire/avis/show.html.haml | 2 ++ .../dossiers/annotations_privees.html.haml | 2 ++ .../new_gestionnaire/dossiers/avis.html.haml | 2 ++ .../dossiers/messagerie.html.haml | 2 ++ .../new_gestionnaire/dossiers/show.html.haml | 2 ++ .../procedures/index.html.haml | 2 ++ .../procedures/show.html.haml | 2 ++ spec/models/dossier_spec.rb | 23 +++++++++++++++++++ 13 files changed, 53 insertions(+), 1 deletion(-) diff --git a/app/models/dossier.rb b/app/models/dossier.rb index e18d241a5..fbcdca8b8 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -355,6 +355,14 @@ class Dossier < ActiveRecord::Base sanitize_sql_for_order(order) end + def owner_name + if entreprise.present? + entreprise.raison_sociale + elsif individual.present? + "#{individual.nom} #{individual.prenom}" + end + end + private def build_attestation diff --git a/app/views/layouts/new_application.html.haml b/app/views/layouts/new_application.html.haml index 8dcd2b2d1..160fc4176 100644 --- a/app/views/layouts/new_application.html.haml +++ b/app/views/layouts/new_application.html.haml @@ -7,7 +7,7 @@ = csrf_meta_tags %title - = t("dynamics.page_title") + = content_for?(:title) ? yield(:title) : "TPS - Téléprocédures simplifiées" = favicon_link_tag(image_url("favicons/16x16.png"), type: "image/png", sizes: "16x16") = favicon_link_tag(image_url("favicons/32x32.png"), type: "image/png", sizes: "32x32") diff --git a/app/views/new_gestionnaire/avis/index.html.haml b/app/views/new_gestionnaire/avis/index.html.haml index 1a4baf261..b50a183e6 100644 --- a/app/views/new_gestionnaire/avis/index.html.haml +++ b/app/views/new_gestionnaire/avis/index.html.haml @@ -1,3 +1,6 @@ +- avis_statut = (@statut == NewGestionnaire::AvisController::A_DONNER_STATUS) ? 'à donner' : 'rendus' +- content_for(:title, "Avis #{avis_statut}") + #avis-index .backoffice-header .container.flex diff --git a/app/views/new_gestionnaire/avis/instruction.html.haml b/app/views/new_gestionnaire/avis/instruction.html.haml index 458fff4ee..8e2f74cf3 100644 --- a/app/views/new_gestionnaire/avis/instruction.html.haml +++ b/app/views/new_gestionnaire/avis/instruction.html.haml @@ -1,3 +1,5 @@ +- content_for(:title, "Avis · Dossier nº #{@dossier.id} (#{@dossier.owner_name})") + #avis-show = render partial: 'header', locals: { avis: @avis, dossier: @dossier } diff --git a/app/views/new_gestionnaire/avis/messagerie.html.haml b/app/views/new_gestionnaire/avis/messagerie.html.haml index d28507c15..56007bf23 100644 --- a/app/views/new_gestionnaire/avis/messagerie.html.haml +++ b/app/views/new_gestionnaire/avis/messagerie.html.haml @@ -1,3 +1,5 @@ +- content_for(:title, "Messagerie · Dossier nº #{@dossier.id} (#{@dossier.owner_name})") + = render partial: 'header', locals: { avis: @avis, dossier: @dossier } .messagerie.container diff --git a/app/views/new_gestionnaire/avis/show.html.haml b/app/views/new_gestionnaire/avis/show.html.haml index 4d422061e..b73e36c91 100644 --- a/app/views/new_gestionnaire/avis/show.html.haml +++ b/app/views/new_gestionnaire/avis/show.html.haml @@ -1,3 +1,5 @@ +- content_for(:title, "Demande · Dossier nº #{@dossier.id} (#{@dossier.owner_name})") + #avis-show = render partial: 'header', locals: { avis: @avis, dossier: @dossier } diff --git a/app/views/new_gestionnaire/dossiers/annotations_privees.html.haml b/app/views/new_gestionnaire/dossiers/annotations_privees.html.haml index 35ac93e5b..42193d67f 100644 --- a/app/views/new_gestionnaire/dossiers/annotations_privees.html.haml +++ b/app/views/new_gestionnaire/dossiers/annotations_privees.html.haml @@ -1,3 +1,5 @@ +- content_for(:title, "Annotations privées · Dossier nº #{@dossier.id} (#{@dossier.owner_name})") + = render partial: "header", locals: { dossier: @dossier } #dossier-annotations-privees.container diff --git a/app/views/new_gestionnaire/dossiers/avis.html.haml b/app/views/new_gestionnaire/dossiers/avis.html.haml index 1450cc677..35e446a19 100644 --- a/app/views/new_gestionnaire/dossiers/avis.html.haml +++ b/app/views/new_gestionnaire/dossiers/avis.html.haml @@ -1,3 +1,5 @@ +- content_for(:title, "Avis · Dossier nº #{@dossier.id} (#{@dossier.owner_name})") + = render partial: "header", locals: { dossier: @dossier } .container diff --git a/app/views/new_gestionnaire/dossiers/messagerie.html.haml b/app/views/new_gestionnaire/dossiers/messagerie.html.haml index a72bc4057..09e456ed3 100644 --- a/app/views/new_gestionnaire/dossiers/messagerie.html.haml +++ b/app/views/new_gestionnaire/dossiers/messagerie.html.haml @@ -1,3 +1,5 @@ +- content_for(:title, "Messagerie · Dossier nº #{@dossier.id} (#{@dossier.owner_name})") + = render partial: "header", locals: { dossier: @dossier } .messagerie.container diff --git a/app/views/new_gestionnaire/dossiers/show.html.haml b/app/views/new_gestionnaire/dossiers/show.html.haml index 941566961..461844118 100644 --- a/app/views/new_gestionnaire/dossiers/show.html.haml +++ b/app/views/new_gestionnaire/dossiers/show.html.haml @@ -1,3 +1,5 @@ +- content_for(:title, "Demande · Dossier nº #{@dossier.id} (#{@dossier.owner_name})") + = render partial: "header", locals: { dossier: @dossier } .container diff --git a/app/views/new_gestionnaire/procedures/index.html.haml b/app/views/new_gestionnaire/procedures/index.html.haml index 224ceb5a3..4cb2b7a51 100644 --- a/app/views/new_gestionnaire/procedures/index.html.haml +++ b/app/views/new_gestionnaire/procedures/index.html.haml @@ -1,3 +1,5 @@ +- content_for(:title, "Procédures") + .container %h1.backoffice-title Procédures diff --git a/app/views/new_gestionnaire/procedures/show.html.haml b/app/views/new_gestionnaire/procedures/show.html.haml index 66cf44902..7ab45f49c 100644 --- a/app/views/new_gestionnaire/procedures/show.html.haml +++ b/app/views/new_gestionnaire/procedures/show.html.haml @@ -1,3 +1,5 @@ +- content_for(:title, "#{@procedure.libelle}") + #procedure-show .backoffice-header .container.flex diff --git a/spec/models/dossier_spec.rb b/spec/models/dossier_spec.rb index cb539d28d..87386c3d5 100644 --- a/spec/models/dossier_spec.rb +++ b/spec/models/dossier_spec.rb @@ -944,4 +944,27 @@ describe Dossier do after { Timecop.return } end + + describe '#owner_name' do + let!(:procedure) { create(:procedure) } + subject { dossier.owner_name } + + context 'when there is no entreprise or individual' do + let(:dossier) { create(:dossier, individual: nil, entreprise: nil, procedure: procedure) } + + it { is_expected.to be_nil } + end + + context 'when there is entreprise' do + let(:dossier) { create(:dossier, :with_entreprise, procedure: procedure) } + + it { is_expected.to eq(dossier.entreprise.raison_sociale) } + end + + context 'when there is an individual' do + let(:dossier) { create(:dossier, :for_individual, procedure: procedure) } + + it { is_expected.to eq("#{dossier.individual.nom} #{dossier.individual.prenom}") } + end + end end From b4b394bf18628db3210789be355f6c8ef080f039 Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Tue, 21 Nov 2017 10:10:19 +0100 Subject: [PATCH 8/9] If user_return_to procedure is invalid then remove it from session --- app/controllers/users/sessions_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb index 63f8212e1..b0c4743de 100644 --- a/app/controllers/users/sessions_controller.rb +++ b/app/controllers/users/sessions_controller.rb @@ -69,6 +69,7 @@ class Users::SessionsController < Sessions::SessionsController private def error_procedure + session["user_return_to"] = nil flash.alert = t('errors.messages.procedure_not_found') redirect_to url_for root_path end From 303e5285e9346aafe67608c05a5ba0c8eb6f5255 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Tue, 21 Nov 2017 17:20:52 +0100 Subject: [PATCH 9/9] =?UTF-8?q?[Fix=20#962]=20In=20new=20UI,=20add=20link?= =?UTF-8?q?=20on=20=E2=80=9Cdossier=5Flink=E2=80=9D=20field=20values?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../new_gestionnaire/dossiers/_champs.html.haml | 11 +++++++++++ spec/factories/champ.rb | 4 ++++ .../dossiers/_champs.html.haml_spec.rb | 16 ++++++++++++++-- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/app/views/new_gestionnaire/dossiers/_champs.html.haml b/app/views/new_gestionnaire/dossiers/_champs.html.haml index 6416ca832..7d7129330 100644 --- a/app/views/new_gestionnaire/dossiers/_champs.html.haml +++ b/app/views/new_gestionnaire/dossiers/_champs.html.haml @@ -15,6 +15,17 @@ - c.value.split(", ").each do |item| %li = item + - when "dossier_link" + %th.libelle + = "#{c.libelle} :" + %td.rich-text + - dossier = Dossier.includes(:procedure).find_by(id: c.value) + - if dossier + = link_to("Dossier nº #{dossier.id}", dossier_path(dossier.procedure, dossier), target: '_blank') + %br + = dossier.text_summary + - else + Pas de dossier associé - else %th.libelle = "#{c.libelle} :" diff --git a/spec/factories/champ.rb b/spec/factories/champ.rb index 4cd78dedc..a53ae8808 100644 --- a/spec/factories/champ.rb +++ b/spec/factories/champ.rb @@ -13,5 +13,9 @@ FactoryGirl.define do trait :explication do type_de_champ { FactoryGirl.create(:type_de_champ_public, :explication) } end + + trait :dossier_link do + type_de_champ { FactoryGirl.create(:type_de_champ_public, :type_dossier_link) } + end end end diff --git a/spec/views/new_gestionnaire/dossiers/_champs.html.haml_spec.rb b/spec/views/new_gestionnaire/dossiers/_champs.html.haml_spec.rb index b5fbc8762..3ad9c9cb9 100644 --- a/spec/views/new_gestionnaire/dossiers/_champs.html.haml_spec.rb +++ b/spec/views/new_gestionnaire/dossiers/_champs.html.haml_spec.rb @@ -1,11 +1,13 @@ describe 'new_gestionnaire/dossiers/champs.html.haml', type: :view do before { render 'new_gestionnaire/dossiers/champs.html.haml', champs: champs } - context "there is some champs" do + context "there are some champs" do + let(:dossier) { create(:dossier) } let(:champ1) { create(:champ, :checkbox, value: "true") } let(:champ2) { create(:champ, :header_section, value: "Section") } let(:champ3) { create(:champ, :explication, value: "mazette") } - let(:champs) { [champ1, champ2, champ3] } + let(:champ4) { create(:champ, :dossier_link, value: dossier.id) } + let(:champs) { [champ1, champ2, champ3, champ4] } it { expect(rendered).to include(champ1.libelle) } it { expect(rendered).to include(champ1.value) } @@ -15,5 +17,15 @@ describe 'new_gestionnaire/dossiers/champs.html.haml', type: :view do it { expect(rendered).not_to include(champ3.libelle) } it { expect(rendered).not_to include(champ3.value) } + + it { expect(rendered).to have_link("Dossier nº #{dossier.id}") } + it { expect(rendered).to include(dossier.text_summary) } + end + + context "with a dossier_link champ but without value" do + let(:champ) { create(:champ, :dossier_link, value: nil) } + let(:champs) { [champ] } + + it { expect(rendered).to include("Pas de dossier associé") } end end