Merge pull request #1133 from sgmap/fix_1118
[Fix #1118] New ui is the default ui for gestionnaire
This commit is contained in:
commit
d222c707f5
11 changed files with 24 additions and 55 deletions
|
@ -39,7 +39,7 @@ class Backoffice::AvisController < ApplicationController
|
|||
sign_in(gestionnaire, scope: :gestionnaire)
|
||||
Avis.link_avis_to_gestionnaire(gestionnaire)
|
||||
avis = Avis.find(params[:id])
|
||||
redirect_to url_for(backoffice_dossier_path(avis.dossier_id))
|
||||
redirect_to url_for(avis_index_path)
|
||||
else
|
||||
flash[:alert] = gestionnaire.errors.full_messages
|
||||
redirect_to url_for(avis_sign_up_path(params[:id], email))
|
||||
|
|
|
@ -8,9 +8,4 @@ class Gestionnaires::SessionsController < Sessions::SessionsController
|
|||
def create
|
||||
super
|
||||
end
|
||||
|
||||
def after_sign_in_path_for(resource)
|
||||
# stored_location_for(resource) ||
|
||||
backoffice_path
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,32 +2,19 @@ class RootController < ApplicationController
|
|||
layout 'new_application'
|
||||
|
||||
def index
|
||||
if params[:new_ui] && gestionnaire_signed_in? # TODO delete new_ui when old UI is no longer used
|
||||
# TODO delete new_ui when old UI is no longer used
|
||||
if params[:new_ui].present? && gestionnaire_signed_in?
|
||||
return redirect_to procedures_path
|
||||
end
|
||||
|
||||
if administrateur_signed_in?
|
||||
elsif administrateur_signed_in?
|
||||
return redirect_to admin_procedures_path
|
||||
|
||||
elsif gestionnaire_signed_in?
|
||||
return redirect_to backoffice_invitations_path if current_gestionnaire.avis.any?
|
||||
|
||||
procedure_id = current_gestionnaire.procedure_filter
|
||||
if procedure_id.nil?
|
||||
procedure_list = current_gestionnaire.procedures
|
||||
|
||||
if procedure_list.count > 0
|
||||
return redirect_to backoffice_dossiers_procedure_path(id: procedure_list.first.id)
|
||||
else
|
||||
flash.alert = "Vous n'avez aucune procédure d'affectée"
|
||||
end
|
||||
else
|
||||
return redirect_to backoffice_dossiers_procedure_path(id: procedure_id)
|
||||
# to be removed when old ui is deleted
|
||||
if params[:old_ui].present?
|
||||
return redirect_to backoffice_path
|
||||
end
|
||||
|
||||
return redirect_to procedures_path
|
||||
elsif user_signed_in?
|
||||
return redirect_to users_dossiers_path
|
||||
|
||||
elsif administration_signed_in?
|
||||
return redirect_to administrations_path
|
||||
end
|
||||
|
|
|
@ -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) || backoffice_path
|
||||
location = stored_location_for(:gestionnaire) || procedures_path
|
||||
redirect_to location
|
||||
elsif administrateur_signed_in?
|
||||
redirect_to admin_path
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
.col-xs-2
|
||||
%a#title-navbar{ href: '/' }
|
||||
%a#title-navbar{ href: root_path(old_ui: 1) }
|
||||
.row#home
|
||||
.col-lg-6.no-padding
|
||||
= image_tag('marianne_small.png', class: 'logo')
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
Usager
|
||||
- if gestionnaire_signed_in?
|
||||
%li
|
||||
= link_to(backoffice_dossiers_path) do
|
||||
= link_to(procedures_path) do
|
||||
%i.fa.fa-user
|
||||
|
||||
Accompagnateur
|
||||
|
|
|
@ -177,7 +177,7 @@ describe Backoffice::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 backoffice_dossier_path(dossier) }
|
||||
it { is_expected.to redirect_to avis_index_path }
|
||||
end
|
||||
|
||||
context 'when the gestionnaire creation fails' do
|
||||
|
|
|
@ -13,27 +13,20 @@ describe RootController, type: :controller do
|
|||
|
||||
context 'when Gestionnaire is connected' do
|
||||
let(:gestionnaire) { create(:gestionnaire) }
|
||||
let(:procedure) { create(:procedure, :published) }
|
||||
let(:dossier) { create(:dossier, :en_construction, procedure: procedure) }
|
||||
|
||||
before do
|
||||
gestionnaire.procedures << procedure
|
||||
sign_in gestionnaire
|
||||
end
|
||||
|
||||
context 'when gestionnaire is affect to a procedure' do
|
||||
before do
|
||||
create :assign_to, procedure: (create :procedure, :published), gestionnaire: gestionnaire
|
||||
end
|
||||
it { expect(subject).to redirect_to(procedures_path) }
|
||||
|
||||
it { expect(subject).to redirect_to(backoffice_dossiers_procedure_path(id: Procedure.all.first.id)) }
|
||||
end
|
||||
context 'and coming with old_ui param' do
|
||||
subject { get :index, params: { old_ui: 1 } }
|
||||
|
||||
context 'when gestionnaire is not affect to a procedure' do
|
||||
render_views
|
||||
|
||||
before do
|
||||
subject
|
||||
end
|
||||
|
||||
it { expect(response.body).to have_css('.landing') }
|
||||
it { expect(subject).to redirect_to(backoffice_path) }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@ feature 'when gestionnaire come to /backoffice and is not authenticated' do
|
|||
page.find_by_id(:user_password).set gestionnaire.password
|
||||
page.click_on 'Se connecter'
|
||||
end
|
||||
scenario 'he is redirected to /backoffice' do
|
||||
expect(page).to have_css('#backoffice-index')
|
||||
scenario 'he is redirected to /procedures' do
|
||||
expect(current_path).to eq(procedures_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,6 +22,7 @@ feature 'on backoffice page', js: true do
|
|||
page.find_by_id(:user_email).set gestionnaire.email
|
||||
page.find_by_id(:user_password).set gestionnaire.password
|
||||
page.click_on 'Se connecter'
|
||||
page.click_on 'Ancienne interface'
|
||||
end
|
||||
context 'when he click on first dossier' do
|
||||
before do
|
||||
|
|
|
@ -10,7 +10,6 @@ feature 'The gestionnaire part' do
|
|||
scenario 'A gestionnaire can accept a dossier' do
|
||||
log_in(gestionnaire.email, password)
|
||||
|
||||
click_on 'nouvelle interface'
|
||||
expect(page).to have_current_path(procedures_path)
|
||||
|
||||
click_on procedure.libelle
|
||||
|
@ -36,8 +35,6 @@ feature 'The gestionnaire part' do
|
|||
scenario 'A gestionnaire can follow/unfollow a dossier' do
|
||||
log_in(gestionnaire.email, password)
|
||||
|
||||
click_on 'nouvelle interface'
|
||||
|
||||
click_on procedure.libelle
|
||||
test_statut_bar(a_suivre: 1, tous_les_dossiers: 1)
|
||||
dossier_present?(dossier.id, 'en construction')
|
||||
|
@ -62,7 +59,6 @@ feature 'The gestionnaire part' do
|
|||
|
||||
log_in(gestionnaire.email, password)
|
||||
|
||||
click_on 'nouvelle interface'
|
||||
click_on procedure.libelle
|
||||
click_on dossier.user.email
|
||||
|
||||
|
@ -79,7 +75,6 @@ feature 'The gestionnaire part' do
|
|||
|
||||
avis_sign_up(avis, expert_email, 'a good password')
|
||||
|
||||
click_on 'nouvelle interface'
|
||||
expect(page).to have_current_path(avis_index_path)
|
||||
expect(page).to have_text('avis à donner 1')
|
||||
expect(page).to have_text('avis donnés 0')
|
||||
|
@ -104,7 +99,6 @@ feature 'The gestionnaire part' do
|
|||
|
||||
log_in(gestionnaire.email, password)
|
||||
|
||||
click_on 'nouvelle interface'
|
||||
click_on procedure.libelle
|
||||
click_on dossier.user.email
|
||||
click_on 'Avis externes'
|
||||
|
@ -117,7 +111,6 @@ feature 'The gestionnaire part' do
|
|||
|
||||
log_in(gestionnaire.email, password)
|
||||
|
||||
click_on 'nouvelle interface'
|
||||
click_on procedure.libelle
|
||||
click_on dossier.user.email
|
||||
|
||||
|
@ -143,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(backoffice_dossiers_procedure_path(procedure))
|
||||
expect(page).to have_current_path(procedures_path)
|
||||
end
|
||||
|
||||
def log_out
|
||||
|
@ -178,7 +171,7 @@ feature 'The gestionnaire part' do
|
|||
visit avis_sign_up_path(avis, email)
|
||||
fill_in 'gestionnaire_password', with: 'a good password'
|
||||
click_on 'Créer un compte'
|
||||
expect(page).to have_current_path(backoffice_dossier_path(dossier))
|
||||
expect(page).to have_current_path(avis_index_path)
|
||||
end
|
||||
|
||||
def dossier_present?(id, statut)
|
||||
|
|
Loading…
Reference in a new issue