From d9265d96868ef0ffa71126f53c42f26c50251b82 Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Thu, 8 Feb 2018 17:13:15 +0100 Subject: [PATCH 01/52] [Fix #1409] Display identite form with new design --- .../stylesheets/new_design/_constants.scss | 4 ++ app/assets/stylesheets/new_design/auth.scss | 41 ++++++++--------- app/assets/stylesheets/new_design/forms.scss | 33 +++++++++++++- .../stylesheets/new_design/helpers.scss | 5 +++ .../stylesheets/new_design/layouts.scss | 25 ++++++++--- .../new_user/dossiers_controller.rb | 7 ++- app/controllers/new_user/user_controller.rb | 2 + .../new_user/dossiers/identite.html.haml | 45 +++++++++++++++++++ config/locales/models/individual/fr.yml | 1 + config/routes.rb | 3 ++ 10 files changed, 137 insertions(+), 29 deletions(-) create mode 100644 app/assets/stylesheets/new_design/helpers.scss create mode 100644 app/views/new_user/dossiers/identite.html.haml diff --git a/app/assets/stylesheets/new_design/_constants.scss b/app/assets/stylesheets/new_design/_constants.scss index 1bbcb6b3d..f652937cc 100644 --- a/app/assets/stylesheets/new_design/_constants.scss +++ b/app/assets/stylesheets/new_design/_constants.scss @@ -7,3 +7,7 @@ $footer-height: 267px; $footer-height-mobile: 531px; $small-footer-height: 2 * $default-padding; + +// layouts +$two-columns-padding: 60px; +$two-columns-breakpoint: $page-width + (2 * $two-columns-padding); diff --git a/app/assets/stylesheets/new_design/auth.scss b/app/assets/stylesheets/new_design/auth.scss index 87f29d6ea..2ad56545b 100644 --- a/app/assets/stylesheets/new_design/auth.scss +++ b/app/assets/stylesheets/new_design/auth.scss @@ -3,24 +3,7 @@ @import "placeholders"; @import "mixins"; -$auth-breakpoint: 820px; - -@media (max-width: $auth-breakpoint) { - .preview { - display: none; - } - - .two-columns .column.auth-form { - @include horizontal-padding(0); - width: 100%; - } -} - -@media (max-width: $auth-breakpoint) { - .two-columns.auth { - background: #FFFFFF; - } -} +$auth-breakpoint: $two-columns-breakpoint; .preview { font-size: 24px; @@ -28,6 +11,10 @@ $auth-breakpoint: 820px; .paperless-logo { width: 100%; margin-bottom: 60px; + + @media (max-width: $auth-breakpoint) { + display: none; + } } h3 { @@ -41,11 +28,19 @@ $auth-breakpoint: 820px; .procedure-title { font-size: 30px; - margin: 50px 0 32px; + margin: 20px 0 0; + + @media (min-width: $auth-breakpoint) { + margin: 50px 0 32px; + } } .procedure-description { font-size: 14px; + + @media (max-width: $auth-breakpoint) { + display: none; // TO FIX : make this description available for small devices + } } .procedure-logos { @@ -53,8 +48,14 @@ $auth-breakpoint: 820px; justify-content: space-around; img { - max-height: 130px; + max-height: 50px; + max-width: 100%; margin: 0 10px; + + @media (min-width: $auth-breakpoint) { + max-height: 130px; + max-width: 500px; + } } } } diff --git a/app/assets/stylesheets/new_design/forms.scss b/app/assets/stylesheets/new_design/forms.scss index 288dad0c0..13486ec9f 100644 --- a/app/assets/stylesheets/new_design/forms.scss +++ b/app/assets/stylesheets/new_design/forms.scss @@ -25,6 +25,13 @@ display: block; margin-top: $default-spacer; } + + &.required { + &::after { + color: $dark-red; + content: " *"; + } + } } .editable-champ { @@ -70,6 +77,10 @@ &:disabled { background-color: $border-grey; } + + &.small { + padding: $default-padding / 2; + } } input[type=text], @@ -114,11 +125,17 @@ -webkit-appearance: none; -moz-appearance: none; appearance: none; - background: image-url("icons/chevron-down.svg") no-repeat; + background-color: #FFFFFF; + background-image: image-url("icons/chevron-down.svg"); + background-repeat: no-repeat; background-size: 14px; background-position: right 10px center; padding-right: 4 * $default-spacer; + &.small { + padding-right: 3 * $default-spacer; + } + // CAUTION: IE hackery ahead &::-ms-expand { display: none; // remove default arrow in IE 10 and 11 */ @@ -208,4 +225,18 @@ margin-bottom: $default-padding; } } + + .inline-champ { + margin-left: $default-spacer; + margin-right: $default-spacer; + width: 100%; + + &:first-child { + margin-left: 0; + } + + &:last-child { + margin-right: 0; + } + } } diff --git a/app/assets/stylesheets/new_design/helpers.scss b/app/assets/stylesheets/new_design/helpers.scss new file mode 100644 index 000000000..976e4c0d1 --- /dev/null +++ b/app/assets/stylesheets/new_design/helpers.scss @@ -0,0 +1,5 @@ +@import "constants"; + +.mb-1 { + margin-bottom: $default-spacer; +} diff --git a/app/assets/stylesheets/new_design/layouts.scss b/app/assets/stylesheets/new_design/layouts.scss index 467f18ff0..af089682b 100644 --- a/app/assets/stylesheets/new_design/layouts.scss +++ b/app/assets/stylesheets/new_design/layouts.scss @@ -3,23 +3,34 @@ @import "constants"; .two-columns { - $column-padding: 60px; - $two-columns-breakpoint: $page-width + (2 * $column-padding); + background-color: #FFFFFF; - background: linear-gradient(to right, #FFFFFF 0%, #FFFFFF 50%, $light-grey 50%, $light-grey 100%); + @media (min-width: $two-columns-breakpoint) { + background: linear-gradient(to right, #FFFFFF 0%, #FFFFFF 50%, $light-grey 50%, $light-grey 100%); + } .columns-container { @extend .container; display: flex; - flex-direction: row; - align-items: center; + flex-direction: column; + + @media (min-width: $two-columns-breakpoint) { + flex-direction: row; + align-items: center; + justify-content: center; + } } .column { - width: 50%; - padding: $column-padding; + padding: $two-columns-padding 0 0; + width: 100%; + max-width: 500px; + margin: auto; @media (min-width: $two-columns-breakpoint) { + padding: $two-columns-padding; + width: 50%; + &:first-child { padding-left: 0; } diff --git a/app/controllers/new_user/dossiers_controller.rb b/app/controllers/new_user/dossiers_controller.rb index bc7df485d..345ea666a 100644 --- a/app/controllers/new_user/dossiers_controller.rb +++ b/app/controllers/new_user/dossiers_controller.rb @@ -6,10 +6,15 @@ module NewUser send_data(dossier.attestation.pdf.read, filename: 'attestation.pdf', type: 'application/pdf') end + def identite + @dossier = dossier + @user = current_user + end + private def dossier - Dossier.find(params[:dossier_id]) + Dossier.find(params[:id] || params[:dossier_id]) end def ensure_ownership! diff --git a/app/controllers/new_user/user_controller.rb b/app/controllers/new_user/user_controller.rb index 5cd85ae0f..566424ecf 100644 --- a/app/controllers/new_user/user_controller.rb +++ b/app/controllers/new_user/user_controller.rb @@ -1,5 +1,7 @@ module NewUser class UserController < ApplicationController + layout "new_application" + before_action :authenticate_user! end end diff --git a/app/views/new_user/dossiers/identite.html.haml b/app/views/new_user/dossiers/identite.html.haml new file mode 100644 index 000000000..b3633165f --- /dev/null +++ b/app/views/new_user/dossiers/identite.html.haml @@ -0,0 +1,45 @@ +.two-columns + .columns-container + .column.preview + .procedure-logos + = image_tag @dossier.procedure.decorate.logo_img + - if @dossier.procedure.euro_flag + = image_tag "flag_of_europe.svg" + + %h2.procedure-title + = @dossier.procedure.libelle + %p.procedure-description + = h sanitize(@dossier.procedure.description) + + .column + = form_for @dossier.individual, url: update_identite_dossier_path(@dossier), html: { class: "form" } do |f| + %h1 Données d'identité + + %p.mb-1 Merci de remplir vos informations personnelles pour accéder à la démarche. + + %label + %span.mandatory * + champs requis + + = f.label :gender, class: "required" + = f.select :gender, ['M.', 'Mme'], {}, class: "small" + + .flex + .inline-champ + = f.label :prenom, class: "required" + = f.text_field :prenom, class: "small", required: true + .inline-champ + = f.label :nom, class: "required" + = f.text_field :nom, class: "small", required: true + + - if @dossier.procedure.ask_birthday? + = f.label :birthdate, class: "required" + = f.date_field :birthdate, value: @dossier.individual.birthdate, placeholder: 'format : AAAA-MM-JJ', required: true, class: "small" + + = fields_for :dossier, @dossier do |df| + = label_tag do + = df.check_box :autorisation_donnees, required: true + J'accepte + = link_to "les CGU", CGU_URL, target: :blank + + = f.submit "Continuer", class: "button large primary expand" diff --git a/config/locales/models/individual/fr.yml b/config/locales/models/individual/fr.yml index 60c02a37c..186e27a65 100644 --- a/config/locales/models/individual/fr.yml +++ b/config/locales/models/individual/fr.yml @@ -2,6 +2,7 @@ fr: activerecord: attributes: individual: + gender: Civilité nom: Nom prenom: Prénom birthdate: Date de naissance diff --git a/config/routes.rb b/config/routes.rb index c29bbe3b7..694215ddd 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -202,6 +202,9 @@ Rails.application.routes.draw do scope module: 'new_user' do resources :dossiers, only: [] do + member do + get 'identite' + end get 'attestation' end end From 9627ba43c0ef99e8fbb33e7808e51064ccb4c67f Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Thu, 8 Feb 2018 17:13:15 +0100 Subject: [PATCH 02/52] [Fix #1409] Identite can be updated --- .../new_user/dossiers_controller.rb | 28 +++++++++++++ app/models/dossier.rb | 4 +- app/models/individual.rb | 13 +++++++ config/locales/models/dossier/fr.yml | 1 + config/locales/models/individual/fr.yml | 2 + config/routes.rb | 1 + .../new_user/dossiers_controller_spec.rb | 39 +++++++++++++++++++ .../users/dossiers_controller_spec.rb | 2 + spec/factories/dossier.rb | 1 + 9 files changed, 90 insertions(+), 1 deletion(-) diff --git a/app/controllers/new_user/dossiers_controller.rb b/app/controllers/new_user/dossiers_controller.rb index 345ea666a..0cb5f24d0 100644 --- a/app/controllers/new_user/dossiers_controller.rb +++ b/app/controllers/new_user/dossiers_controller.rb @@ -11,6 +11,26 @@ module NewUser @user = current_user end + def update_identite + @dossier = dossier + + individual_updated = @dossier.individual.update(individual_params) + dossier_updated = @dossier.update(dossier_params) + + if individual_updated && dossier_updated + flash.notice = "Identité enregistrée" + + if @dossier.procedure.module_api_carto.use_api_carto + redirect_to users_dossier_carte_path(@dossier.id) + else + redirect_to identite_dossier_path(@dossier) # Simon should replace this with dossier_path when done + end + else + flash.now.alert = @dossier.errors.full_messages + render :identite + end + end + private def dossier @@ -23,5 +43,13 @@ module NewUser redirect_to root_path end end + + def individual_params + params.require(:individual).permit(:gender, :nom, :prenom, :birthdate) + end + + def dossier_params + params.require(:dossier).permit(:autorisation_donnees) + end end end diff --git a/app/models/dossier.rb b/app/models/dossier.rb index 5fede6a93..e4f2be5ab 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -37,6 +37,8 @@ class Dossier < ActiveRecord::Base accepts_nested_attributes_for :champs accepts_nested_attributes_for :champs_private + validates :autorisation_donnees, acceptance: { message: 'doit être coché' }, allow_nil: false, on: :update + default_scope { where(hidden_at: nil) } scope :state_brouillon, -> { where(state: 'brouillon') } scope :state_not_brouillon, -> { where.not(state: 'brouillon') } @@ -177,7 +179,7 @@ class Dossier < ActiveRecord::Base etablissement.destroy entreprise.destroy - update_attributes(autorisation_donnees: false) + update_columns(autorisation_donnees: false) end def total_follow diff --git a/app/models/individual.rb b/app/models/individual.rb index c35af2e4d..f108933dd 100644 --- a/app/models/individual.rb +++ b/app/models/individual.rb @@ -2,5 +2,18 @@ class Individual < ActiveRecord::Base belongs_to :dossier validates_uniqueness_of :dossier_id + validates :gender, presence: true, allow_nil: false, on: :update + validates :nom, presence: true, allow_blank: false, allow_nil: false, on: :update + validates :prenom, presence: true, allow_blank: false, allow_nil: false, on: :update validates :birthdate, format: { with: /\A\d{4}\-\d{2}\-\d{2}\z/, message: "La date n'est pas au format AAAA-MM-JJ" }, allow_nil: true + + before_validation :set_iso_date, if: -> { birthdate_changed? } + + private + + def set_iso_date + if birthdate.present? + self.birthdate = Date.parse(birthdate).iso8601 + end + end end diff --git a/config/locales/models/dossier/fr.yml b/config/locales/models/dossier/fr.yml index a9b9452f4..b66d5eff4 100644 --- a/config/locales/models/dossier/fr.yml +++ b/config/locales/models/dossier/fr.yml @@ -14,6 +14,7 @@ fr: accepte: "Accepté" refuse: "Refusé" sans_suite: "Sans suite" + autorisation_donnees: Acceptation des CGU errors: models: diff --git a/config/locales/models/individual/fr.yml b/config/locales/models/individual/fr.yml index 186e27a65..fe5bda687 100644 --- a/config/locales/models/individual/fr.yml +++ b/config/locales/models/individual/fr.yml @@ -10,6 +10,8 @@ fr: models: individual: attributes: + gender: + blank: 'doit être rempli' nom: blank: 'doit être rempli' prenom: diff --git a/config/routes.rb b/config/routes.rb index 694215ddd..8a2155b5b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -204,6 +204,7 @@ Rails.application.routes.draw do resources :dossiers, only: [] do member do get 'identite' + patch 'update_identite' end get 'attestation' end diff --git a/spec/controllers/new_user/dossiers_controller_spec.rb b/spec/controllers/new_user/dossiers_controller_spec.rb index 358a893c2..52795cd5c 100644 --- a/spec/controllers/new_user/dossiers_controller_spec.rb +++ b/spec/controllers/new_user/dossiers_controller_spec.rb @@ -64,4 +64,43 @@ describe NewUser::DossiersController, type: :controller do end end end + + describe 'update_identite' do + let(:procedure) { create(:procedure, :for_individual) } + let(:dossier) { create(:dossier, user: user, procedure: procedure) } + + subject { post :update_identite, params: { id: dossier.id, individual: individual_params, dossier: dossier_params } } + + before do + sign_in(user) + subject + end + + context 'with correct individual and dossier params' do + let(:individual_params) { { gender: 'M', nom: 'Mouse', prenom: 'Mickey' } } + let(:dossier_params) { { autorisation_donnees: true } } + + it do + expect(response).to redirect_to(users_dossier_description_path(dossier)) + end + + context 'on a procedure with carto' do + let(:procedure) { create(:procedure, :for_individual, :with_api_carto) } + + it do + expect(response).to redirect_to(users_dossier_carte_path(dossier)) + end + end + end + + context 'with incorrect individual and dossier params' do + let(:individual_params) { { gender: '', nom: '', prenom: '' } } + let(:dossier_params) { { autorisation_donnees: nil } } + + it do + expect(response).not_to have_http_status(:redirect) + expect(flash[:alert]).to include("Civilité doit être rempli", "Nom doit être rempli", "Prénom doit être rempli", "Acceptation des CGU doit être coché") + end + end + end end diff --git a/spec/controllers/users/dossiers_controller_spec.rb b/spec/controllers/users/dossiers_controller_spec.rb index 6635d49d0..0525b1ec7 100644 --- a/spec/controllers/users/dossiers_controller_spec.rb +++ b/spec/controllers/users/dossiers_controller_spec.rb @@ -365,6 +365,8 @@ describe Users::DossiersController, type: :controller do before do sign_in dossier.user + dossier.update_columns(autorisation_donnees: nil) + dossier.reload subject end diff --git a/spec/factories/dossier.rb b/spec/factories/dossier.rb index 4fa1978de..1fda4bbda 100644 --- a/spec/factories/dossier.rb +++ b/spec/factories/dossier.rb @@ -1,5 +1,6 @@ FactoryBot.define do factory :dossier do + autorisation_donnees true state 'brouillon' association :user, factory: [:user] From 3e5621f6332374c3c06b2ae9b3a3defff45a209b Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Mon, 12 Feb 2018 15:55:51 +0100 Subject: [PATCH 03/52] [Fix #1409] Plug identite new design to current workflow --- .../new_user/dossiers_controller.rb | 2 +- app/controllers/users/dossiers_controller.rb | 6 ++- spec/features/users/dossier_creation_spec.rb | 38 ++++++++++++------- spec/features/users/dossier_index_spec.rb | 13 ++----- 4 files changed, 34 insertions(+), 25 deletions(-) diff --git a/app/controllers/new_user/dossiers_controller.rb b/app/controllers/new_user/dossiers_controller.rb index 0cb5f24d0..02f02b5f2 100644 --- a/app/controllers/new_user/dossiers_controller.rb +++ b/app/controllers/new_user/dossiers_controller.rb @@ -23,7 +23,7 @@ module NewUser if @dossier.procedure.module_api_carto.use_api_carto redirect_to users_dossier_carte_path(@dossier.id) else - redirect_to identite_dossier_path(@dossier) # Simon should replace this with dossier_path when done + redirect_to users_dossier_description_path(@dossier) # Simon should replace this with dossier_path when done end else flash.now.alert = @dossier.errors.full_messages diff --git a/app/controllers/users/dossiers_controller.rb b/app/controllers/users/dossiers_controller.rb index 944e9b285..a5042fc7a 100644 --- a/app/controllers/users/dossiers_controller.rb +++ b/app/controllers/users/dossiers_controller.rb @@ -73,7 +73,11 @@ class Users::DossiersController < UsersController update_current_user_siret! siret if siret.present? - redirect_to users_dossier_path(id: dossier.id) + if dossier.procedure.for_individual + redirect_to identite_dossier_path(dossier) + else + redirect_to users_dossier_path(id: dossier.id) + end rescue ActiveRecord::RecordNotFound error_procedure end diff --git a/spec/features/users/dossier_creation_spec.rb b/spec/features/users/dossier_creation_spec.rb index 1ba1d94f4..19f7fb6fa 100644 --- a/spec/features/users/dossier_creation_spec.rb +++ b/spec/features/users/dossier_creation_spec.rb @@ -13,34 +13,41 @@ feature 'As a User I wanna create a dossier' do before do login_as user, scope: :user visit commencer_path(procedure_path: procedure_for_individual.path) - fill_in 'dossier_individual_attributes_nom', with: 'Nom' - fill_in 'dossier_individual_attributes_prenom', with: 'Prenom' - find(:css, "#dossier_autorisation_donnees[value='1']").set(true) + fill_in 'individual_nom', with: 'Nom' + fill_in 'individual_prenom', with: 'Prenom' + check "dossier_autorisation_donnees" end context "when birthday is asked" do let(:ask_birthday) { true } scenario "with a proper date input field for birthdate (type='date' supported)" do - fill_in 'dossier_individual_attributes_birthdate', with: '1987-10-14' - page.find_by_id('etape_suivante').click - expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last.id.to_s)) - page.find_by_id('etape_suivante').click + fill_in 'individual_birthdate', with: '1987-10-14' + click_button('Continuer') + + expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last.id)) + click_button('Etape suivante') + + expect(page).to have_current_path(users_dossier_description_path(procedure_for_individual.dossiers.last.id)) fill_in "champs_#{procedure_for_individual.dossiers.last.champs.first.id}", with: 'contenu du champ 1' find(:css, '[name=submit_action]').set('nouveaux') - page.find_by_id('suivant').click + click_button('suivant') + expect(user.dossiers.first.individual.birthdate).to eq("1987-10-14") expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_for_individual.dossiers.last.id.to_s)) end scenario "with a basic text input field for birthdate (type='date' unsupported)" do - fill_in 'dossier_individual_attributes_birthdate', with: '14/10/1987' - page.find_by_id('etape_suivante').click + fill_in 'individual_birthdate', with: '14/10/1987' + click_button('Continuer') + expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last.id.to_s)) - page.find_by_id('etape_suivante').click + click_button('Etape suivante') + fill_in "champs_#{procedure_for_individual.dossiers.last.champs.first.id}", with: 'contenu du champ 1' find(:css, '[name=submit_action]').set('nouveaux') page.find_by_id('suivant').click + expect(user.dossiers.first.individual.birthdate).to eq("1987-10-14") expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_for_individual.dossiers.last.id.to_s)) end @@ -50,12 +57,15 @@ feature 'As a User I wanna create a dossier' do let(:ask_birthday) { false } scenario "no need for birthday" do - page.find_by_id('etape_suivante').click + click_button('Continuer') + expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last.id.to_s)) - page.find_by_id('etape_suivante').click + click_button('Etape suivante') + fill_in "champs_#{procedure_for_individual.dossiers.last.champs.first.id}", with: 'contenu du champ 1' find(:css, '[name=submit_action]').set('nouveaux') - page.find_by_id('suivant').click + click_button('suivant') + expect(user.dossiers.first.individual.birthdate).to eq(nil) expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_for_individual.dossiers.last.id.to_s)) end diff --git a/spec/features/users/dossier_index_spec.rb b/spec/features/users/dossier_index_spec.rb index 614059d63..16b4b727b 100644 --- a/spec/features/users/dossier_index_spec.rb +++ b/spec/features/users/dossier_index_spec.rb @@ -6,16 +6,11 @@ feature 'As a User I want to sort and paginate dossiers', js: true do before "Create dossier" do login_as user, scope: :user - visit commencer_path(procedure_path: procedure_for_individual.path) - fill_in 'dossier_individual_attributes_nom', with: 'Nom' - fill_in 'dossier_individual_attributes_prenom', with: 'Prenom' - fill_in 'dossier_individual_attributes_birthdate', with: '14/10/1987' - find(:css, "#dossier_autorisation_donnees[value='1']").set(true) - page.find_by_id('etape_suivante').click - page.find_by_id('suivant').click + 50.times do Dossier.create(procedure_id: procedure_for_individual.id, user_id: user.id, state: "en_construction") end + visit root_path end @@ -25,8 +20,8 @@ feature 'As a User I want to sort and paginate dossiers', js: true do expect(page.all(:css, '#dossiers-list tr')[1].text.split(" ").first).to eq(user.dossiers.first.id.to_s) expect(page.all(:css, '#dossiers-list tr')[2].text.split(" ").first).to eq(user.dossiers.second.id.to_s) visit "/users/dossiers?dossiers_smart_listing[sort][id]=desc" - expect(page.all(:css, '#dossiers-list tr')[1].text.split(" ").first).to eq((user.dossiers.first.id + 50).to_s) - expect(page.all(:css, '#dossiers-list tr')[2].text.split(" ").first).to eq((user.dossiers.first.id + 49).to_s) + expect(page.all(:css, '#dossiers-list tr')[1].text.split(" ").first).to eq((user.dossiers.first.id + 49).to_s) + expect(page.all(:css, '#dossiers-list tr')[2].text.split(" ").first).to eq((user.dossiers.first.id + 48).to_s) visit "/users/dossiers?dossiers_smart_listing[sort][id]=asc" expect(page.all(:css, '#dossiers-list tr')[1].text.split(" ").first).to eq(user.dossiers.first.id.to_s) expect(page.all(:css, '#dossiers-list tr')[2].text.split(" ").first).to eq(user.dossiers.second.id.to_s) From 918a34af390705ba60a8db15bfefba4daba8f070 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Tue, 20 Feb 2018 10:57:39 +0100 Subject: [PATCH 04/52] Remove duplicated assign_tos --- ...2018_02_20_remove_duplicated_assign_tos.rake | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 lib/tasks/2018_02_20_remove_duplicated_assign_tos.rake diff --git a/lib/tasks/2018_02_20_remove_duplicated_assign_tos.rake b/lib/tasks/2018_02_20_remove_duplicated_assign_tos.rake new file mode 100644 index 000000000..8d1778b2d --- /dev/null +++ b/lib/tasks/2018_02_20_remove_duplicated_assign_tos.rake @@ -0,0 +1,17 @@ +namespace :'2018_02_14_remove_duplicated_assign_tos' do + task remove: :environment do + duplicates = AssignTo.group(:gestionnaire_id, :procedure_id) + .having("COUNT(*) > 1") + .size + .to_a + + duplicates.each do |duplicate| + keys = duplicate.first + gestionnaire_id = keys.first + procedure_id = keys.last + assign_tos = AssignTo.where(gestionnaire_id: gestionnaire_id, procedure_id: procedure_id).to_a + assign_tos.shift + assign_tos.each(&:destroy) + end + end +end From ae0a3148648feed2303d9aeed5ac74a4662c059d Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Tue, 20 Feb 2018 15:25:01 +0100 Subject: [PATCH 05/52] Fix a typo --- lib/tasks/2018_02_20_remove_duplicated_assign_tos.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/2018_02_20_remove_duplicated_assign_tos.rake b/lib/tasks/2018_02_20_remove_duplicated_assign_tos.rake index 8d1778b2d..6ca6b85ce 100644 --- a/lib/tasks/2018_02_20_remove_duplicated_assign_tos.rake +++ b/lib/tasks/2018_02_20_remove_duplicated_assign_tos.rake @@ -1,4 +1,4 @@ -namespace :'2018_02_14_remove_duplicated_assign_tos' do +namespace :'2018_02_20_remove_duplicated_assign_tos' do task remove: :environment do duplicates = AssignTo.group(:gestionnaire_id, :procedure_id) .having("COUNT(*) > 1") From 4f8a19718f9a64eccddc33def6659769f9ed2b69 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Tue, 20 Feb 2018 12:08:24 +0100 Subject: [PATCH 06/52] =?UTF-8?q?Do=20not=20show=20notifications=20on=20?= =?UTF-8?q?=E2=80=9Call=20dossiers=E2=80=9D=20tab?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/new_gestionnaire/procedures/show.html.haml | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/views/new_gestionnaire/procedures/show.html.haml b/app/views/new_gestionnaire/procedures/show.html.haml index 2e334e972..04414b874 100644 --- a/app/views/new_gestionnaire/procedures/show.html.haml +++ b/app/views/new_gestionnaire/procedures/show.html.haml @@ -28,8 +28,6 @@ %span.badge= @termines_dossiers.count %li{ class: (@statut == 'tous') ? 'active' : nil }> - - if current_gestionnaire.notifications_for_procedure(@procedure).present? - %span.notifications{ 'aria-label': 'notifications' } = link_to(procedure_path(@procedure, statut: 'tous')) do tous les dossiers %span.badge= @all_state_dossiers.count From 55f15b23548b81d2a4e91bd7d7c7d897c43f01d4 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Tue, 20 Feb 2018 12:09:25 +0100 Subject: [PATCH 07/52] =?UTF-8?q?Add=20a=20way=20to=20check=20for=20notifi?= =?UTF-8?q?cations=20on=20dossiers=20termin=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/gestionnaire.rb | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/app/models/gestionnaire.rb b/app/models/gestionnaire.rb index 1ca3a5bcf..9a9a01b0b 100644 --- a/app/models/gestionnaire.rb +++ b/app/models/gestionnaire.rb @@ -101,14 +101,28 @@ class Gestionnaire < ActiveRecord::Base end end - def notifications_for_procedure(procedure) - dossiers = procedure.dossiers.en_cours.followed_by(self) + def notifications_for_procedure(procedure, state = :en_cours) + dossiers = case state + when :termine + procedure.dossiers.termine + when :not_archived + procedure.dossiers.not_archived + else + procedure.dossiers.en_cours + end.followed_by(self) dossiers_id_with_notifications(dossiers) end - def notifications_per_procedure - dossiers = Dossier.en_cours.followed_by(self) + def notifications_per_procedure(state = :en_cours) + dossiers = case state + when :termine + Dossier.termine + when :not_archived + Dossier.not_archived + else + Dossier.en_cours + end.followed_by(self) Dossier.where(id: dossiers_id_with_notifications(dossiers)).group(:procedure_id).count end From 2cf09855855d1b8d65e5f2d3f99118fd83aba530 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Tue, 20 Feb 2018 15:53:07 +0100 Subject: [PATCH 08/52] =?UTF-8?q?Show=20notifications=20on=20dossiers=20te?= =?UTF-8?q?rmin=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #1138 --- app/views/new_gestionnaire/procedures/index.html.haml | 2 ++ app/views/new_gestionnaire/procedures/show.html.haml | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/new_gestionnaire/procedures/index.html.haml b/app/views/new_gestionnaire/procedures/index.html.haml index 084518d73..c4faed67a 100644 --- a/app/views/new_gestionnaire/procedures/index.html.haml +++ b/app/views/new_gestionnaire/procedures/index.html.haml @@ -37,6 +37,8 @@ %li %object = link_to(procedure_path(p, statut: 'traites')) do + - if current_gestionnaire.notifications_per_procedure(:termine)[p.id].present? + %span.notifications{ 'aria-label': "notifications" } - termines_count = @dossiers_termines_count_per_procedure[p.id] || 0 .stats-number = termines_count diff --git a/app/views/new_gestionnaire/procedures/show.html.haml b/app/views/new_gestionnaire/procedures/show.html.haml index 04414b874..b0c4762ef 100644 --- a/app/views/new_gestionnaire/procedures/show.html.haml +++ b/app/views/new_gestionnaire/procedures/show.html.haml @@ -23,6 +23,8 @@ %span.badge= @followed_dossiers.count %li{ class: (@statut == 'traites') ? 'active' : nil }> + - if current_gestionnaire.notifications_for_procedure(@procedure, :termine).present? + %span.notifications{ 'aria-label': 'notifications' } = link_to(procedure_path(@procedure, statut: 'traites')) do = t('pluralize.processed', count: @termines_dossiers.count) %span.badge= @termines_dossiers.count @@ -94,7 +96,7 @@ %td.folder-col = link_to(dossier_path(@procedure, dossier), class: 'cell-link') do %span.icon.folder - - if current_gestionnaire.notifications_for_procedure(@procedure).include?(dossier.id) + - if current_gestionnaire.notifications_for_procedure(@procedure, :not_archived).include?(dossier.id) %span.notifications{ 'aria-label': 'notifications' } %td.number-col From 5470141ca428d183c14349d65a04a77b99629cca Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Wed, 14 Feb 2018 11:25:54 +0100 Subject: [PATCH 09/52] =?UTF-8?q?Moulinette=E2=84=A2=20STI=20Champ=20et=20?= =?UTF-8?q?TypeDeChamp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/type_de_champ.rb | 7 ++++++- app/services/types_de_champ_service.rb | 4 ++++ config/initializers/inflections.rb | 2 +- .../2018_02_13_fill_champ_private_and_type.rake | 14 ++++++++++++++ 4 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 lib/tasks/2018_02_13_fill_champ_private_and_type.rake diff --git a/app/models/type_de_champ.rb b/app/models/type_de_champ.rb index 20c4639a8..ecc42691a 100644 --- a/app/models/type_de_champ.rb +++ b/app/models/type_de_champ.rb @@ -50,7 +50,8 @@ class TypeDeChamp < ActiveRecord::Base def params_for_champ { - private: private? + private: private?, + type: "Champs::#{type_champ.classify}Champ" } end @@ -77,4 +78,8 @@ class TypeDeChamp < ActiveRecord::Base def public? !private? end + + def self.type_champ_to_class_name(type_champ) + "TypesDeChamp::#{type_champ.classify}TypeDeChamp" + end end diff --git a/app/services/types_de_champ_service.rb b/app/services/types_de_champ_service.rb index d4eb53a9b..614e6b5fe 100644 --- a/app/services/types_de_champ_service.rb +++ b/app/services/types_de_champ_service.rb @@ -18,6 +18,10 @@ class TypesDeChampService parameters[attributes].each do |index, param| param[:private] = private + if param[:type_champ] + param[:type] = TypeDeChamp.type_champ_to_class_name(param[:type_champ]) + end + if param[:libelle].empty? parameters[attributes].delete(index.to_s) end diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index fc49561ab..bcdbc6893 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -15,7 +15,7 @@ ActiveSupport::Inflector.inflections(:en) do |inflect| inflect.irregular 'type_de_champ', 'types_de_champ' inflect.irregular 'type_de_champ_private', 'types_de_champ_private' inflect.irregular 'assign_to', 'assign_tos' - inflect.irregular('avis', 'avis') + inflect.uncountable(['avis', 'pays']) end # From https://github.com/davidcelis/inflections diff --git a/lib/tasks/2018_02_13_fill_champ_private_and_type.rake b/lib/tasks/2018_02_13_fill_champ_private_and_type.rake new file mode 100644 index 000000000..86a2da1ec --- /dev/null +++ b/lib/tasks/2018_02_13_fill_champ_private_and_type.rake @@ -0,0 +1,14 @@ +namespace :'2018_02_13_fill_champ_private_and_type' do + task set: :environment do + Champ.includes(:type_de_champ).find_each do |champ| + champ.update_columns(champ.type_de_champ.params_for_champ) + end + + TypeDeChamp.find_each do |type_de_champ| + type_de_champ.update_columns( + private: type_de_champ.private?, + type: TypeDeChamp.type_champ_to_class_name(type_de_champ.type_champ) + ) + end + end +end From 935a022f15309aa724a273985ec95cc1a7596512 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 21 Feb 2018 11:47:27 +0100 Subject: [PATCH 10/52] Bump default gems - sentry-raven - simple_form - skylight - uglifier - fog-openstack --- Gemfile.lock | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3c4c99f68..1138ab81d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -296,7 +296,7 @@ GEM multi_json (~> 1.10) fog-local (0.4.0) fog-core (~> 1.27) - fog-openstack (0.1.23) + fog-openstack (0.1.24) fog-core (~> 1.40) fog-json (>= 1.0) ipaddress (>= 0.8) @@ -403,7 +403,7 @@ GEM domain_name (~> 0.5) http_parser.rb (0.6.0) httpclient (2.8.3) - i18n (0.9.3) + i18n (0.9.5) concurrent-ruby (~> 1.0) inflecto (0.0.2) ipaddress (0.8.3) @@ -448,7 +448,7 @@ GEM activesupport (>= 4.0) logstash-event (~> 1.2.0) request_store - loofah (2.1.1) + loofah (2.2.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) lumberjack (1.0.12) @@ -510,7 +510,7 @@ GEM validate_email validate_url webfinger (>= 1.0.1) - openstack (3.3.12) + openstack (3.3.15) json orm_adapter (0.5.0) parallel (1.12.1) @@ -532,7 +532,7 @@ GEM byebug (~> 9.1) pry (~> 0.10) public_suffix (3.0.1) - rack (2.0.3) + rack (2.0.4) rack-handlers (0.7.3) rack rack-mini-profiler (0.10.7) @@ -670,13 +670,13 @@ GEM selenium-webdriver (3.8.0) childprocess (~> 0.5) rubyzip (~> 1.0) - sentry-raven (2.7.1) + sentry-raven (2.7.2) faraday (>= 0.7.6, < 1.0) sexp_processor (4.10.0) shellany (0.0.1) shoulda-matchers (3.1.2) activesupport (>= 4.0.0) - simple_form (3.5.0) + simple_form (3.5.1) actionpack (> 4, < 5.2) activemodel (> 4, < 5.2) sinatra (2.0.0) @@ -684,7 +684,7 @@ GEM rack (~> 2.0) rack-protection (= 2.0.0) tilt (~> 2.0) - skylight (1.5.0) + skylight (1.5.1) activesupport (>= 3.0.0) spreadsheet_architect (1.4.8) axlsx (>= 2.0) @@ -718,9 +718,9 @@ GEM turbolinks (5.1.0) turbolinks-source (~> 5.1) turbolinks-source (5.1.0) - tzinfo (1.2.4) + tzinfo (1.2.5) thread_safe (~> 0.1) - uglifier (4.1.4) + uglifier (4.1.6) execjs (>= 0.3.0, < 3) unf (0.1.4) unf_ext From 1c74521c6ea6895a3a9ab4c57b750e7d57d373d0 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 21 Feb 2018 11:57:03 +0100 Subject: [PATCH 11/52] Bump test gems - capybara - byebug - pry-byebug - rspec-rails --- Gemfile.lock | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 1138ab81d..5ee109978 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -96,7 +96,7 @@ GEM apipie-rails (0.5.6) rails (>= 4.1) arel (9.0.0) - ast (2.3.0) + ast (2.4.0) attr_required (1.0.1) autoprefixer-rails (7.2.5) execjs @@ -115,8 +115,8 @@ GEM brakeman (4.1.1) browser (2.5.2) builder (3.2.3) - byebug (9.1.0) - capybara (2.17.0) + byebug (10.0.0) + capybara (2.18.0) addressable mini_mime (>= 0.1.3) nokogiri (>= 1.3.3) @@ -202,7 +202,7 @@ GEM activesupport (>= 3.0.0) faraday (0.12.2) multipart-post (>= 1.2, < 3) - ffi (1.9.18) + ffi (1.9.21) fission (0.5.0) CFPropertyList (~> 2.2) fog (1.41.0) @@ -514,8 +514,8 @@ GEM json orm_adapter (0.5.0) parallel (1.12.1) - parser (2.4.0.2) - ast (~> 2.3) + parser (2.5.0.1) + ast (~> 2.4.0) pdf-core (0.7.0) pg (0.19.0) powerpack (0.1.1) @@ -528,10 +528,10 @@ GEM pry (0.11.3) coderay (~> 1.1.0) method_source (~> 0.9.0) - pry-byebug (3.5.1) - byebug (~> 9.1) + pry-byebug (3.6.0) + byebug (~> 10.0) pry (~> 0.10) - public_suffix (3.0.1) + public_suffix (3.0.2) rack (2.0.4) rack-handlers (0.7.3) rack @@ -604,27 +604,27 @@ GEM activesupport (>= 3.0, < 6.0) builder (~> 3.0) rubyzip (~> 1.0) - rspec (3.5.0) - rspec-core (~> 3.5.0) - rspec-expectations (~> 3.5.0) - rspec-mocks (~> 3.5.0) - rspec-core (3.5.4) - rspec-support (~> 3.5.0) - rspec-expectations (3.5.0) + rspec (3.7.0) + rspec-core (~> 3.7.0) + rspec-expectations (~> 3.7.0) + rspec-mocks (~> 3.7.0) + rspec-core (3.7.1) + rspec-support (~> 3.7.0) + rspec-expectations (3.7.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.5.0) - rspec-mocks (3.5.0) + rspec-support (~> 3.7.0) + rspec-mocks (3.7.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.5.0) - rspec-rails (3.5.2) + rspec-support (~> 3.7.0) + rspec-rails (3.7.2) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) - rspec-core (~> 3.5.0) - rspec-expectations (~> 3.5.0) - rspec-mocks (~> 3.5.0) - rspec-support (~> 3.5.0) - rspec-support (3.5.0) + rspec-core (~> 3.7.0) + rspec-expectations (~> 3.7.0) + rspec-mocks (~> 3.7.0) + rspec-support (~> 3.7.0) + rspec-support (3.7.1) rspec_junit_formatter (0.3.0) rspec-core (>= 2, < 4, != 2.12.0) rubocop (0.52.1) From 54ee79d90b5dddef2384d00a1b0ab0577039ee93 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 21 Feb 2018 11:57:51 +0100 Subject: [PATCH 12/52] Bump sinatra (security vulnerability) --- Gemfile.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 5ee109978..cb3c0a052 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -474,7 +474,7 @@ GEM multi_json (1.13.1) multi_xml (0.6.0) multipart-post (2.0.0) - mustermann (1.0.1) + mustermann (1.0.2) nenv (0.3.0) netrc (0.11.0) nio4r (2.2.0) @@ -543,7 +543,7 @@ GEM httpclient (>= 2.4) multi_json (>= 1.3.6) rack (>= 1.1) - rack-protection (2.0.0) + rack-protection (2.0.1) rack rack-test (0.8.2) rack (>= 1.0, < 3) @@ -679,10 +679,10 @@ GEM simple_form (3.5.1) actionpack (> 4, < 5.2) activemodel (> 4, < 5.2) - sinatra (2.0.0) + sinatra (2.0.1) mustermann (~> 1.0) rack (~> 2.0) - rack-protection (= 2.0.0) + rack-protection (= 2.0.1) tilt (~> 2.0) skylight (1.5.1) activesupport (>= 3.0.0) From 6ed1d7f833d8b4e15cc31967c3223a612c6b93dc Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Mon, 12 Feb 2018 16:26:56 +0100 Subject: [PATCH 13/52] [Fix 1413] User header should not contain accompagnateurs links --- .../new_gestionnaire/gestionnaire_controller.rb | 4 ++++ app/controllers/new_user/user_controller.rb | 4 ++++ app/views/layouts/_new_header.haml | 8 ++++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/controllers/new_gestionnaire/gestionnaire_controller.rb b/app/controllers/new_gestionnaire/gestionnaire_controller.rb index c675f9566..2ffe8ae50 100644 --- a/app/controllers/new_gestionnaire/gestionnaire_controller.rb +++ b/app/controllers/new_gestionnaire/gestionnaire_controller.rb @@ -3,5 +3,9 @@ module NewGestionnaire layout "new_application" before_action :authenticate_gestionnaire! + + def nav_bar_profile + :gestionnaire + end end end diff --git a/app/controllers/new_user/user_controller.rb b/app/controllers/new_user/user_controller.rb index 566424ecf..dc74e3d12 100644 --- a/app/controllers/new_user/user_controller.rb +++ b/app/controllers/new_user/user_controller.rb @@ -3,5 +3,9 @@ module NewUser layout "new_application" before_action :authenticate_user! + + def nav_bar_profile + :user + end end end diff --git a/app/views/layouts/_new_header.haml b/app/views/layouts/_new_header.haml index f515c3238..2bdc8be3e 100644 --- a/app/views/layouts/_new_header.haml +++ b/app/views/layouts/_new_header.haml @@ -1,3 +1,5 @@ +- nav_bar_profile = controller.try(:nav_bar_profile) + .new-header{ class: current_page?(root_path) ? nil : "new-header-with-border" } .header-inner-content @@ -5,7 +7,7 @@ = link_to root_path, class: "header-logo" do %img{ src: image_url("header/logo-tps.svg") } - - if gestionnaire_signed_in? + - if nav_bar_profile == :gestionnaire && gestionnaire_signed_in? - current_url = request.path_info %ul.header-tabs - if current_gestionnaire.procedures.count > 0 @@ -29,13 +31,15 @@ – par email : contact@tps.apientreprise.fr %ul.header-right-content - - if gestionnaire_signed_in? + - if nav_bar_profile == :gestionnaire && gestionnaire_signed_in? %li .header-search = form_tag recherche_path, method: :get, class: "form" do = text_field_tag "q", "#{@search_terms if @search_terms.present?}", placeholder: "Rechercher un dossier" %button{ title: "Rechercher" } = image_tag "icons/search-blue.svg" + + - if gestionnaire_signed_in? || user_signed_in? %li .header-menu-opener = image_tag "icons/account-circle.svg", onclick: "javascript:TPS.toggleHeaderMenu(event);", title: "Mon compte" From 3efcadd855166980c0ee0c9edaf2fcfe014d86f0 Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Wed, 21 Feb 2018 15:00:33 +0100 Subject: [PATCH 14/52] [Fix #1164] Do not show profile switcher for current profile --- app/views/layouts/_new_header.haml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/layouts/_new_header.haml b/app/views/layouts/_new_header.haml index 2bdc8be3e..bfab4a5e9 100644 --- a/app/views/layouts/_new_header.haml +++ b/app/views/layouts/_new_header.haml @@ -53,17 +53,17 @@ = image_tag "icons/super-admin.svg" Passer en super-admin - if SwitchDeviseProfileService.new(warden).multiple_devise_profile_connect? - - if user_signed_in? + - if user_signed_in? && nav_bar_profile != :usager %li = link_to users_dossiers_path, class: "menu-item menu-link" do = image_tag "icons/switch-profile.svg" Passer en usager - - if gestionnaire_signed_in? + - if gestionnaire_signed_in? && nav_bar_profile != :gestionnaire %li = link_to procedures_path, class: "menu-item menu-link" do = image_tag "icons/switch-profile.svg" Passer en accompagnateur - - if administrateur_signed_in? + - if administrateur_signed_in? && nav_bar_profile != :administrateur %li = link_to admin_procedures_path, class: "menu-item menu-link" do = image_tag "icons/switch-profile.svg" From 49bb4f0b54d59050744621224a32f21e4346da63 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Tue, 20 Feb 2018 12:24:37 +0100 Subject: [PATCH 15/52] Set `processed_at` on auto received dossiers Closes #1089 --- ...auto_receive_dossiers_for_procedure_job.rb | 20 ++++++-- ...receive_dossiers_for_procedure_job_spec.rb | 49 ++++++++++++++----- 2 files changed, 55 insertions(+), 14 deletions(-) diff --git a/app/jobs/auto_receive_dossiers_for_procedure_job.rb b/app/jobs/auto_receive_dossiers_for_procedure_job.rb index 6fa5968ac..ee04c9cbb 100644 --- a/app/jobs/auto_receive_dossiers_for_procedure_job.rb +++ b/app/jobs/auto_receive_dossiers_for_procedure_job.rb @@ -2,9 +2,23 @@ class AutoReceiveDossiersForProcedureJob < ApplicationJob queue_as :cron def perform(procedure_id, state) - procedure = Procedure.find_by(id: procedure_id) - if procedure - procedure.dossiers.state_en_construction.update_all(state: state, en_instruction_at: Time.now) + procedure = Procedure.find(procedure_id) + attrs = case state + when :en_instruction + { + state: :en_instruction, + en_instruction_at: DateTime.now + } + when :accepte + { + state: :accepte, + en_instruction_at: DateTime.now, + processed_at: DateTime.now + } + else + raise "Receiving Procedure##{procedure_id} in invalid state \"#{state}\"" end + + procedure.dossiers.state_en_construction.update_all(attrs) end end diff --git a/spec/jobs/auto_receive_dossiers_for_procedure_job_spec.rb b/spec/jobs/auto_receive_dossiers_for_procedure_job_spec.rb index 0de95f720..a7a546b43 100644 --- a/spec/jobs/auto_receive_dossiers_for_procedure_job_spec.rb +++ b/spec/jobs/auto_receive_dossiers_for_procedure_job_spec.rb @@ -7,7 +7,7 @@ RSpec.describe AutoReceiveDossiersForProcedureJob, type: :job do before { Timecop.freeze(date) } after { Timecop.return } - subject { AutoReceiveDossiersForProcedureJob.new.perform(procedure_id, 'en_instruction') } + subject { AutoReceiveDossiersForProcedureJob.new.perform(procedure_id, state) } context "with some dossiers" do let(:nouveau_dossier1) { create(:dossier, :en_construction) } @@ -16,19 +16,46 @@ RSpec.describe AutoReceiveDossiersForProcedureJob, type: :job do let(:dossier_brouillon) { create(:dossier, procedure: dossier_recu.procedure) } let(:procedure_id) { dossier_brouillon.procedure_id } - it do - subject - expect(nouveau_dossier1.reload.en_instruction?).to be true - expect(nouveau_dossier1.reload.en_instruction_at).to eq(date) + context "en_construction" do + let(:state) { :en_instruction } - expect(nouveau_dossier2.reload.en_instruction?).to be true - expect(nouveau_dossier2.reload.en_instruction_at).to eq(date) + it do + subject + expect(nouveau_dossier1.reload.en_instruction?).to be true + expect(nouveau_dossier1.reload.en_instruction_at).to eq(date) - expect(dossier_recu.reload.en_instruction?).to be true - expect(dossier_recu.reload.en_instruction_at).to eq(date) + expect(nouveau_dossier2.reload.en_instruction?).to be true + expect(nouveau_dossier2.reload.en_instruction_at).to eq(date) - expect(dossier_brouillon.reload.brouillon?).to be true - expect(dossier_brouillon.reload.en_instruction_at).to eq(nil) + expect(dossier_recu.reload.en_instruction?).to be true + expect(dossier_recu.reload.en_instruction_at).to eq(date) + + expect(dossier_brouillon.reload.brouillon?).to be true + expect(dossier_brouillon.reload.en_instruction_at).to eq(nil) + end + end + + context "accepte" do + let(:state) { :accepte } + + it do + subject + expect(nouveau_dossier1.reload.accepte?).to be true + expect(nouveau_dossier1.reload.en_instruction_at).to eq(date) + expect(nouveau_dossier1.reload.processed_at).to eq(date) + + expect(nouveau_dossier2.reload.accepte?).to be true + expect(nouveau_dossier2.reload.en_instruction_at).to eq(date) + expect(nouveau_dossier2.reload.processed_at).to eq(date) + + expect(dossier_recu.reload.en_instruction?).to be true + expect(dossier_recu.reload.en_instruction_at).to eq(date) + expect(dossier_recu.reload.processed_at).to eq(nil) + + expect(dossier_brouillon.reload.brouillon?).to be true + expect(dossier_brouillon.reload.en_instruction_at).to eq(nil) + expect(dossier_brouillon.reload.processed_at).to eq(nil) + end end end end From d9d31214fe3a06663795f84653a96c54ad30c476 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Tue, 20 Feb 2018 16:21:41 +0100 Subject: [PATCH 16/52] =?UTF-8?q?Moulinette=E2=84=A2=20for=20unprocessed?= =?UTF-8?q?=20accepted=20dossiers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/2018_02_20_set_processed_at.rake | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 lib/tasks/2018_02_20_set_processed_at.rake diff --git a/lib/tasks/2018_02_20_set_processed_at.rake b/lib/tasks/2018_02_20_set_processed_at.rake new file mode 100644 index 000000000..2282e7f94 --- /dev/null +++ b/lib/tasks/2018_02_20_set_processed_at.rake @@ -0,0 +1,7 @@ +namespace :'2018_02_20_set_processed_at' do + task set: :environment do + Dossier.where(state: :accepte, processed_at: nil).find_each do |dossier| + dossier.update_column(:processed_at, dossier.en_instruction_at) + end + end +end From 0c6aa42f558d07c4acf3f36147323e6120911adc Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Wed, 21 Feb 2018 17:40:41 +0100 Subject: [PATCH 17/52] [Fix #1454] Send weekly overview emails async, overview param is not correctly serialized by activejob so it is computed again when email is send --- .rubocop.yml | 2 +- app/jobs/weekly_overview_job.rb | 2 +- app/mailers/gestionnaire_mailer.rb | 3 ++- spec/jobs/weekly_overview_job_spec.rb | 6 +++--- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index fa0601957..d356d2312 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -523,7 +523,7 @@ Performance/FlatMap: Enabled: true Performance/HashEachMethods: - Enabled: true + Enabled: false Performance/LstripRstrip: Enabled: true diff --git a/app/jobs/weekly_overview_job.rb b/app/jobs/weekly_overview_job.rb index e8bcd7b46..856449264 100644 --- a/app/jobs/weekly_overview_job.rb +++ b/app/jobs/weekly_overview_job.rb @@ -7,7 +7,7 @@ class WeeklyOverviewJob < ApplicationJob Gestionnaire.all .map { |gestionnaire| [gestionnaire, gestionnaire.last_week_overview] } .reject { |_, overview| overview.nil? } - .each { |gestionnaire, overview| GestionnaireMailer.last_week_overview(gestionnaire, overview).deliver_now } + .each { |gestionnaire, _| GestionnaireMailer.last_week_overview(gestionnaire).deliver_later } end end end diff --git a/app/mailers/gestionnaire_mailer.rb b/app/mailers/gestionnaire_mailer.rb index 24718a766..e6e9cc30b 100644 --- a/app/mailers/gestionnaire_mailer.rb +++ b/app/mailers/gestionnaire_mailer.rb @@ -5,8 +5,9 @@ class GestionnaireMailer < ApplicationMailer send_mail email, password, "Vous avez été nommé accompagnateur sur la plateforme TPS" end - def last_week_overview(gestionnaire, overview) + def last_week_overview(gestionnaire) headers['X-mailjet-campaign'] = 'last_week_overview' + overview = gestionnaire.last_week_overview send_mail gestionnaire.email, overview, 'Vos activités sur TPS' end diff --git a/spec/jobs/weekly_overview_job_spec.rb b/spec/jobs/weekly_overview_job_spec.rb index b0a133f35..a051baa04 100644 --- a/spec/jobs/weekly_overview_job_spec.rb +++ b/spec/jobs/weekly_overview_job_spec.rb @@ -4,7 +4,7 @@ RSpec.describe WeeklyOverviewJob, type: :job do describe 'perform' do let!(:gestionnaire) { create(:gestionnaire) } let(:overview) { double('overview') } - let(:mailer_double) { double('mailer', deliver_now: true) } + let(:mailer_double) { double('mailer', deliver_later: true) } context 'if the feature is enabled' do before { allow(Features).to receive(:weekly_overview).and_return(true) } @@ -16,8 +16,8 @@ RSpec.describe WeeklyOverviewJob, type: :job do WeeklyOverviewJob.new.perform end - it { expect(GestionnaireMailer).to have_received(:last_week_overview).with(gestionnaire, overview) } - it { expect(mailer_double).to have_received(:deliver_now) } + it { expect(GestionnaireMailer).to have_received(:last_week_overview).with(gestionnaire) } + it { expect(mailer_double).to have_received(:deliver_later) } end context 'with one gestionnaire with no overviews' do From 1bc93b7235e76910ec2ac5f54e738bbebbfd24ed Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Thu, 22 Feb 2018 10:28:24 +0100 Subject: [PATCH 18/52] [Fix #1456] When job crashed notify Sentry --- app/jobs/application_job.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index e2924fc30..8886fc6ba 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -6,4 +6,8 @@ class ApplicationJob < ActiveJob::Base after_perform do |job| Rails.logger.info("#{job.class.name} ended at #{Time.now}") end + + def error(job, exception) + Raven.capture_exception(exception) + end end From c876d5e5a2a44e5b2aba55037224d55e07cc938f Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Thu, 22 Feb 2018 15:50:35 +0100 Subject: [PATCH 19/52] Lock ffi version to fix builds on Mac --- Gemfile | 3 +++ Gemfile.lock | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 56d0d936f..68f3b6576 100644 --- a/Gemfile +++ b/Gemfile @@ -2,6 +2,9 @@ source 'https://rubygems.org' gem 'rails', '~> 5.2.0.rc1' +# Temporary lock ffi version. Read more: https://github.com/ffi/ffi/commit/0fef6d44d09018d03c24af7fa4f9fcd38f36b642 +gem 'ffi', '1.9.18' + # Use SCSS for stylesheets gem 'sass-rails' # Use Uglifier as compressor for JavaScript assets diff --git a/Gemfile.lock b/Gemfile.lock index cb3c0a052..f3ad4d067 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -202,7 +202,7 @@ GEM activesupport (>= 3.0.0) faraday (0.12.2) multipart-post (>= 1.2, < 3) - ffi (1.9.21) + ffi (1.9.18) fission (0.5.0) CFPropertyList (~> 2.2) fog (1.41.0) @@ -789,6 +789,7 @@ DEPENDENCIES dotenv-rails draper factory_bot + ffi (= 1.9.18) fog fog-openstack font-awesome-rails From 47ae94e0a0d74df9aa5b854748b63850939e1108 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 13:09:39 +0100 Subject: [PATCH 20/52] Route: prefix gestionnaire routes --- config/routes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index 8a2155b5b..6f0b37d8c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -210,7 +210,7 @@ Rails.application.routes.draw do end end - scope module: 'new_gestionnaire' do + scope module: 'new_gestionnaire', as: 'gestionnaire' do resources :procedures, only: [:index, :show], param: :procedure_id do member do patch 'update_displayed_fields' From b76237d2ad30b14e764dda7d04d425f7a6dfecb3 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 13:42:10 +0100 Subject: [PATCH 21/52] Gestionnaire: move update_displayed_fields_procedure_path to update_displayed_fields_gestionnaire_procedure_path --- app/views/new_gestionnaire/procedures/show.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/new_gestionnaire/procedures/show.html.haml b/app/views/new_gestionnaire/procedures/show.html.haml index b0c4762ef..c4aed01e4 100644 --- a/app/views/new_gestionnaire/procedures/show.html.haml +++ b/app/views/new_gestionnaire/procedures/show.html.haml @@ -82,7 +82,7 @@ %span.button.dropdown Personnaliser .dropdown-content.fade-in-down - = form_tag update_displayed_fields_procedure_path(@procedure), method: :patch, class: 'dropdown-form' do + = form_tag update_displayed_fields_gestionnaire_procedure_path(@procedure), method: :patch, class: 'dropdown-form' do = select_tag :values, options_for_select(@procedure.fields_for_select, selected: @displayed_fields_values), From c0229813f1d19b06b20af8521892132df0d0503a Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 13:42:10 +0100 Subject: [PATCH 22/52] Gestionnaire: move update_sort_procedure_path to update_sort_gestionnaire_procedure_path --- app/views/new_gestionnaire/procedures/_header_field.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/new_gestionnaire/procedures/_header_field.html.haml b/app/views/new_gestionnaire/procedures/_header_field.html.haml index f55e51507..10cdcb1fb 100644 --- a/app/views/new_gestionnaire/procedures/_header_field.html.haml +++ b/app/views/new_gestionnaire/procedures/_header_field.html.haml @@ -1,5 +1,5 @@ %th{ class: classname } - = link_to update_sort_procedure_path(@procedure, table: field['table'], column: field['column']) do + = link_to update_sort_gestionnaire_procedure_path(@procedure, table: field['table'], column: field['column']) do = field['label'] - if @procedure_presentation.sort['table'] == field['table'] && @procedure_presentation.sort['column'] == field['column'] - if @procedure_presentation.sort['order'] == 'asc' From bbd31ec3a4cd35463dddb351e8bc2bd02480c026 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 13:42:11 +0100 Subject: [PATCH 23/52] Gestionnaire: move add_filter_procedure_path to add_filter_gestionnaire_procedure_path --- app/views/new_gestionnaire/procedures/show.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/new_gestionnaire/procedures/show.html.haml b/app/views/new_gestionnaire/procedures/show.html.haml index c4aed01e4..405fb0c70 100644 --- a/app/views/new_gestionnaire/procedures/show.html.haml +++ b/app/views/new_gestionnaire/procedures/show.html.haml @@ -47,7 +47,7 @@ %span.button.dropdown Filtrer .dropdown-content.left-aligned.fade-in-down - = form_tag add_filter_procedure_path(@procedure), method: :post, class: 'dropdown-form large' do + = form_tag add_filter_gestionnaire_procedure_path(@procedure), method: :post, class: 'dropdown-form large' do = label_tag :field, "Colonne" = select_tag :field, options_for_select(@available_fields_to_filters) %br From d1079fda8b26c0da8b8dc496c25bb0956635b718 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 13:42:11 +0100 Subject: [PATCH 24/52] Gestionnaire: move remove_filter_procedure_path to remove_filter_gestionnaire_procedure_path --- app/views/new_gestionnaire/procedures/show.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/new_gestionnaire/procedures/show.html.haml b/app/views/new_gestionnaire/procedures/show.html.haml index 405fb0c70..4570a35cf 100644 --- a/app/views/new_gestionnaire/procedures/show.html.haml +++ b/app/views/new_gestionnaire/procedures/show.html.haml @@ -60,7 +60,7 @@ - @current_filters.each do |filter| %span.filter = "#{filter['label']} : #{filter['value']}" - = link_to remove_filter_procedure_path(@procedure, statut: @statut, table: filter['table'], column: filter['column']) do + = link_to remove_filter_gestionnaire_procedure_path(@procedure, statut: @statut, table: filter['table'], column: filter['column']) do %img.close-icon{ src: image_url("close.svg") } %table.table.dossiers-table.hoverable From 7c364ce745d603c1ae8a6ce958883924a1f0d7e0 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 13:42:11 +0100 Subject: [PATCH 25/52] Gestionnaire: move download_dossiers_procedure_path to download_dossiers_gestionnaire_procedure_path --- .../procedures/_download_dossiers.html.haml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/new_gestionnaire/procedures/_download_dossiers.html.haml b/app/views/new_gestionnaire/procedures/_download_dossiers.html.haml index c3771011f..2bd2137d5 100644 --- a/app/views/new_gestionnaire/procedures/_download_dossiers.html.haml +++ b/app/views/new_gestionnaire/procedures/_download_dossiers.html.haml @@ -4,8 +4,8 @@ .dropdown-content.fade-in-down %ul.dropdown-items %li - = link_to "Au format .csv", download_dossiers_procedure_path(format: :csv, procedure_id: procedure.id), target: "_blank" + = link_to "Au format .csv", download_dossiers_gestionnaire_procedure_path(format: :csv, procedure_id: procedure.id), target: "_blank" %li - = link_to "Au format .xlsx", download_dossiers_procedure_path(format: :xlsx, procedure_id: procedure.id), target: "_blank" + = link_to "Au format .xlsx", download_dossiers_gestionnaire_procedure_path(format: :xlsx, procedure_id: procedure.id), target: "_blank" %li - = link_to "Au format .ods", download_dossiers_procedure_path(format: :ods, procedure_id: procedure.id), target: "_blank" + = link_to "Au format .ods", download_dossiers_gestionnaire_procedure_path(format: :ods, procedure_id: procedure.id), target: "_blank" From be191a680e2d33c54180e94c5c5f9a1b90300e6b Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 13:42:11 +0100 Subject: [PATCH 26/52] Gestionnaire: move messagerie_dossier_path to messagerie_gestionnaire_dossier_path --- app/controllers/new_gestionnaire/dossiers_controller.rb | 2 +- app/views/new_gestionnaire/dossiers/_header.html.haml | 4 ++-- spec/controllers/new_gestionnaire/dossiers_controller_spec.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/new_gestionnaire/dossiers_controller.rb b/app/controllers/new_gestionnaire/dossiers_controller.rb index d5e9c1106..a8aeb5647 100644 --- a/app/controllers/new_gestionnaire/dossiers_controller.rb +++ b/app/controllers/new_gestionnaire/dossiers_controller.rb @@ -135,7 +135,7 @@ module NewGestionnaire if @commentaire.save current_gestionnaire.follow(dossier) flash.notice = "Message envoyé" - redirect_to messagerie_dossier_path(procedure, dossier) + redirect_to messagerie_gestionnaire_dossier_path(procedure, dossier) else flash.alert = @commentaire.errors.full_messages render :messagerie diff --git a/app/views/new_gestionnaire/dossiers/_header.html.haml b/app/views/new_gestionnaire/dossiers/_header.html.haml index 86da385f8..0008a0794 100644 --- a/app/views/new_gestionnaire/dossiers/_header.html.haml +++ b/app/views/new_gestionnaire/dossiers/_header.html.haml @@ -31,10 +31,10 @@ - if notifications_summary[:avis] %span.notifications{ 'aria-label': 'notifications' } = link_to "Avis externes", avis_dossier_path(dossier.procedure, dossier) - %li{ class: current_page?(messagerie_dossier_path(dossier.procedure, dossier)) ? 'active' : nil } + %li{ class: current_page?(messagerie_gestionnaire_dossier_path(dossier.procedure, dossier)) ? 'active' : nil } - if notifications_summary[:messagerie] %span.notifications{ 'aria-label': 'notifications' } - = link_to "Messagerie", messagerie_dossier_path(dossier.procedure, dossier) + = link_to "Messagerie", messagerie_gestionnaire_dossier_path(dossier.procedure, dossier) %li{ class: current_page?(personnes_impliquees_dossier_path(dossier.procedure, dossier)) ? 'active' : nil } = link_to "Personnes impliquées", personnes_impliquees_dossier_path(dossier.procedure, dossier) diff --git a/spec/controllers/new_gestionnaire/dossiers_controller_spec.rb b/spec/controllers/new_gestionnaire/dossiers_controller_spec.rb index be6329132..4411fbdff 100644 --- a/spec/controllers/new_gestionnaire/dossiers_controller_spec.rb +++ b/spec/controllers/new_gestionnaire/dossiers_controller_spec.rb @@ -307,7 +307,7 @@ describe NewGestionnaire::DossiersController, type: :controller do expect(saved_commentaire.body).to eq("

avant\n
apres

") expect(saved_commentaire.email).to eq(gestionnaire.email) expect(saved_commentaire.dossier).to eq(dossier) - expect(response).to redirect_to(messagerie_dossier_path(dossier.procedure, dossier)) + expect(response).to redirect_to(messagerie_gestionnaire_dossier_path(dossier.procedure, dossier)) expect(gestionnaire.followed_dossiers).to include(dossier) expect(saved_commentaire.file.present?).to eq(false) end From 87a4029f1a999799f43e68b9894dbf2eb0f5a1b9 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 13:42:11 +0100 Subject: [PATCH 27/52] Gestionnaire: move annotations_privees_dossier_path to annotations_privees_gestionnaire_dossier_path --- app/controllers/new_gestionnaire/dossiers_controller.rb | 2 +- app/views/new_gestionnaire/dossiers/_header.html.haml | 4 ++-- spec/controllers/new_gestionnaire/dossiers_controller_spec.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/new_gestionnaire/dossiers_controller.rb b/app/controllers/new_gestionnaire/dossiers_controller.rb index a8aeb5647..4760a23f6 100644 --- a/app/controllers/new_gestionnaire/dossiers_controller.rb +++ b/app/controllers/new_gestionnaire/dossiers_controller.rb @@ -167,7 +167,7 @@ module NewGestionnaire dossier = current_gestionnaire.dossiers.includes(champs_private: :type_de_champ).find(params[:dossier_id]) # FIXME: add attachements validation, cf. Champ#piece_justificative_file_errors dossier.update_attributes(champs_private_params) - redirect_to annotations_privees_dossier_path(procedure, dossier) + redirect_to annotations_privees_gestionnaire_dossier_path(procedure, dossier) end def print diff --git a/app/views/new_gestionnaire/dossiers/_header.html.haml b/app/views/new_gestionnaire/dossiers/_header.html.haml index 0008a0794..df48dae9e 100644 --- a/app/views/new_gestionnaire/dossiers/_header.html.haml +++ b/app/views/new_gestionnaire/dossiers/_header.html.haml @@ -23,10 +23,10 @@ - if notifications_summary[:demande] %span.notifications{ 'aria-label': 'notifications' } = link_to "Demande", dossier_path(dossier.procedure, dossier) - %li{ class: current_page?(annotations_privees_dossier_path(dossier.procedure, dossier)) ? 'active' : nil } + %li{ class: current_page?(annotations_privees_gestionnaire_dossier_path(dossier.procedure, dossier)) ? 'active' : nil } - if notifications_summary[:annotations_privees] %span.notifications{ 'aria-label': 'notifications' } - = link_to "Annotations privées", annotations_privees_dossier_path(dossier.procedure, dossier) + = link_to "Annotations privées", annotations_privees_gestionnaire_dossier_path(dossier.procedure, dossier) %li{ class: current_page?(avis_dossier_path(dossier.procedure, dossier)) ? 'active' : nil } - if notifications_summary[:avis] %span.notifications{ 'aria-label': 'notifications' } diff --git a/spec/controllers/new_gestionnaire/dossiers_controller_spec.rb b/spec/controllers/new_gestionnaire/dossiers_controller_spec.rb index 4411fbdff..dfe7ef057 100644 --- a/spec/controllers/new_gestionnaire/dossiers_controller_spec.rb +++ b/spec/controllers/new_gestionnaire/dossiers_controller_spec.rb @@ -394,6 +394,6 @@ describe NewGestionnaire::DossiersController, type: :controller do it { expect(champ_multiple_drop_down_list.value).to eq('["un", "deux"]') } it { expect(champ_datetime.value).to eq('21/12/2019 13:17') } - it { expect(response).to redirect_to(annotations_privees_dossier_path(dossier.procedure, dossier)) } + it { expect(response).to redirect_to(annotations_privees_gestionnaire_dossier_path(dossier.procedure, dossier)) } end end From 63163e5022197597a52c57793467f786405ef335 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 13:42:11 +0100 Subject: [PATCH 28/52] Gestionnaire: move avis_dossier_path to avis_gestionnaire_dossier_path --- app/controllers/new_gestionnaire/dossiers_controller.rb | 2 +- app/views/new_gestionnaire/dossiers/_header.html.haml | 4 ++-- app/views/new_gestionnaire/dossiers/avis.html.haml | 2 +- spec/controllers/new_gestionnaire/dossiers_controller_spec.rb | 2 +- spec/features/new_gestionnaire/gestionnaire_spec.rb | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/controllers/new_gestionnaire/dossiers_controller.rb b/app/controllers/new_gestionnaire/dossiers_controller.rb index 4760a23f6..a986538fa 100644 --- a/app/controllers/new_gestionnaire/dossiers_controller.rb +++ b/app/controllers/new_gestionnaire/dossiers_controller.rb @@ -160,7 +160,7 @@ module NewGestionnaire def create_avis Avis.create(avis_params.merge(claimant: current_gestionnaire, dossier: dossier)) - redirect_to avis_dossier_path(procedure, dossier) + redirect_to avis_gestionnaire_dossier_path(procedure, dossier) end def update_annotations diff --git a/app/views/new_gestionnaire/dossiers/_header.html.haml b/app/views/new_gestionnaire/dossiers/_header.html.haml index df48dae9e..27c1dd6fd 100644 --- a/app/views/new_gestionnaire/dossiers/_header.html.haml +++ b/app/views/new_gestionnaire/dossiers/_header.html.haml @@ -27,10 +27,10 @@ - if notifications_summary[:annotations_privees] %span.notifications{ 'aria-label': 'notifications' } = link_to "Annotations privées", annotations_privees_gestionnaire_dossier_path(dossier.procedure, dossier) - %li{ class: current_page?(avis_dossier_path(dossier.procedure, dossier)) ? 'active' : nil } + %li{ class: current_page?(avis_gestionnaire_dossier_path(dossier.procedure, dossier)) ? 'active' : nil } - if notifications_summary[:avis] %span.notifications{ 'aria-label': 'notifications' } - = link_to "Avis externes", avis_dossier_path(dossier.procedure, dossier) + = link_to "Avis externes", avis_gestionnaire_dossier_path(dossier.procedure, dossier) %li{ class: current_page?(messagerie_gestionnaire_dossier_path(dossier.procedure, dossier)) ? 'active' : nil } - if notifications_summary[:messagerie] %span.notifications{ 'aria-label': 'notifications' } diff --git a/app/views/new_gestionnaire/dossiers/avis.html.haml b/app/views/new_gestionnaire/dossiers/avis.html.haml index 89e09fae6..87ce6b25a 100644 --- a/app/views/new_gestionnaire/dossiers/avis.html.haml +++ b/app/views/new_gestionnaire/dossiers/avis.html.haml @@ -3,6 +3,6 @@ = render partial: "header", locals: { dossier: @dossier } .container - = render partial: "new_gestionnaire/shared/avis/form", locals: { url: avis_dossier_path(@dossier.procedure, @dossier), must_be_confidentiel: false } + = render partial: "new_gestionnaire/shared/avis/form", locals: { url: avis_gestionnaire_dossier_path(@dossier.procedure, @dossier), must_be_confidentiel: false } = render partial: 'new_gestionnaire/shared/avis/list', locals: { avis: @dossier.avis, avis_seen_at: @avis_seen_at } diff --git a/spec/controllers/new_gestionnaire/dossiers_controller_spec.rb b/spec/controllers/new_gestionnaire/dossiers_controller_spec.rb index dfe7ef057..5b1f5354a 100644 --- a/spec/controllers/new_gestionnaire/dossiers_controller_spec.rb +++ b/spec/controllers/new_gestionnaire/dossiers_controller_spec.rb @@ -350,7 +350,7 @@ describe NewGestionnaire::DossiersController, type: :controller do it { expect(saved_avis.confidentiel).to eq(true) } it { expect(saved_avis.dossier).to eq(dossier) } it { expect(saved_avis.claimant).to eq(gestionnaire) } - it { expect(response).to redirect_to(avis_dossier_path(dossier.procedure, dossier)) } + it { expect(response).to redirect_to(avis_gestionnaire_dossier_path(dossier.procedure, dossier)) } end describe "#update_annotations" do diff --git a/spec/features/new_gestionnaire/gestionnaire_spec.rb b/spec/features/new_gestionnaire/gestionnaire_spec.rb index cd9f01d41..a2a59d601 100644 --- a/spec/features/new_gestionnaire/gestionnaire_spec.rb +++ b/spec/features/new_gestionnaire/gestionnaire_spec.rb @@ -63,7 +63,7 @@ feature 'The gestionnaire part' do click_on dossier.user.email click_on 'Avis externes' - expect(page).to have_current_path(avis_dossier_path(procedure, dossier)) + expect(page).to have_current_path(avis_gestionnaire_dossier_path(procedure, dossier)) expert_email = 'expert@tps.com' ask_confidential_avis(expert_email, 'a good introduction') @@ -115,7 +115,7 @@ feature 'The gestionnaire part' do click_on dossier.user.email click_on 'Avis externes' - expect(page).to have_current_path(avis_dossier_path(procedure, dossier)) + expect(page).to have_current_path(avis_gestionnaire_dossier_path(procedure, dossier)) expert_email = 'expert@tps.com' ask_confidential_avis(expert_email, 'a good introduction') From a416efc49a81c7613764e1fa9d8a01d45478d4f7 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 13:42:11 +0100 Subject: [PATCH 29/52] Gestionnaire: move personnes_impliquees_dossier_path to personnes_impliquees_gestionnaire_dossier_path --- app/controllers/new_gestionnaire/dossiers_controller.rb | 2 +- app/views/new_gestionnaire/dossiers/_header.html.haml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/new_gestionnaire/dossiers_controller.rb b/app/controllers/new_gestionnaire/dossiers_controller.rb index a986538fa..7bf31f9ac 100644 --- a/app/controllers/new_gestionnaire/dossiers_controller.rb +++ b/app/controllers/new_gestionnaire/dossiers_controller.rb @@ -40,7 +40,7 @@ module NewGestionnaire recipient = Gestionnaire.find(params[:recipient]) GestionnaireMailer.send_dossier(current_gestionnaire, dossier, recipient).deliver_later flash.notice = "Dossier envoyé" - redirect_to(personnes_impliquees_dossier_path(procedure, dossier)) + redirect_to(personnes_impliquees_gestionnaire_dossier_path(procedure, dossier)) end def follow diff --git a/app/views/new_gestionnaire/dossiers/_header.html.haml b/app/views/new_gestionnaire/dossiers/_header.html.haml index 27c1dd6fd..688f9444a 100644 --- a/app/views/new_gestionnaire/dossiers/_header.html.haml +++ b/app/views/new_gestionnaire/dossiers/_header.html.haml @@ -35,8 +35,8 @@ - if notifications_summary[:messagerie] %span.notifications{ 'aria-label': 'notifications' } = link_to "Messagerie", messagerie_gestionnaire_dossier_path(dossier.procedure, dossier) - %li{ class: current_page?(personnes_impliquees_dossier_path(dossier.procedure, dossier)) ? 'active' : nil } - = link_to "Personnes impliquées", personnes_impliquees_dossier_path(dossier.procedure, dossier) + %li{ class: current_page?(personnes_impliquees_gestionnaire_dossier_path(dossier.procedure, dossier)) ? 'active' : nil } + = link_to "Personnes impliquées", personnes_impliquees_gestionnaire_dossier_path(dossier.procedure, dossier) .container .print-header From b07516c41d678208104003e739ae3e12baf625ba Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 13:42:11 +0100 Subject: [PATCH 30/52] Gestionnaire: move follow_dossier_path to follow_gestionnaire_dossier_path --- .../new_gestionnaire/procedures/_dossier_actions.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/new_gestionnaire/procedures/_dossier_actions.html.haml b/app/views/new_gestionnaire/procedures/_dossier_actions.html.haml index 93a09f510..600f757bb 100644 --- a/app/views/new_gestionnaire/procedures/_dossier_actions.html.haml +++ b/app/views/new_gestionnaire/procedures/_dossier_actions.html.haml @@ -1,10 +1,10 @@ - if dossier.en_construction_ou_instruction? - if dossier_is_followed - = link_to unfollow_dossier_path(procedure, dossier), method: :patch, class: 'button' do + = link_to unfollow_gestionnaire_dossier_path(procedure, dossier), method: :patch, class: 'button' do %span.icon.unfollow> Ne plus suivre - else - = link_to follow_dossier_path(procedure, dossier), method: :patch, class: 'button' do + = link_to follow_gestionnaire_dossier_path(procedure, dossier), method: :patch, class: 'button' do %span.icon.follow> Suivre le dossier From 129ebdd40311f81c3bcfb52707ab8f5afc7db093 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 13:42:11 +0100 Subject: [PATCH 31/52] Gestionnaire: move archive_dossier_path to archive_gestionnaire_dossier_path --- .../new_gestionnaire/procedures/_dossier_actions.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/new_gestionnaire/procedures/_dossier_actions.html.haml b/app/views/new_gestionnaire/procedures/_dossier_actions.html.haml index 600f757bb..12ac4eff3 100644 --- a/app/views/new_gestionnaire/procedures/_dossier_actions.html.haml +++ b/app/views/new_gestionnaire/procedures/_dossier_actions.html.haml @@ -10,10 +10,10 @@ - elsif dossier.termine? - if dossier.archived - = link_to unarchive_dossier_path(procedure, dossier), method: :patch, class: 'button' do + = link_to unarchive_gestionnaire_dossier_path(procedure, dossier), method: :patch, class: 'button' do %span.icon.unarchive> Désarchiver le dossier - else - = link_to archive_dossier_path(procedure, dossier), method: :patch, class: 'button' do + = link_to archive_gestionnaire_dossier_path(procedure, dossier), method: :patch, class: 'button' do %span.icon.archive> Archiver le dossier From c0793751faa576a4ef18bfa2f3b6a76e0e645609 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 13:42:11 +0100 Subject: [PATCH 32/52] Gestionnaire: move annotations_dossier_path to annotations_gestionnaire_dossier_path --- .../new_gestionnaire/dossiers/annotations_privees.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/new_gestionnaire/dossiers/annotations_privees.html.haml b/app/views/new_gestionnaire/dossiers/annotations_privees.html.haml index 56e44d905..2770eac7e 100644 --- a/app/views/new_gestionnaire/dossiers/annotations_privees.html.haml +++ b/app/views/new_gestionnaire/dossiers/annotations_privees.html.haml @@ -5,7 +5,7 @@ #dossier-annotations-privees.container - if @dossier.ordered_champs_private.present? %section - = form_for @dossier, url: annotations_dossier_path(@dossier.procedure, @dossier), html: { class: 'form' } do |f| + = form_for @dossier, url: annotations_gestionnaire_dossier_path(@dossier.procedure, @dossier), html: { class: 'form' } do |f| = f.fields_for :champs_private, f.object.ordered_champs_private do |champ_form| - champ = champ_form.object = render partial: "new_gestionnaire/dossiers/editable_champs/editable_champ", From 09c3064dd12c0c22580b38a56a6091174401b593 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 13:42:11 +0100 Subject: [PATCH 33/52] Gestionnaire: move commentaire_dossier_path to commentaire_gestionnaire_dossier_path --- app/views/new_gestionnaire/dossiers/messagerie.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/new_gestionnaire/dossiers/messagerie.html.haml b/app/views/new_gestionnaire/dossiers/messagerie.html.haml index b4e7176af..044d9f58e 100644 --- a/app/views/new_gestionnaire/dossiers/messagerie.html.haml +++ b/app/views/new_gestionnaire/dossiers/messagerie.html.haml @@ -2,4 +2,4 @@ = render partial: "header", locals: { dossier: @dossier } -= render partial: "new_gestionnaire/shared/messagerie", locals: { dossier: @dossier, messagerie_seen_at: @messagerie_seen_at , new_commentaire: @commentaire, form_url: commentaire_dossier_path(@dossier.procedure, @dossier) } += render partial: "new_gestionnaire/shared/messagerie", locals: { dossier: @dossier, messagerie_seen_at: @messagerie_seen_at , new_commentaire: @commentaire, form_url: commentaire_gestionnaire_dossier_path(@dossier.procedure, @dossier) } From ddff38452dfe307201da589b4592463f721835e7 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 13:42:11 +0100 Subject: [PATCH 34/52] Gestionnaire: move passer_en_instruction_dossier_path to passer_en_instruction_gestionnaire_dossier_path --- app/views/new_gestionnaire/dossiers/_state_button.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/new_gestionnaire/dossiers/_state_button.html.haml b/app/views/new_gestionnaire/dossiers/_state_button.html.haml index bbae9efb8..73aa946ca 100644 --- a/app/views/new_gestionnaire/dossiers/_state_button.html.haml +++ b/app/views/new_gestionnaire/dossiers/_state_button.html.haml @@ -10,7 +10,7 @@ %h4 En construction Vous permettez à l'usager de modifier ses réponses au formulaire %li - = link_to passer_en_instruction_dossier_path(dossier.procedure, dossier), method: :post, data: { confirm: "Confirmer vous le passage en instruction de ce dossier ?" } do + = link_to passer_en_instruction_gestionnaire_dossier_path(dossier.procedure, dossier), method: :post, data: { confirm: "Confirmer vous le passage en instruction de ce dossier ?" } do %span.icon.in-progress .description %h4 Passer en instruction From 7cd3ed3955d46133d34ad742980d7ebaadc7ded6 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 13:42:11 +0100 Subject: [PATCH 35/52] Gestionnaire: move repasser_en_construction_dossier_path to repasser_en_construction_gestionnaire_dossier_path --- app/views/new_gestionnaire/dossiers/_state_button.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/new_gestionnaire/dossiers/_state_button.html.haml b/app/views/new_gestionnaire/dossiers/_state_button.html.haml index 73aa946ca..0c8743cf0 100644 --- a/app/views/new_gestionnaire/dossiers/_state_button.html.haml +++ b/app/views/new_gestionnaire/dossiers/_state_button.html.haml @@ -18,7 +18,7 @@ - if dossier.en_instruction? %li - = link_to repasser_en_construction_dossier_path(dossier.procedure, dossier), method: :post, data: { confirm: "Confirmer vous le passage en construction de ce dossier ?" } do + = link_to repasser_en_construction_gestionnaire_dossier_path(dossier.procedure, dossier), method: :post, data: { confirm: "Confirmer vous le passage en construction de ce dossier ?" } do %span.icon.edit .description %h4 Repasser en construction From 1e341fefd012a245a787648659fa33c4f1e3a6af Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 13:42:11 +0100 Subject: [PATCH 36/52] Gestionnaire: move terminer_dossier_path to terminer_gestionnaire_dossier_path --- .../dossiers/_state_button_motivation.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/new_gestionnaire/dossiers/_state_button_motivation.html.haml b/app/views/new_gestionnaire/dossiers/_state_button_motivation.html.haml index c7e38f8f0..36c07865b 100644 --- a/app/views/new_gestionnaire/dossiers/_state_button_motivation.html.haml +++ b/app/views/new_gestionnaire/dossiers/_state_button_motivation.html.haml @@ -3,7 +3,7 @@ %span.icon{ class: popup_class } #{popup_title} - = form_tag(terminer_dossier_path(dossier.procedure, dossier), method: :post, class: 'form') do + = form_tag(terminer_gestionnaire_dossier_path(dossier.procedure, dossier), method: :post, class: 'form') do = text_area :dossier, :motivation, class: 'motivation-text-area', placeholder: 'Rédigez votre motivation ici (facultative)' - if title == 'Accepter' %p.help From df167dbfb9086a02b2fe459290ab2eee6fada417 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 13:42:11 +0100 Subject: [PATCH 37/52] Gestionnaire: move envoyer_a_accompagnateur_dossier_path to envoyer_a_accompagnateur_gestionnaire_dossier_path --- .../new_gestionnaire/dossiers/_envoyer_dossier_block.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/new_gestionnaire/dossiers/_envoyer_dossier_block.html.haml b/app/views/new_gestionnaire/dossiers/_envoyer_dossier_block.html.haml index fe4b705d8..bc5951438 100644 --- a/app/views/new_gestionnaire/dossiers/_envoyer_dossier_block.html.haml +++ b/app/views/new_gestionnaire/dossiers/_envoyer_dossier_block.html.haml @@ -4,7 +4,7 @@ %p.tab-paragraph Vous êtes le seul accompagnateur assigné sur cette procédure - else - = form_for dossier, url: envoyer_a_accompagnateur_dossier_path(dossier.procedure, dossier), method: :post, html: { class: 'form' } do |f| + = form_for dossier, url: envoyer_a_accompagnateur_gestionnaire_dossier_path(dossier.procedure, dossier), method: :post, html: { class: 'form' } do |f| .flex.justify-start.align-baseline = select_tag(:recipient, options_from_collection_for_select(potential_recipients, :id, :email)) = f.submit "Envoyer", class: "button large send gap-left" From 9c829422e0364f0a0e3a763a9c78eea71070e44b Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 13:42:11 +0100 Subject: [PATCH 38/52] Gestionnaire: move position_dossier_path to position_gestionnaire_dossier_path --- app/views/new_gestionnaire/dossiers/_map.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/new_gestionnaire/dossiers/_map.html.haml b/app/views/new_gestionnaire/dossiers/_map.html.haml index 92c0093b1..6ad0d9300 100644 --- a/app/views/new_gestionnaire/dossiers/_map.html.haml +++ b/app/views/new_gestionnaire/dossiers/_map.html.haml @@ -14,7 +14,7 @@ = "Parcelle n° #{p.numero} - Feuille #{p.code_arr} #{p.section} #{p.feuille}" :javascript - var getPositionUrl = "#{position_dossier_path(dossier.procedure, dossier)}"; + var getPositionUrl = "#{position_gestionnaire_dossier_path(dossier.procedure, dossier)}"; var dossierJsonLatLngs = #{dossier.json_latlngs}; var dossierCadastres = #{dossier.cadastres.to_json}; var dossierQuartiersPrioritaires = #{dossier.quartier_prioritaires.to_json}; From bdce6aff2e6457509926a2e51ce28af2c259c49a Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 13:42:12 +0100 Subject: [PATCH 39/52] Gestionnaire: move print_dossier_path to print_gestionnaire_dossier_path --- app/views/new_gestionnaire/dossiers/_header.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/new_gestionnaire/dossiers/_header.html.haml b/app/views/new_gestionnaire/dossiers/_header.html.haml index 688f9444a..2e8e9f6a3 100644 --- a/app/views/new_gestionnaire/dossiers/_header.html.haml +++ b/app/views/new_gestionnaire/dossiers/_header.html.haml @@ -11,7 +11,7 @@ %span.icon.printer %ul.print-menu %li - = link_to "Tout le dossier", print_dossier_path(dossier.procedure, dossier), target: "_blank", class: "menu-item menu-link" + = link_to "Tout le dossier", print_gestionnaire_dossier_path(dossier.procedure, dossier), target: "_blank", class: "menu-item menu-link" %li = link_to "Uniquement cet onglet", "#", onclick: "TPS.togglePrintMenu; window.print()", class: "menu-item menu-link" From c58b32a26d4409d9442d550dccb14a307e12f484 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 13:42:12 +0100 Subject: [PATCH 40/52] Gestionnaire: move instruction_avis_path to instruction_gestionnaire_avis_path --- app/controllers/new_gestionnaire/avis_controller.rb | 4 ++-- app/views/new_gestionnaire/avis/_header.html.haml | 4 ++-- spec/controllers/new_gestionnaire/avis_controller_spec.rb | 4 ++-- spec/features/new_gestionnaire/gestionnaire_spec.rb | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/controllers/new_gestionnaire/avis_controller.rb b/app/controllers/new_gestionnaire/avis_controller.rb index 9bb562ba5..a240178ae 100644 --- a/app/controllers/new_gestionnaire/avis_controller.rb +++ b/app/controllers/new_gestionnaire/avis_controller.rb @@ -34,7 +34,7 @@ module NewGestionnaire def update avis.update_attributes(avis_params) flash.notice = 'Votre réponse est enregistrée.' - redirect_to instruction_avis_path(avis) + redirect_to instruction_gestionnaire_avis_path(avis) end def messagerie @@ -56,7 +56,7 @@ module NewGestionnaire def create_avis confidentiel = avis.confidentiel || params[:avis][:confidentiel] Avis.create(create_avis_params.merge(claimant: current_gestionnaire, dossier: avis.dossier, confidentiel: confidentiel)) - redirect_to instruction_avis_path(avis) + redirect_to instruction_gestionnaire_avis_path(avis) end def sign_up diff --git a/app/views/new_gestionnaire/avis/_header.html.haml b/app/views/new_gestionnaire/avis/_header.html.haml index a801eb5b9..05ae187b7 100644 --- a/app/views/new_gestionnaire/avis/_header.html.haml +++ b/app/views/new_gestionnaire/avis/_header.html.haml @@ -7,8 +7,8 @@ %ul.tabs %li{ class: current_page?(avis_path(avis)) ? 'active' : nil } = link_to 'Demande', avis_path(avis) - %li{ class: current_page?(instruction_avis_path(avis)) ? 'active' : nil } - = link_to 'Avis', instruction_avis_path(avis) + %li{ class: current_page?(instruction_gestionnaire_avis_path(avis)) ? 'active' : nil } + = link_to 'Avis', instruction_gestionnaire_avis_path(avis) - if avis.answer == nil %span.notifications{ 'aria-label': 'notifications' } %li{ class: current_page?(messagerie_avis_path(avis)) ? 'active' : nil } diff --git a/spec/controllers/new_gestionnaire/avis_controller_spec.rb b/spec/controllers/new_gestionnaire/avis_controller_spec.rb index a7a94700e..5f5bf959d 100644 --- a/spec/controllers/new_gestionnaire/avis_controller_spec.rb +++ b/spec/controllers/new_gestionnaire/avis_controller_spec.rb @@ -58,7 +58,7 @@ describe NewGestionnaire::AvisController, type: :controller do avis_without_answer.reload end - it { expect(response).to redirect_to(instruction_avis_path(avis_without_answer)) } + it { expect(response).to redirect_to(instruction_gestionnaire_avis_path(avis_without_answer)) } it { expect(avis_without_answer.answer).to eq('answer') } it { expect(flash.notice).to eq('Votre réponse est enregistrée.') } end @@ -119,7 +119,7 @@ describe NewGestionnaire::AvisController, type: :controller do it { expect(created_avis.introduction).to eq(intro) } it { expect(created_avis.dossier).to eq(previous_avis.dossier) } it { expect(created_avis.claimant).to eq(gestionnaire) } - it { expect(response).to redirect_to(instruction_avis_path(previous_avis)) } + it { expect(response).to redirect_to(instruction_gestionnaire_avis_path(previous_avis)) } end context 'when the user asked for a confidentiel avis' do diff --git a/spec/features/new_gestionnaire/gestionnaire_spec.rb b/spec/features/new_gestionnaire/gestionnaire_spec.rb index a2a59d601..a6f633bd3 100644 --- a/spec/features/new_gestionnaire/gestionnaire_spec.rb +++ b/spec/features/new_gestionnaire/gestionnaire_spec.rb @@ -85,7 +85,7 @@ feature 'The gestionnaire part' do within(:css, '.tabs') do click_on 'Avis' end - expect(page).to have_current_path(instruction_avis_path(dossier.avis.first)) + expect(page).to have_current_path(instruction_gestionnaire_avis_path(dossier.avis.first)) within(:css, '.give-avis') do expect(page).to have_text("Demandeur : #{gestionnaire.email}") From 3b3849e4f34bc18fb8df3a5e359b332859ef5cb5 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 13:42:12 +0100 Subject: [PATCH 41/52] Gestionnaire: move messagerie_avis_path to messagerie_gestionnaire_avis_path --- app/controllers/new_gestionnaire/avis_controller.rb | 2 +- app/views/new_gestionnaire/avis/_header.html.haml | 4 ++-- spec/controllers/new_gestionnaire/avis_controller_spec.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/new_gestionnaire/avis_controller.rb b/app/controllers/new_gestionnaire/avis_controller.rb index a240178ae..169370cdc 100644 --- a/app/controllers/new_gestionnaire/avis_controller.rb +++ b/app/controllers/new_gestionnaire/avis_controller.rb @@ -46,7 +46,7 @@ module NewGestionnaire if @commentaire.save flash.notice = "Message envoyé" - redirect_to messagerie_avis_path(avis) + redirect_to messagerie_gestionnaire_avis_path(avis) else flash.alert = @commentaire.errors.full_messages render :messagerie diff --git a/app/views/new_gestionnaire/avis/_header.html.haml b/app/views/new_gestionnaire/avis/_header.html.haml index 05ae187b7..4186735f4 100644 --- a/app/views/new_gestionnaire/avis/_header.html.haml +++ b/app/views/new_gestionnaire/avis/_header.html.haml @@ -11,5 +11,5 @@ = link_to 'Avis', instruction_gestionnaire_avis_path(avis) - if avis.answer == nil %span.notifications{ 'aria-label': 'notifications' } - %li{ class: current_page?(messagerie_avis_path(avis)) ? 'active' : nil } - = link_to 'Messagerie', messagerie_avis_path(avis) + %li{ class: current_page?(messagerie_gestionnaire_avis_path(avis)) ? 'active' : nil } + = link_to 'Messagerie', messagerie_gestionnaire_avis_path(avis) diff --git a/spec/controllers/new_gestionnaire/avis_controller_spec.rb b/spec/controllers/new_gestionnaire/avis_controller_spec.rb index 5f5bf959d..e2e5ec3e4 100644 --- a/spec/controllers/new_gestionnaire/avis_controller_spec.rb +++ b/spec/controllers/new_gestionnaire/avis_controller_spec.rb @@ -76,7 +76,7 @@ describe NewGestionnaire::AvisController, type: :controller do it do subject - expect(response).to redirect_to(messagerie_avis_path(avis_without_answer)) + expect(response).to redirect_to(messagerie_gestionnaire_avis_path(avis_without_answer)) expect(dossier.commentaires.map(&:body)).to match(['commentaire body']) end From b59f9f6117c08869f7eda30816421e0366080b2b Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 13:42:12 +0100 Subject: [PATCH 42/52] Gestionnaire: move commentaire_avis_path to commentaire_gestionnaire_avis_path --- app/views/new_gestionnaire/avis/messagerie.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/new_gestionnaire/avis/messagerie.html.haml b/app/views/new_gestionnaire/avis/messagerie.html.haml index 571b4136c..58a4acbcf 100644 --- a/app/views/new_gestionnaire/avis/messagerie.html.haml +++ b/app/views/new_gestionnaire/avis/messagerie.html.haml @@ -2,4 +2,4 @@ = render partial: 'header', locals: { avis: @avis, dossier: @dossier } -= render partial: "new_gestionnaire/shared/messagerie", locals: { dossier: @dossier, messagerie_seen_at: nil, new_commentaire: @commentaire, form_url: commentaire_avis_path(@avis) } += render partial: "new_gestionnaire/shared/messagerie", locals: { dossier: @dossier, messagerie_seen_at: nil, new_commentaire: @commentaire, form_url: commentaire_gestionnaire_avis_path(@avis) } From c1bbe72dbdd38f969a0ba7b3c0a2b65f90563a9d Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 13:42:12 +0100 Subject: [PATCH 43/52] Gestionnaire: move sign_up_avis_path to sign_up_gestionnaire_avis_path --- app/controllers/new_gestionnaire/avis_controller.rb | 2 +- spec/controllers/new_gestionnaire/avis_controller_spec.rb | 2 +- spec/features/new_gestionnaire/gestionnaire_spec.rb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/new_gestionnaire/avis_controller.rb b/app/controllers/new_gestionnaire/avis_controller.rb index 169370cdc..84441723a 100644 --- a/app/controllers/new_gestionnaire/avis_controller.rb +++ b/app/controllers/new_gestionnaire/avis_controller.rb @@ -79,7 +79,7 @@ module NewGestionnaire redirect_to url_for(avis_index_path) else flash[:alert] = gestionnaire.errors.full_messages - redirect_to url_for(sign_up_avis_path(params[:id], email)) + redirect_to url_for(sign_up_gestionnaire_avis_path(params[:id], email)) end end diff --git a/spec/controllers/new_gestionnaire/avis_controller_spec.rb b/spec/controllers/new_gestionnaire/avis_controller_spec.rb index e2e5ec3e4..d95875bfc 100644 --- a/spec/controllers/new_gestionnaire/avis_controller_spec.rb +++ b/spec/controllers/new_gestionnaire/avis_controller_spec.rb @@ -250,7 +250,7 @@ describe NewGestionnaire::AvisController, type: :controller do let(:password) { '' } it { expect(created_gestionnaire).to be_nil } - it { is_expected.to redirect_to sign_up_avis_path(avis_id, invited_email) } + it { is_expected.to redirect_to sign_up_gestionnaire_avis_path(avis_id, invited_email) } it { expect(flash.alert).to eq(['Password : Le mot de passe est vide']) } end end diff --git a/spec/features/new_gestionnaire/gestionnaire_spec.rb b/spec/features/new_gestionnaire/gestionnaire_spec.rb index a6f633bd3..b147f8e97 100644 --- a/spec/features/new_gestionnaire/gestionnaire_spec.rb +++ b/spec/features/new_gestionnaire/gestionnaire_spec.rb @@ -71,7 +71,7 @@ feature 'The gestionnaire part' do log_out avis = dossier.avis.first - test_mail(expert_email, sign_up_avis_path(avis, expert_email)) + test_mail(expert_email, sign_up_gestionnaire_avis_path(avis, expert_email)) avis_sign_up(avis, expert_email, 'a good password') @@ -169,7 +169,7 @@ feature 'The gestionnaire part' do end def avis_sign_up(avis, email, password) - visit sign_up_avis_path(avis, email) + visit sign_up_gestionnaire_avis_path(avis, email) fill_in 'gestionnaire_password', with: 'a good password' click_on 'Créer un compte' expect(page).to have_current_path(avis_index_path) From a752627d00cbec87f5dd2dcec9495094e9a159f4 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 13:42:12 +0100 Subject: [PATCH 44/52] Gestionnaire: move recherche_path to gestionnaire_recherche_path --- app/views/layouts/_new_header.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/_new_header.haml b/app/views/layouts/_new_header.haml index bfab4a5e9..ab2d6a8f4 100644 --- a/app/views/layouts/_new_header.haml +++ b/app/views/layouts/_new_header.haml @@ -34,7 +34,7 @@ - if nav_bar_profile == :gestionnaire && gestionnaire_signed_in? %li .header-search - = form_tag recherche_path, method: :get, class: "form" do + = form_tag gestionnaire_recherche_path, method: :get, class: "form" do = text_field_tag "q", "#{@search_terms if @search_terms.present?}", placeholder: "Rechercher un dossier" %button{ title: "Rechercher" } = image_tag "icons/search-blue.svg" From 7bb8849d801156c596ce07d51424d294578bb28b Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 13:42:11 +0100 Subject: [PATCH 45/52] Gestionnaire: move attestation_dossier_path to attestation_gestionnaire_dossier_path --- app/views/dossiers/_attestation.html.haml | 2 +- app/views/new_gestionnaire/dossiers/_state_button.html.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/dossiers/_attestation.html.haml b/app/views/dossiers/_attestation.html.haml index 17e45cc86..2aba8551e 100644 --- a/app/views/dossiers/_attestation.html.haml +++ b/app/views/dossiers/_attestation.html.haml @@ -14,4 +14,4 @@ - if user_signed_in? && current_user == dossier.user = link_to 'Télécharger', dossier_attestation_path(dossier), target: '_blank', class: 'btn btn-primary' - else - = link_to 'Télécharger', attestation_dossier_path(dossier.procedure, dossier), target: '_blank', class: 'btn btn-primary' + = link_to 'Télécharger', attestation_gestionnaire_dossier_path(dossier.procedure, dossier), target: '_blank', class: 'btn btn-primary' diff --git a/app/views/new_gestionnaire/dossiers/_state_button.html.haml b/app/views/new_gestionnaire/dossiers/_state_button.html.haml index 0c8743cf0..06c0ac9d8 100644 --- a/app/views/new_gestionnaire/dossiers/_state_button.html.haml +++ b/app/views/new_gestionnaire/dossiers/_state_button.html.haml @@ -59,7 +59,7 @@ - if dossier.attestation.present? %h4 Attestation %p.attestation L'acceptation du dossier a envoyé automatiquement une attestation au demandeur - = link_to "Voir l'attestation", attestation_dossier_path(dossier.procedure, dossier), target: '_blank', class: 'button' + = link_to "Voir l'attestation", attestation_gestionnaire_dossier_path(dossier.procedure, dossier), target: '_blank', class: 'button' - else %span.label{ class: button_or_label_class(dossier) } = dossier.statut From 0dc101e375a386e85f8918f2d10a3ebe272226f3 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 14:40:41 +0100 Subject: [PATCH 46/52] Gestionnaire: move dossier_path gestionnaire_dossier_path --- .../new_gestionnaire/dossiers_controller.rb | 6 +++--- app/helpers/dossier_link_helper.rb | 2 +- .../new_gestionnaire/dossiers/_header.html.haml | 4 ++-- app/views/new_gestionnaire/procedures/show.html.haml | 8 ++++---- .../new_gestionnaire/dossiers_controller_spec.rb | 12 ++++++------ spec/features/new_gestionnaire/gestionnaire_spec.rb | 2 +- spec/helpers/dossier_link_helper_spec.rb | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/controllers/new_gestionnaire/dossiers_controller.rb b/app/controllers/new_gestionnaire/dossiers_controller.rb index 7bf31f9ac..878a406a2 100644 --- a/app/controllers/new_gestionnaire/dossiers_controller.rb +++ b/app/controllers/new_gestionnaire/dossiers_controller.rb @@ -72,14 +72,14 @@ module NewGestionnaire current_gestionnaire.follow(dossier) flash.notice = 'Dossier passé en instruction.' - redirect_to dossier_path(procedure, dossier) + redirect_to gestionnaire_dossier_path(procedure, dossier) end def repasser_en_construction dossier.en_construction! flash.notice = 'Dossier repassé en construction.' - redirect_to dossier_path(procedure, dossier) + redirect_to gestionnaire_dossier_path(procedure, dossier) end def terminer @@ -118,7 +118,7 @@ module NewGestionnaire NotificationMailer.send_notification(dossier, template, attestation_pdf).deliver_now! - redirect_to dossier_path(procedure, dossier) + redirect_to gestionnaire_dossier_path(procedure, dossier) end def create_commentaire diff --git a/app/helpers/dossier_link_helper.rb b/app/helpers/dossier_link_helper.rb index 0d46e0cb7..707f74c8b 100644 --- a/app/helpers/dossier_link_helper.rb +++ b/app/helpers/dossier_link_helper.rb @@ -1,7 +1,7 @@ module DossierLinkHelper def dossier_linked_path(gestionnaire, dossier) if dossier.procedure.gestionnaires.include?(gestionnaire) - dossier_path(dossier.procedure, dossier) + gestionnaire_dossier_path(dossier.procedure, dossier) else avis = dossier.avis.find_by(gestionnaire: gestionnaire) if avis.present? diff --git a/app/views/new_gestionnaire/dossiers/_header.html.haml b/app/views/new_gestionnaire/dossiers/_header.html.haml index 2e8e9f6a3..efeb63593 100644 --- a/app/views/new_gestionnaire/dossiers/_header.html.haml +++ b/app/views/new_gestionnaire/dossiers/_header.html.haml @@ -19,10 +19,10 @@ = render partial: "state_button", locals: { dossier: dossier } %ul.tabs - notifications_summary = current_gestionnaire.notifications_for_dossier(dossier) - %li{ class: current_page?(dossier_path(dossier.procedure, dossier)) ? 'active' : nil } + %li{ class: current_page?(gestionnaire_dossier_path(dossier.procedure, dossier)) ? 'active' : nil } - if notifications_summary[:demande] %span.notifications{ 'aria-label': 'notifications' } - = link_to "Demande", dossier_path(dossier.procedure, dossier) + = link_to "Demande", gestionnaire_dossier_path(dossier.procedure, dossier) %li{ class: current_page?(annotations_privees_gestionnaire_dossier_path(dossier.procedure, dossier)) ? 'active' : nil } - if notifications_summary[:annotations_privees] %span.notifications{ 'aria-label': 'notifications' } diff --git a/app/views/new_gestionnaire/procedures/show.html.haml b/app/views/new_gestionnaire/procedures/show.html.haml index 4570a35cf..b0b460876 100644 --- a/app/views/new_gestionnaire/procedures/show.html.haml +++ b/app/views/new_gestionnaire/procedures/show.html.haml @@ -94,22 +94,22 @@ - @dossiers.each do |dossier| %tr %td.folder-col - = link_to(dossier_path(@procedure, dossier), class: 'cell-link') do + = link_to(gestionnaire_dossier_path(@procedure, dossier), class: 'cell-link') do %span.icon.folder - if current_gestionnaire.notifications_for_procedure(@procedure, :not_archived).include?(dossier.id) %span.notifications{ 'aria-label': 'notifications' } %td.number-col - = link_to(dossier_path(@procedure, dossier), class: 'cell-link') do + = link_to(gestionnaire_dossier_path(@procedure, dossier), class: 'cell-link') do = dossier.id - @displayed_fields.each do |field| %td - = link_to(dossier_path(@procedure, dossier), class: 'cell-link') do + = link_to(gestionnaire_dossier_path(@procedure, dossier), class: 'cell-link') do = dossier.get_value(field['table'], field['column']) %td.status-col - = link_to(dossier_path(@procedure, dossier), class: 'cell-link') do + = link_to(gestionnaire_dossier_path(@procedure, dossier), class: 'cell-link') do = render partial: 'status', locals: { dossier: dossier } %td.follow-col= render partial: 'dossier_actions', locals: { procedure: @procedure, dossier: dossier, dossier_is_followed: @followed_dossiers_id.include?(dossier.id) } = paginate @dossiers diff --git a/spec/controllers/new_gestionnaire/dossiers_controller_spec.rb b/spec/controllers/new_gestionnaire/dossiers_controller_spec.rb index 5b1f5354a..71c0d59cf 100644 --- a/spec/controllers/new_gestionnaire/dossiers_controller_spec.rb +++ b/spec/controllers/new_gestionnaire/dossiers_controller_spec.rb @@ -112,7 +112,7 @@ describe NewGestionnaire::DossiersController, type: :controller do end it { expect(dossier.state).to eq('en_instruction') } - it { is_expected.to redirect_to dossier_path(procedure, dossier) } + it { is_expected.to redirect_to gestionnaire_dossier_path(procedure, dossier) } it { expect(gestionnaire.follow?(dossier)).to be true } end @@ -131,7 +131,7 @@ describe NewGestionnaire::DossiersController, type: :controller do expect(dossier.state).to eq('en_construction') end - it { is_expected.to redirect_to dossier_path(procedure, dossier) } + it { is_expected.to redirect_to gestionnaire_dossier_path(procedure, dossier) } end describe '#terminer' do @@ -158,7 +158,7 @@ describe NewGestionnaire::DossiersController, type: :controller do subject end - it { is_expected.to redirect_to redirect_to dossier_path(procedure, dossier) } + it { is_expected.to redirect_to redirect_to gestionnaire_dossier_path(procedure, dossier) } end context "with classer_sans_suite" do @@ -184,7 +184,7 @@ describe NewGestionnaire::DossiersController, type: :controller do subject end - it { is_expected.to redirect_to redirect_to dossier_path(procedure, dossier) } + it { is_expected.to redirect_to redirect_to gestionnaire_dossier_path(procedure, dossier) } end context "with accepter" do @@ -233,7 +233,7 @@ describe NewGestionnaire::DossiersController, type: :controller do it 'Notification email is sent with the attestation' do subject - is_expected.to redirect_to redirect_to dossier_path(procedure, dossier) + is_expected.to redirect_to redirect_to gestionnaire_dossier_path(procedure, dossier) end end @@ -246,7 +246,7 @@ describe NewGestionnaire::DossiersController, type: :controller do subject - is_expected.to redirect_to redirect_to dossier_path(procedure, dossier) + is_expected.to redirect_to redirect_to gestionnaire_dossier_path(procedure, dossier) end end end diff --git a/spec/features/new_gestionnaire/gestionnaire_spec.rb b/spec/features/new_gestionnaire/gestionnaire_spec.rb index b147f8e97..65292c2c2 100644 --- a/spec/features/new_gestionnaire/gestionnaire_spec.rb +++ b/spec/features/new_gestionnaire/gestionnaire_spec.rb @@ -16,7 +16,7 @@ feature 'The gestionnaire part' do expect(page).to have_current_path(procedure_path(procedure)) click_on dossier.user.email - expect(page).to have_current_path(dossier_path(procedure, dossier)) + expect(page).to have_current_path(gestionnaire_dossier_path(procedure, dossier)) click_on 'Passer en instruction' dossier.reload diff --git a/spec/helpers/dossier_link_helper_spec.rb b/spec/helpers/dossier_link_helper_spec.rb index 504524d5f..038ff6384 100644 --- a/spec/helpers/dossier_link_helper_spec.rb +++ b/spec/helpers/dossier_link_helper_spec.rb @@ -13,7 +13,7 @@ describe DossierLinkHelper do before { dossier.procedure.gestionnaires << gestionnaire } - it { expect(helper.dossier_linked_path(gestionnaire, dossier)).to eq(dossier_path(dossier.procedure, dossier)) } + it { expect(helper.dossier_linked_path(gestionnaire, dossier)).to eq(gestionnaire_dossier_path(dossier.procedure, dossier)) } end context "when access as expert" do From 4a70087f7afeb20a4f0f03b11b48086fcd18513e Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 14:50:52 +0100 Subject: [PATCH 47/52] Gestionnaire: move procedure_path gestionnaire_procedure_path --- .../new_gestionnaire/dossiers/_header.html.haml | 2 +- .../new_gestionnaire/procedures/index.html.haml | 12 ++++++------ app/views/new_gestionnaire/procedures/show.html.haml | 10 +++++----- spec/features/new_gestionnaire/gestionnaire_spec.rb | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/views/new_gestionnaire/dossiers/_header.html.haml b/app/views/new_gestionnaire/dossiers/_header.html.haml index efeb63593..ddeb9d4a5 100644 --- a/app/views/new_gestionnaire/dossiers/_header.html.haml +++ b/app/views/new_gestionnaire/dossiers/_header.html.haml @@ -3,7 +3,7 @@ .flex.justify-between %ul.breadcrumbs %li - = link_to dossier.procedure.libelle.truncate_words(10), procedure_path(dossier.procedure), title: dossier.procedure.libelle + = link_to dossier.procedure.libelle.truncate_words(10), gestionnaire_procedure_path(dossier.procedure), title: dossier.procedure.libelle %li = "Dossier nº #{dossier.id}" .mixed-buttons-bar diff --git a/app/views/new_gestionnaire/procedures/index.html.haml b/app/views/new_gestionnaire/procedures/index.html.haml index c4faed67a..a1f6782be 100644 --- a/app/views/new_gestionnaire/procedures/index.html.haml +++ b/app/views/new_gestionnaire/procedures/index.html.haml @@ -6,7 +6,7 @@ %ul.procedure-list - @procedures.each do |p| %li.procedure-item.flex.align-start - = link_to(procedure_path(p)) do + = link_to(gestionnaire_procedure_path(p)) do .flex .procedure-logo{ style: p.logo.present? ? "background-image: url(#{p.logo.url})" : nil } @@ -18,7 +18,7 @@ %ul.procedure-stats.flex %li %object - = link_to(procedure_path(p, statut: 'a-suivre')) do + = link_to(gestionnaire_procedure_path(p, statut: 'a-suivre')) do - a_suivre_count = @dossiers_a_suivre_count_per_procedure[p.id] || 0 .stats-number = a_suivre_count @@ -26,7 +26,7 @@ à suivre %li %object - = link_to(procedure_path(p, statut: 'suivis')) do + = link_to(gestionnaire_procedure_path(p, statut: 'suivis')) do - if current_gestionnaire.notifications_per_procedure[p.id].present? %span.notifications{ 'aria-label': "notifications" } - followed_count = @followed_dossiers_count_per_procedure[p.id] || 0 @@ -36,7 +36,7 @@ = t('pluralize.followed', count: followed_count) %li %object - = link_to(procedure_path(p, statut: 'traites')) do + = link_to(gestionnaire_procedure_path(p, statut: 'traites')) do - if current_gestionnaire.notifications_per_procedure(:termine)[p.id].present? %span.notifications{ 'aria-label': "notifications" } - termines_count = @dossiers_termines_count_per_procedure[p.id] || 0 @@ -46,7 +46,7 @@ = t('pluralize.processed', count: termines_count) %li %object - = link_to(procedure_path(p, statut: 'tous')) do + = link_to(gestionnaire_procedure_path(p, statut: 'tous')) do - dossier_count = @dossiers_count_per_procedure[p.id] || 0 .stats-number = dossier_count @@ -54,7 +54,7 @@ = t('pluralize.case', count: dossier_count) %li %object - = link_to(procedure_path(p, statut: 'archives')) do + = link_to(gestionnaire_procedure_path(p, statut: 'archives')) do - archived_count = @dossiers_archived_count_per_procedure[p.id] || 0 .stats-number = archived_count diff --git a/app/views/new_gestionnaire/procedures/show.html.haml b/app/views/new_gestionnaire/procedures/show.html.haml index b0b460876..01d9b34bb 100644 --- a/app/views/new_gestionnaire/procedures/show.html.haml +++ b/app/views/new_gestionnaire/procedures/show.html.haml @@ -11,31 +11,31 @@ %h1= @procedure.libelle %ul.tabs %li{ class: (@statut == 'a-suivre') ? 'active' : nil }> - = link_to(procedure_path(@procedure, statut: 'a-suivre')) do + = link_to(gestionnaire_procedure_path(@procedure, statut: 'a-suivre')) do à suivre %span.badge= @a_suivre_dossiers.count %li{ class: (@statut == 'suivis') ? 'active' : nil }> - if current_gestionnaire.notifications_for_procedure(@procedure).present? %span.notifications{ 'aria-label': 'notifications' } - = link_to(procedure_path(@procedure, statut: 'suivis')) do + = link_to(gestionnaire_procedure_path(@procedure, statut: 'suivis')) do = t('pluralize.followed', count: @followed_dossiers.count) %span.badge= @followed_dossiers.count %li{ class: (@statut == 'traites') ? 'active' : nil }> - if current_gestionnaire.notifications_for_procedure(@procedure, :termine).present? %span.notifications{ 'aria-label': 'notifications' } - = link_to(procedure_path(@procedure, statut: 'traites')) do + = link_to(gestionnaire_procedure_path(@procedure, statut: 'traites')) do = t('pluralize.processed', count: @termines_dossiers.count) %span.badge= @termines_dossiers.count %li{ class: (@statut == 'tous') ? 'active' : nil }> - = link_to(procedure_path(@procedure, statut: 'tous')) do + = link_to(gestionnaire_procedure_path(@procedure, statut: 'tous')) do tous les dossiers %span.badge= @all_state_dossiers.count %li{ class: (@statut == 'archives') ? 'active' : nil }> - = link_to(procedure_path(@procedure, statut: 'archives')) do + = link_to(gestionnaire_procedure_path(@procedure, statut: 'archives')) do = t('pluralize.archived', count: @archived_dossiers.count) %span.badge= @archived_dossiers.count diff --git a/spec/features/new_gestionnaire/gestionnaire_spec.rb b/spec/features/new_gestionnaire/gestionnaire_spec.rb index 65292c2c2..fdf4dea9c 100644 --- a/spec/features/new_gestionnaire/gestionnaire_spec.rb +++ b/spec/features/new_gestionnaire/gestionnaire_spec.rb @@ -13,7 +13,7 @@ feature 'The gestionnaire part' do expect(page).to have_current_path(procedures_path) click_on procedure.libelle - expect(page).to have_current_path(procedure_path(procedure)) + expect(page).to have_current_path(gestionnaire_procedure_path(procedure)) click_on dossier.user.email expect(page).to have_current_path(gestionnaire_dossier_path(procedure, dossier)) @@ -40,16 +40,16 @@ feature 'The gestionnaire part' do dossier_present?(dossier.id, 'en construction') click_on 'Suivre le dossier' - expect(page).to have_current_path(procedure_path(procedure)) + expect(page).to have_current_path(gestionnaire_procedure_path(procedure)) test_statut_bar(suivi: 1, tous_les_dossiers: 1) expect(page).to have_text('Aucun dossier') click_on 'suivi' - expect(page).to have_current_path(procedure_path(procedure, statut: 'suivis')) + expect(page).to have_current_path(gestionnaire_procedure_path(procedure, statut: 'suivis')) dossier_present?(dossier.id, 'en construction') click_on 'Ne plus suivre' - expect(page).to have_current_path(procedure_path(procedure, statut: 'suivis')) + expect(page).to have_current_path(gestionnaire_procedure_path(procedure, statut: 'suivis')) test_statut_bar(a_suivre: 1, tous_les_dossiers: 1) expect(page).to have_text('Aucun dossier') end From 030834500827cb2fc51cad809cb7912f6d20ad64 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 15:06:21 +0100 Subject: [PATCH 48/52] Gestionnaire: move procedures_path to gestionnaire_procedures_path --- app/controllers/root_controller.rb | 2 +- app/controllers/users/sessions_controller.rb | 2 +- app/views/layouts/_new_header.haml | 4 ++-- app/views/layouts/_switch_devise_profile_module.html.haml | 2 +- spec/controllers/root_controller_spec.rb | 2 +- spec/features/new_gestionnaire/gestionnaire_spec.rb | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/controllers/root_controller.rb b/app/controllers/root_controller.rb index 3d16871fa..5599dcf8d 100644 --- a/app/controllers/root_controller.rb +++ b/app/controllers/root_controller.rb @@ -5,7 +5,7 @@ class RootController < ApplicationController if administrateur_signed_in? return redirect_to admin_procedures_path elsif gestionnaire_signed_in? - return redirect_to procedures_path + return redirect_to gestionnaire_procedures_path elsif user_signed_in? return redirect_to users_dossiers_path elsif administration_signed_in? diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb index df00724b4..b2b6f3391 100644 --- a/app/controllers/users/sessions_controller.rb +++ b/app/controllers/users/sessions_controller.rb @@ -26,7 +26,7 @@ class Users::SessionsController < Sessions::SessionsController if user_signed_in? redirect_to after_sign_in_path_for(:user) elsif gestionnaire_signed_in? - location = stored_location_for(:gestionnaire) || procedures_path + location = stored_location_for(:gestionnaire) || gestionnaire_procedures_path redirect_to location elsif administrateur_signed_in? redirect_to admin_path diff --git a/app/views/layouts/_new_header.haml b/app/views/layouts/_new_header.haml index ab2d6a8f4..b43b29ada 100644 --- a/app/views/layouts/_new_header.haml +++ b/app/views/layouts/_new_header.haml @@ -12,7 +12,7 @@ %ul.header-tabs - if current_gestionnaire.procedures.count > 0 %li - = link_to "Procédures", procedures_path, class: (controller_name != 'avis') ? "tab-link active" : 'tab-link' + = link_to "Procédures", gestionnaire_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') ? "tab-link active" : 'tab-link' do @@ -60,7 +60,7 @@ Passer en usager - if gestionnaire_signed_in? && nav_bar_profile != :gestionnaire %li - = link_to procedures_path, class: "menu-item menu-link" do + = link_to gestionnaire_procedures_path, class: "menu-item menu-link" do = image_tag "icons/switch-profile.svg" Passer en accompagnateur - if administrateur_signed_in? && nav_bar_profile != :administrateur diff --git a/app/views/layouts/_switch_devise_profile_module.html.haml b/app/views/layouts/_switch_devise_profile_module.html.haml index b8b0de852..a32ef804e 100644 --- a/app/views/layouts/_switch_devise_profile_module.html.haml +++ b/app/views/layouts/_switch_devise_profile_module.html.haml @@ -12,7 +12,7 @@ Usager - if gestionnaire_signed_in? %li - = link_to(procedures_path) do + = link_to(gestionnaire_procedures_path) do %i.fa.fa-user   Accompagnateur diff --git a/spec/controllers/root_controller_spec.rb b/spec/controllers/root_controller_spec.rb index 7dc4aeae1..1c81e267b 100644 --- a/spec/controllers/root_controller_spec.rb +++ b/spec/controllers/root_controller_spec.rb @@ -21,7 +21,7 @@ describe RootController, type: :controller do sign_in gestionnaire end - it { expect(subject).to redirect_to(procedures_path) } + it { expect(subject).to redirect_to(gestionnaire_procedures_path) } end context 'when Administrateur is connected' do diff --git a/spec/features/new_gestionnaire/gestionnaire_spec.rb b/spec/features/new_gestionnaire/gestionnaire_spec.rb index fdf4dea9c..aab4464e4 100644 --- a/spec/features/new_gestionnaire/gestionnaire_spec.rb +++ b/spec/features/new_gestionnaire/gestionnaire_spec.rb @@ -10,7 +10,7 @@ feature 'The gestionnaire part' do scenario 'A gestionnaire can accept a dossier' do log_in(gestionnaire.email, password) - expect(page).to have_current_path(procedures_path) + expect(page).to have_current_path(gestionnaire_procedures_path) click_on procedure.libelle expect(page).to have_current_path(gestionnaire_procedure_path(procedure)) @@ -136,7 +136,7 @@ feature 'The gestionnaire part' do fill_in 'user_email', with: email fill_in 'user_password', with: password click_on 'Se connecter' - expect(page).to have_current_path(procedures_path) + expect(page).to have_current_path(gestionnaire_procedures_path) end def log_out From 9db5e82b410f328fd611384f83a593dbf922e3ec Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 15:19:04 +0100 Subject: [PATCH 49/52] Gestionnaire: move avis_path to gestionnaire_avis_path --- app/helpers/dossier_link_helper.rb | 2 +- app/views/new_gestionnaire/avis/_header.html.haml | 4 ++-- app/views/new_gestionnaire/avis/index.html.haml | 6 +++--- app/views/new_gestionnaire/avis/instruction.html.haml | 2 +- spec/features/new_gestionnaire/gestionnaire_spec.rb | 2 +- spec/helpers/dossier_link_helper_spec.rb | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/helpers/dossier_link_helper.rb b/app/helpers/dossier_link_helper.rb index 707f74c8b..ab14c90d5 100644 --- a/app/helpers/dossier_link_helper.rb +++ b/app/helpers/dossier_link_helper.rb @@ -5,7 +5,7 @@ module DossierLinkHelper else avis = dossier.avis.find_by(gestionnaire: gestionnaire) if avis.present? - avis_path(avis) + gestionnaire_avis_path(avis) end end end diff --git a/app/views/new_gestionnaire/avis/_header.html.haml b/app/views/new_gestionnaire/avis/_header.html.haml index 4186735f4..8a8f69b78 100644 --- a/app/views/new_gestionnaire/avis/_header.html.haml +++ b/app/views/new_gestionnaire/avis/_header.html.haml @@ -5,8 +5,8 @@ %li= "#{dossier.procedure.libelle}, dossier nº #{dossier.id}" %ul.tabs - %li{ class: current_page?(avis_path(avis)) ? 'active' : nil } - = link_to 'Demande', avis_path(avis) + %li{ class: current_page?(gestionnaire_avis_path(avis)) ? 'active' : nil } + = link_to 'Demande', gestionnaire_avis_path(avis) %li{ class: current_page?(instruction_gestionnaire_avis_path(avis)) ? 'active' : nil } = link_to 'Avis', instruction_gestionnaire_avis_path(avis) - if avis.answer == nil diff --git a/app/views/new_gestionnaire/avis/index.html.haml b/app/views/new_gestionnaire/avis/index.html.haml index 1f3c5405f..597a1e1d0 100644 --- a/app/views/new_gestionnaire/avis/index.html.haml +++ b/app/views/new_gestionnaire/avis/index.html.haml @@ -30,11 +30,11 @@ - @avis.each do |avis| %tr %td.number-col - = link_to(avis_path(avis), class: 'cell-link') do + = link_to(gestionnaire_avis_path(avis), class: 'cell-link') do %span.icon.folder #{avis.dossier.id} - %td= link_to(avis.dossier.user.email, avis_path(avis), class: 'cell-link') - %td= link_to(avis.dossier.procedure.libelle, avis_path(avis), class: 'cell-link') + %td= link_to(avis.dossier.user.email, gestionnaire_avis_path(avis), class: 'cell-link') + %td= link_to(avis.dossier.procedure.libelle, gestionnaire_avis_path(avis), class: 'cell-link') = paginate(@avis) - else %h2.empty-text Aucun avis diff --git a/app/views/new_gestionnaire/avis/instruction.html.haml b/app/views/new_gestionnaire/avis/instruction.html.haml index e4e3d5b3e..499da3ce5 100644 --- a/app/views/new_gestionnaire/avis/instruction.html.haml +++ b/app/views/new_gestionnaire/avis/instruction.html.haml @@ -11,7 +11,7 @@ %span.date Demande d'avis envoyée le #{I18n.l(@avis.created_at.localtime, format: '%d/%m/%y')} %p.introduction= @avis.introduction - = form_for @avis, url: avis_path(@avis), html: { class: 'form' } do |f| + = form_for @avis, url: gestionnaire_avis_path(@avis), html: { class: 'form' } do |f| = f.text_area :answer, rows: 3, placeholder: 'Votre avis', required: true .flex.justify-between.align-baseline %p.confidentiel.flex diff --git a/spec/features/new_gestionnaire/gestionnaire_spec.rb b/spec/features/new_gestionnaire/gestionnaire_spec.rb index aab4464e4..af1035f36 100644 --- a/spec/features/new_gestionnaire/gestionnaire_spec.rb +++ b/spec/features/new_gestionnaire/gestionnaire_spec.rb @@ -80,7 +80,7 @@ feature 'The gestionnaire part' do expect(page).to have_text('avis donnés 0') click_on dossier.user.email - expect(page).to have_current_path(avis_path(dossier.avis.first)) + expect(page).to have_current_path(gestionnaire_avis_path(dossier.avis.first)) within(:css, '.tabs') do click_on 'Avis' diff --git a/spec/helpers/dossier_link_helper_spec.rb b/spec/helpers/dossier_link_helper_spec.rb index 038ff6384..089b6a544 100644 --- a/spec/helpers/dossier_link_helper_spec.rb +++ b/spec/helpers/dossier_link_helper_spec.rb @@ -21,7 +21,7 @@ describe DossierLinkHelper do let(:gestionnaire) { create(:gestionnaire) } let!(:avis) { create(:avis, dossier: dossier, gestionnaire: gestionnaire) } - it { expect(helper.dossier_linked_path(gestionnaire, dossier)).to eq(avis_path(avis)) } + it { expect(helper.dossier_linked_path(gestionnaire, dossier)).to eq(gestionnaire_avis_path(avis)) } end end end From 864b98c6dc4bbdc783241df129703c6c0b65d26f Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 15:45:21 +0100 Subject: [PATCH 50/52] Gestionnaire: various missing avis urls --- app/controllers/new_gestionnaire/avis_controller.rb | 4 ++-- app/controllers/new_gestionnaire/procedures_controller.rb | 2 +- app/views/avis_mailer/avis_invitation.html.haml | 2 +- app/views/layouts/_new_header.haml | 2 +- app/views/new_gestionnaire/avis/_header.html.haml | 2 +- app/views/new_gestionnaire/avis/index.html.haml | 4 ++-- app/views/new_gestionnaire/avis/instruction.html.haml | 2 +- spec/controllers/new_gestionnaire/avis_controller_spec.rb | 6 +++--- .../new_gestionnaire/procedures_controller_spec.rb | 2 +- spec/features/new_gestionnaire/gestionnaire_spec.rb | 4 ++-- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/controllers/new_gestionnaire/avis_controller.rb b/app/controllers/new_gestionnaire/avis_controller.rb index 84441723a..9e1257063 100644 --- a/app/controllers/new_gestionnaire/avis_controller.rb +++ b/app/controllers/new_gestionnaire/avis_controller.rb @@ -76,7 +76,7 @@ module NewGestionnaire sign_in(gestionnaire, scope: :gestionnaire) Avis.link_avis_to_gestionnaire(gestionnaire) avis = Avis.find(params[:id]) - redirect_to url_for(avis_index_path) + redirect_to url_for(gestionnaire_avis_index_path) else flash[:alert] = gestionnaire.errors.full_messages redirect_to url_for(sign_up_gestionnaire_avis_path(params[:id], email)) @@ -96,7 +96,7 @@ module NewGestionnaire if current_gestionnaire.present? # a gestionnaire is authenticated ... lets see if it can view the dossier - redirect_to avis_url(avis) + redirect_to gestionnaire_avis_url(avis) elsif avis.gestionnaire.present? && avis.gestionnaire.email == params[:email] # the avis gestionnaire has already signed up and it sould sign in diff --git a/app/controllers/new_gestionnaire/procedures_controller.rb b/app/controllers/new_gestionnaire/procedures_controller.rb index 5b377c709..8fedf4d06 100644 --- a/app/controllers/new_gestionnaire/procedures_controller.rb +++ b/app/controllers/new_gestionnaire/procedures_controller.rb @@ -203,7 +203,7 @@ module NewGestionnaire def redirect_to_avis_if_needed if current_gestionnaire.procedures.count == 0 && current_gestionnaire.avis.count > 0 - redirect_to avis_index_path + redirect_to gestionnaire_avis_index_path end end diff --git a/app/views/avis_mailer/avis_invitation.html.haml b/app/views/avis_mailer/avis_invitation.html.haml index 046076949..7384c5ed5 100644 --- a/app/views/avis_mailer/avis_invitation.html.haml +++ b/app/views/avis_mailer/avis_invitation.html.haml @@ -15,7 +15,7 @@ = link_to "Connectez-vous pour donner votre avis", dossier_url(@avis.dossier.procedure, @avis.dossier) - else %p - = link_to "Inscrivez-vous pour donner votre avis", sign_up_avis_url(@avis.id, @avis.email) + = link_to "Inscrivez-vous pour donner votre avis", sign_up_gestionnaire_avis_url(@avis.id, @avis.email) Bonne journée, %br diff --git a/app/views/layouts/_new_header.haml b/app/views/layouts/_new_header.haml index b43b29ada..3f73c7cba 100644 --- a/app/views/layouts/_new_header.haml +++ b/app/views/layouts/_new_header.haml @@ -15,7 +15,7 @@ = link_to "Procédures", gestionnaire_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') ? "tab-link active" : 'tab-link' do + = link_to gestionnaire_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 diff --git a/app/views/new_gestionnaire/avis/_header.html.haml b/app/views/new_gestionnaire/avis/_header.html.haml index 8a8f69b78..aac10ae17 100644 --- a/app/views/new_gestionnaire/avis/_header.html.haml +++ b/app/views/new_gestionnaire/avis/_header.html.haml @@ -1,7 +1,7 @@ .accompagnateur-header .container %ul.breadcrumbs - %li= link_to('Avis', avis_index_path) + %li= link_to('Avis', gestionnaire_avis_index_path) %li= "#{dossier.procedure.libelle}, dossier nº #{dossier.id}" %ul.tabs diff --git a/app/views/new_gestionnaire/avis/index.html.haml b/app/views/new_gestionnaire/avis/index.html.haml index 597a1e1d0..2a7c6c0a3 100644 --- a/app/views/new_gestionnaire/avis/index.html.haml +++ b/app/views/new_gestionnaire/avis/index.html.haml @@ -7,14 +7,14 @@ %h1.tab-title Avis %ul.tabs %li{ class: (@statut == NewGestionnaire::AvisController::A_DONNER_STATUS) ? 'active' : nil }> - = link_to(avis_index_path(statut: NewGestionnaire::AvisController::A_DONNER_STATUS)) do + = link_to(gestionnaire_avis_index_path(statut: NewGestionnaire::AvisController::A_DONNER_STATUS)) do avis à donner %span.badge= @avis_a_donner.count - if @avis_a_donner.any? %span.notifications %li{ class: (@statut == NewGestionnaire::AvisController::DONNES_STATUS) ? 'active' : nil }> - = link_to(avis_index_path(statut: NewGestionnaire::AvisController::DONNES_STATUS)) do + = link_to(gestionnaire_avis_index_path(statut: NewGestionnaire::AvisController::DONNES_STATUS)) do avis #{'donné'.pluralize(@avis_donnes.count)} %span.badge= @avis_donnes.count diff --git a/app/views/new_gestionnaire/avis/instruction.html.haml b/app/views/new_gestionnaire/avis/instruction.html.haml index 499da3ce5..943764c97 100644 --- a/app/views/new_gestionnaire/avis/instruction.html.haml +++ b/app/views/new_gestionnaire/avis/instruction.html.haml @@ -21,6 +21,6 @@ .send-wrapper = f.submit 'Envoyer votre avis', class: 'button send' - = render partial: "new_gestionnaire/shared/avis/form", locals: { url: avis_avis_path(@avis), must_be_confidentiel: @avis.confidentiel? } + = render partial: "new_gestionnaire/shared/avis/form", locals: { url: avis_gestionnaire_avis_path(@avis), must_be_confidentiel: @avis.confidentiel? } = render partial: 'new_gestionnaire/shared/avis/list', locals: { avis: @dossier.avis_for(current_gestionnaire), avis_seen_at: nil } diff --git a/spec/controllers/new_gestionnaire/avis_controller_spec.rb b/spec/controllers/new_gestionnaire/avis_controller_spec.rb index d95875bfc..c34f1ed79 100644 --- a/spec/controllers/new_gestionnaire/avis_controller_spec.rb +++ b/spec/controllers/new_gestionnaire/avis_controller_spec.rb @@ -179,7 +179,7 @@ describe NewGestionnaire::AvisController, type: :controller do get :sign_up, params: { id: avis.id, email: invited_email } end - it { is_expected.to redirect_to avis_url(avis) } + it { is_expected.to redirect_to gestionnaire_avis_url(avis) } end context 'when the gestionnaire is not authenticated' do @@ -201,7 +201,7 @@ describe NewGestionnaire::AvisController, type: :controller do end # redirected to dossier but then the gestionnaire gonna be banished ! - it { is_expected.to redirect_to avis_url(avis) } + it { is_expected.to redirect_to gestionnaire_avis_url(avis) } end end @@ -243,7 +243,7 @@ describe NewGestionnaire::AvisController, type: :controller do it { expect(Avis).to have_received(:link_avis_to_gestionnaire) } it { expect(subject.current_gestionnaire).to eq(created_gestionnaire) } - it { is_expected.to redirect_to avis_index_path } + it { is_expected.to redirect_to gestionnaire_avis_index_path } end context 'when the gestionnaire creation fails' do diff --git a/spec/controllers/new_gestionnaire/procedures_controller_spec.rb b/spec/controllers/new_gestionnaire/procedures_controller_spec.rb index aca6bec8b..daa5aea35 100644 --- a/spec/controllers/new_gestionnaire/procedures_controller_spec.rb +++ b/spec/controllers/new_gestionnaire/procedures_controller_spec.rb @@ -78,7 +78,7 @@ describe NewGestionnaire::ProceduresController, type: :controller do end it "redirects avis" do - expect(@controller).to have_received(:redirect_to).with(avis_index_path) + expect(@controller).to have_received(:redirect_to).with(gestionnaire_avis_index_path) end end end diff --git a/spec/features/new_gestionnaire/gestionnaire_spec.rb b/spec/features/new_gestionnaire/gestionnaire_spec.rb index af1035f36..c67cbe71f 100644 --- a/spec/features/new_gestionnaire/gestionnaire_spec.rb +++ b/spec/features/new_gestionnaire/gestionnaire_spec.rb @@ -75,7 +75,7 @@ feature 'The gestionnaire part' do avis_sign_up(avis, expert_email, 'a good password') - expect(page).to have_current_path(avis_index_path) + expect(page).to have_current_path(gestionnaire_avis_index_path) expect(page).to have_text('avis à donner 1') expect(page).to have_text('avis donnés 0') @@ -172,7 +172,7 @@ feature 'The gestionnaire part' do visit sign_up_gestionnaire_avis_path(avis, email) fill_in 'gestionnaire_password', with: 'a good password' click_on 'Créer un compte' - expect(page).to have_current_path(avis_index_path) + expect(page).to have_current_path(gestionnaire_avis_index_path) end def dossier_present?(id, statut) From 630f22e2058c74c6c85b567d69a8b09e171ef698 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 15:56:41 +0100 Subject: [PATCH 51/52] Gestionnaire: various missing procedure urls --- .../new_gestionnaire/dossiers_controller.rb | 8 ++++---- .../new_gestionnaire/procedures_controller.rb | 8 ++++---- .../new_gestionnaire/dossiers_controller_spec.rb | 10 +++++----- .../new_gestionnaire/procedure_filters_spec.rb | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/controllers/new_gestionnaire/dossiers_controller.rb b/app/controllers/new_gestionnaire/dossiers_controller.rb index 878a406a2..f1a130b41 100644 --- a/app/controllers/new_gestionnaire/dossiers_controller.rb +++ b/app/controllers/new_gestionnaire/dossiers_controller.rb @@ -46,25 +46,25 @@ module NewGestionnaire def follow current_gestionnaire.follow(dossier) flash.notice = 'Dossier suivi' - redirect_back(fallback_location: procedures_url) + redirect_back(fallback_location: gestionnaire_procedures_url) end def unfollow current_gestionnaire.unfollow(dossier) flash.notice = "Vous ne suivez plus le dossier nº #{dossier.id}" - redirect_back(fallback_location: procedures_url) + redirect_back(fallback_location: gestionnaire_procedures_url) end def archive dossier.update_attributes(archived: true) current_gestionnaire.unfollow(dossier) - redirect_back(fallback_location: procedures_url) + redirect_back(fallback_location: gestionnaire_procedures_url) end def unarchive dossier.update_attributes(archived: false) - redirect_back(fallback_location: procedures_url) + redirect_back(fallback_location: gestionnaire_procedures_url) end def passer_en_instruction diff --git a/app/controllers/new_gestionnaire/procedures_controller.rb b/app/controllers/new_gestionnaire/procedures_controller.rb index 8fedf4d06..0131bcb61 100644 --- a/app/controllers/new_gestionnaire/procedures_controller.rb +++ b/app/controllers/new_gestionnaire/procedures_controller.rb @@ -116,7 +116,7 @@ module NewGestionnaire procedure_presentation.update_attributes(sort: Procedure.default_sort) end - redirect_back(fallback_location: procedure_url(procedure)) + redirect_back(fallback_location: gestionnaire_procedure_url(procedure)) end def update_sort @@ -138,7 +138,7 @@ module NewGestionnaire procedure_presentation.update_attributes(sort: sort) - redirect_back(fallback_location: procedure_url(procedure)) + redirect_back(fallback_location: gestionnaire_procedure_url(procedure)) end def add_filter @@ -157,7 +157,7 @@ module NewGestionnaire procedure_presentation.update_attributes(filters: filters.to_json) end - redirect_back(fallback_location: procedure_url(procedure)) + redirect_back(fallback_location: gestionnaire_procedure_url(procedure)) end def remove_filter @@ -170,7 +170,7 @@ module NewGestionnaire procedure_presentation.update_attributes(filters: filters.to_json) - redirect_back(fallback_location: procedure_url(procedure)) + redirect_back(fallback_location: gestionnaire_procedure_url(procedure)) end def download_dossiers diff --git a/spec/controllers/new_gestionnaire/dossiers_controller_spec.rb b/spec/controllers/new_gestionnaire/dossiers_controller_spec.rb index 71c0d59cf..c6338051f 100644 --- a/spec/controllers/new_gestionnaire/dossiers_controller_spec.rb +++ b/spec/controllers/new_gestionnaire/dossiers_controller_spec.rb @@ -54,7 +54,7 @@ describe NewGestionnaire::DossiersController, type: :controller do ) end - it { expect(response).to redirect_to(personnes_impliquees_dossier_url) } + it { expect(response).to redirect_to(personnes_impliquees_gestionnaire_dossier_url) } end describe '#follow' do @@ -64,7 +64,7 @@ describe NewGestionnaire::DossiersController, type: :controller do it { expect(gestionnaire.followed_dossiers).to match([dossier]) } it { expect(flash.notice).to eq('Dossier suivi') } - it { expect(response).to redirect_to(procedures_url) } + it { expect(response).to redirect_to(gestionnaire_procedures_url) } end describe '#unfollow' do @@ -76,7 +76,7 @@ describe NewGestionnaire::DossiersController, type: :controller do it { expect(gestionnaire.followed_dossiers).to match([]) } it { expect(flash.notice).to eq("Vous ne suivez plus le dossier nº #{dossier.id}") } - it { expect(response).to redirect_to(procedures_url) } + it { expect(response).to redirect_to(gestionnaire_procedures_url) } end describe '#archive' do @@ -88,7 +88,7 @@ describe NewGestionnaire::DossiersController, type: :controller do end it { expect(dossier.archived).to be true } - it { expect(response).to redirect_to(procedures_url) } + it { expect(response).to redirect_to(gestionnaire_procedures_url) } it { expect(gestionnaire.followed_dossiers).not_to include(dossier) } end @@ -100,7 +100,7 @@ describe NewGestionnaire::DossiersController, type: :controller do end it { expect(dossier.archived).to be false } - it { expect(response).to redirect_to(procedures_url) } + it { expect(response).to redirect_to(gestionnaire_procedures_url) } end describe '#passer_en_instruction' do diff --git a/spec/features/new_gestionnaire/procedure_filters_spec.rb b/spec/features/new_gestionnaire/procedure_filters_spec.rb index 65aabaa4a..332142f19 100644 --- a/spec/features/new_gestionnaire/procedure_filters_spec.rb +++ b/spec/features/new_gestionnaire/procedure_filters_spec.rb @@ -11,7 +11,7 @@ feature "procedure filters" do before do champ.update_attributes(value: "Mon champ rempli") login_as gestionnaire, scope: :gestionnaire - visit procedure_path(procedure) + visit gestionnaire_procedure_path(procedure) end scenario "should display demandeur by default" do From f39fe88fb0dc8c0041e822237d20e040fb520a4c Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 21 Feb 2018 17:07:19 +0100 Subject: [PATCH 52/52] Gestionnaire: missing gestionnaire_dossier_url --- app/views/avis_mailer/avis_invitation.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/avis_mailer/avis_invitation.html.haml b/app/views/avis_mailer/avis_invitation.html.haml index 7384c5ed5..cfc3aeb4f 100644 --- a/app/views/avis_mailer/avis_invitation.html.haml +++ b/app/views/avis_mailer/avis_invitation.html.haml @@ -12,7 +12,7 @@ - if @avis.gestionnaire.present? %p - = link_to "Connectez-vous pour donner votre avis", dossier_url(@avis.dossier.procedure, @avis.dossier) + = link_to "Connectez-vous pour donner votre avis", gestionnaire_dossier_url(@avis.dossier.procedure, @avis.dossier) - else %p = link_to "Inscrivez-vous pour donner votre avis", sign_up_gestionnaire_avis_url(@avis.id, @avis.email)