dossiers: change all links to use the new user dossiers list
This commit is contained in:
parent
148dc164f7
commit
b4b533f0c5
17 changed files with 57 additions and 35 deletions
|
@ -107,7 +107,7 @@ module NewUser
|
|||
if !dossier.instruction_commencee?
|
||||
dossier.delete_and_keep_track
|
||||
flash.notice = 'Votre dossier a bien été supprimé.'
|
||||
redirect_to users_dossiers_path
|
||||
redirect_to dossiers_path
|
||||
else
|
||||
flash.notice = "L'instruction de votre dossier a commencé, il n'est plus possible de supprimer votre dossier. Si vous souhaitez annuler l'instruction contactez votre administration par la messagerie de votre dossier."
|
||||
redirect_to users_dossier_path(dossier)
|
||||
|
@ -123,7 +123,7 @@ module NewUser
|
|||
def ensure_dossier_can_be_updated
|
||||
if !dossier.can_be_updated_by_the_user?
|
||||
flash.alert = 'Votre dossier ne peut plus être modifié'
|
||||
redirect_to users_dossiers_path
|
||||
redirect_to dossiers_path
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ class RootController < ApplicationController
|
|||
elsif gestionnaire_signed_in?
|
||||
return redirect_to gestionnaire_procedures_path
|
||||
elsif user_signed_in?
|
||||
return redirect_to users_dossiers_path
|
||||
return redirect_to dossiers_path
|
||||
elsif administration_signed_in?
|
||||
return redirect_to manager_root_path
|
||||
end
|
||||
|
|
|
@ -8,6 +8,6 @@ class Users::Dossiers::AddSiretController < ApplicationController
|
|||
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
flash.alert = t('errors.messages.dossier_not_found')
|
||||
redirect_to url_for users_dossiers_path
|
||||
redirect_to url_for dossiers_path
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,6 +12,6 @@ class Users::Dossiers::InvitesController < UsersController
|
|||
render 'users/recapitulatif/show'
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
flash.alert = t('errors.messages.dossier_not_found')
|
||||
redirect_to url_for users_dossiers_path
|
||||
redirect_to url_for dossiers_path
|
||||
end
|
||||
end
|
||||
|
|
|
@ -104,7 +104,7 @@ class Users::DossiersController < UsersController
|
|||
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
flash.alert = t('errors.messages.dossier_not_found')
|
||||
redirect_to url_for users_dossiers_path
|
||||
redirect_to url_for dossiers_path
|
||||
end
|
||||
|
||||
def siret_informations
|
||||
|
@ -133,7 +133,7 @@ class Users::DossiersController < UsersController
|
|||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
flash.alert = t('errors.messages.dossier_not_found')
|
||||
redirect_to url_for users_dossiers_path
|
||||
redirect_to url_for dossiers_path
|
||||
end
|
||||
|
||||
def change_siret
|
||||
|
@ -181,7 +181,7 @@ class Users::DossiersController < UsersController
|
|||
dossier.destroy
|
||||
flash.notice = 'Brouillon supprimé'
|
||||
end
|
||||
redirect_to url_for users_dossiers_path(liste: 'brouillon')
|
||||
redirect_to url_for dossiers_path
|
||||
end
|
||||
|
||||
def text_summary
|
||||
|
@ -229,7 +229,7 @@ class Users::DossiersController < UsersController
|
|||
def error_procedure
|
||||
flash.alert = t('errors.messages.procedure_not_found')
|
||||
|
||||
redirect_to url_for users_dossiers_path
|
||||
redirect_to url_for dossiers_path
|
||||
end
|
||||
|
||||
def update_current_user_siret!(siret)
|
||||
|
|
|
@ -25,7 +25,7 @@ module ApplicationHelper
|
|||
when :gestionnaire
|
||||
gestionnaire_procedures_path
|
||||
when :user
|
||||
users_dossiers_path
|
||||
dossiers_path
|
||||
else
|
||||
root_path
|
||||
end
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
- if nav_bar_profile == :user
|
||||
%ul.header-tabs
|
||||
%li
|
||||
= active_link_to "Dossiers", users_dossiers_path, active: :inclusive, class: 'tab-link'
|
||||
= active_link_to "Dossiers", dossiers_path, active: :inclusive, class: 'tab-link'
|
||||
|
||||
%ul.header-right-content
|
||||
- if nav_bar_profile == :gestionnaire && gestionnaire_signed_in?
|
||||
|
@ -63,7 +63,7 @@
|
|||
- if SwitchDeviseProfileService.new(warden).multiple_devise_profile_connect?
|
||||
- if user_signed_in? && nav_bar_profile != :user
|
||||
%li
|
||||
= link_to users_dossiers_path, class: "menu-item menu-link" do
|
||||
= link_to dossiers_path, class: "menu-item menu-link" do
|
||||
= image_tag "icons/switch-profile.svg"
|
||||
Passer en usager
|
||||
- if gestionnaire_signed_in? && nav_bar_profile != :gestionnaire
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
%ul.dropdown-menu.dropdown-menu-left
|
||||
- if user_signed_in?
|
||||
%li
|
||||
= link_to(users_dossiers_path, id: :menu_item_procedure) do
|
||||
= link_to(dossiers_path, id: :menu_item_procedure) do
|
||||
%i.fa.fa-user
|
||||
|
||||
Usager
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
.link-to-dossiers
|
||||
= link_to 'retour aux dossiers', users_dossiers_path
|
||||
= link_to 'retour aux dossiers', dossiers_path
|
||||
|
||||
#first-block
|
||||
.en-cours
|
||||
|
|
|
@ -150,8 +150,8 @@ describe NewUser::DossiersController, type: :controller do
|
|||
let(:individual_params) { { gender: 'M', nom: 'Mouse', prenom: 'Mickey' } }
|
||||
let(:dossier_params) { { autorisation_donnees: true } }
|
||||
|
||||
it 'redirects to user_dossiers_path' do
|
||||
expect(response).to redirect_to(users_dossiers_path)
|
||||
it 'redirects to the dossiers list' do
|
||||
expect(response).to redirect_to(dossiers_path)
|
||||
expect(flash.alert).to eq('Votre dossier ne peut plus être modifié')
|
||||
end
|
||||
end
|
||||
|
@ -225,10 +225,10 @@ describe NewUser::DossiersController, type: :controller do
|
|||
context 'when the dossier cannot be updated by the user' do
|
||||
let!(:dossier) { create(:dossier, :en_instruction, user: user) }
|
||||
|
||||
it 'redirects to user_dossiers_path' do
|
||||
it 'redirects to the dossiers list' do
|
||||
subject
|
||||
|
||||
expect(response).to redirect_to(users_dossiers_path)
|
||||
expect(response).to redirect_to(dossiers_path)
|
||||
expect(flash.alert).to eq('Votre dossier ne peut plus être modifié')
|
||||
end
|
||||
end
|
||||
|
@ -474,7 +474,7 @@ describe NewUser::DossiersController, type: :controller do
|
|||
expect(procedure.deleted_dossiers.first.dossier_id).to eq(dossier_id)
|
||||
end
|
||||
|
||||
it { is_expected.to redirect_to(users_dossiers_path) }
|
||||
it { is_expected.to redirect_to(dossiers_path) }
|
||||
|
||||
context "and the instruction has started" do
|
||||
let(:dossier) { create(:dossier, :en_instruction, user: user, autorisation_donnees: true) }
|
||||
|
|
|
@ -8,7 +8,7 @@ describe RootController, type: :controller do
|
|||
sign_in create(:user)
|
||||
end
|
||||
|
||||
it { expect(subject).to redirect_to(users_dossiers_path) }
|
||||
it { expect(subject).to redirect_to(dossiers_path) }
|
||||
end
|
||||
|
||||
context 'when Gestionnaire is connected' do
|
||||
|
|
|
@ -11,7 +11,7 @@ describe Users::Dossiers::AddSiretController, type: :controller do
|
|||
subject { get :show, params: { dossier_id: dossier.id } }
|
||||
|
||||
context 'when dossier is not attached at a procedure with individual siret attribut' do
|
||||
it { is_expected.to redirect_to users_dossiers_path }
|
||||
it { is_expected.to redirect_to dossiers_path }
|
||||
end
|
||||
|
||||
context 'when dossier is attached at a procedure with individual siret attribut' do
|
||||
|
|
|
@ -72,7 +72,7 @@ describe Users::Dossiers::InvitesController, type: :controller do
|
|||
let(:email) { 'fake@email.com' }
|
||||
|
||||
it { expect(subject.status).to eq 302 }
|
||||
it { is_expected.to redirect_to users_dossiers_path }
|
||||
it { is_expected.to redirect_to dossiers_path }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -120,7 +120,7 @@ describe Users::DossiersController, type: :controller do
|
|||
context 'when procedure is archived' do
|
||||
let(:procedure) { create(:procedure, archived_at: Time.now) }
|
||||
|
||||
it { is_expected.to redirect_to users_dossiers_path }
|
||||
it { is_expected.to redirect_to dossiers_path }
|
||||
end
|
||||
end
|
||||
context 'when user is not logged' do
|
||||
|
@ -136,7 +136,7 @@ describe Users::DossiersController, type: :controller do
|
|||
sign_in user
|
||||
end
|
||||
|
||||
it { is_expected.to redirect_to users_dossiers_path }
|
||||
it { is_expected.to redirect_to dossiers_path }
|
||||
end
|
||||
|
||||
context 'when procedure is not published' do
|
||||
|
@ -146,7 +146,7 @@ describe Users::DossiersController, type: :controller do
|
|||
sign_in user
|
||||
end
|
||||
|
||||
it { is_expected.to redirect_to users_dossiers_path }
|
||||
it { is_expected.to redirect_to dossiers_path }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -45,7 +45,7 @@ feature 'drawing a zone with freedraw' do
|
|||
let(:module_api_carto) { create(:module_api_carto) }
|
||||
|
||||
scenario 'he is redirect to user dossiers index' do
|
||||
expect(page).to have_css('#users-index')
|
||||
expect(page).to have_css('.dossiers-table')
|
||||
end
|
||||
|
||||
scenario 'alert message is present' do
|
||||
|
|
|
@ -6,8 +6,12 @@ describe 'user access to the list of his dossier' do
|
|||
let!(:dossier1) { create(:dossier, :with_entreprise, user: user, state: 'en_construction') }
|
||||
let!(:dossier2) { create(:dossier, :with_entreprise) }
|
||||
let!(:dossier_archived) { create(:dossier, :with_entreprise, user: user, state: 'en_construction') }
|
||||
let(:dossiers_per_page) { 25 }
|
||||
|
||||
before do
|
||||
@default_per_page = Dossier.default_per_page
|
||||
Dossier.paginates_per dossiers_per_page
|
||||
|
||||
last_updated_dossier.update_column(:updated_at, "19/07/2052 15:35".to_time)
|
||||
|
||||
visit new_user_session_path
|
||||
|
@ -18,29 +22,47 @@ describe 'user access to the list of his dossier' do
|
|||
end
|
||||
end
|
||||
|
||||
after do
|
||||
Dossier.paginates_per @default_per_page
|
||||
end
|
||||
|
||||
it 'the list of dossier is displayed' do
|
||||
expect(page).to have_content(dossier1.procedure.libelle)
|
||||
expect(page).to have_content('en construction')
|
||||
end
|
||||
|
||||
it 'dossiers belonging to other users are not displayed' do
|
||||
expect(page).not_to have_content(dossier2.procedure.libelle)
|
||||
end
|
||||
|
||||
it 'the list must be order by last updated' do
|
||||
it 'the list must be ordered by last updated' do
|
||||
expect(page.body).to match(/#{last_updated_dossier.procedure.libelle}.*#{dossier1.procedure.libelle}/m)
|
||||
end
|
||||
|
||||
it 'should list archived dossier' do
|
||||
it 'should list archived dossiers' do
|
||||
expect(page).to have_content(dossier_archived.procedure.libelle)
|
||||
end
|
||||
|
||||
it 'the state of dossier is displayed' do
|
||||
expect(page).to have_css("#dossier_#{dossier1.id}_state")
|
||||
end
|
||||
|
||||
context 'when user clicks on a projet in list', js: true do
|
||||
before do
|
||||
page.find("#tr_dossier_#{dossier1.id}").click
|
||||
page.click_on(dossier1.procedure.libelle)
|
||||
end
|
||||
scenario 'user is redirected to dossier page' do
|
||||
expect(page).to have_css('#users-recapitulatif-dossier-show')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when there is more than one page' do
|
||||
let(:dossiers_per_page) { 2 }
|
||||
|
||||
scenario 'the user can navigate through the other pages', js: true do
|
||||
page.click_link("Suivant")
|
||||
expect(page).to have_content(dossier_archived.procedure.libelle)
|
||||
end
|
||||
|
||||
scenario 'the user sees a card asking for feedback' do
|
||||
expect(page).to have_css('.card.feedback')
|
||||
expect(page).to have_content(CONTACT_EMAIL)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,8 +14,8 @@ describe 'layouts/_new_header.html.haml', type: :view do
|
|||
let(:user) { create(:user) }
|
||||
let(:profile) { :user }
|
||||
|
||||
it { is_expected.to have_css("a.header-logo[href=\"#{users_dossiers_path}\"]") }
|
||||
it { is_expected.to have_link("Dossiers", href: users_dossiers_path) }
|
||||
it { is_expected.to have_css("a.header-logo[href=\"#{dossiers_path}\"]") }
|
||||
it { is_expected.to have_link("Dossiers", href: dossiers_path) }
|
||||
end
|
||||
|
||||
context 'when rendering for gestionnaire' do
|
||||
|
|
Loading…
Reference in a new issue