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