Merge branch 'develop' into staging

This commit is contained in:
Xavier J 2016-10-11 18:06:00 +02:00
commit 533aaf281b
5 changed files with 31 additions and 5 deletions

View file

@ -7,7 +7,7 @@ class Backoffice::DossiersListController < ApplicationController
def index def index
cookies[:liste] = param_liste cookies[:liste] = param_liste
unless DossiersListGestionnaireService.dossiers_list_libelle.include?(param_liste) unless DossiersListGestionnaireService.dossiers_liste_libelle.include?(param_liste)
cookies[:liste] = 'a_traiter' cookies[:liste] = 'a_traiter'
return redirect_to backoffice_dossiers_path return redirect_to backoffice_dossiers_path
end end

View file

@ -10,10 +10,14 @@ class Users::DossiersController < UsersController
end end
def index def index
liste = params[:liste] || cookies[:liste] || 'a_traiter' cookies[:liste] = param_liste
cookies[:liste] = liste
@dossiers_list_facade = DossiersListFacades.new current_user, liste @dossiers_list_facade = DossiersListFacades.new current_user, param_liste
unless DossiersListUserService.dossiers_liste_libelle.include?(param_liste)
cookies[:liste] = 'a_traiter'
return redirect_to users_dossiers_path
end
@dossiers = smart_listing_create :dossiers, @dossiers = smart_listing_create :dossiers,
@dossiers_list_facade.dossiers_to_display, @dossiers_list_facade.dossiers_to_display,
@ -169,4 +173,8 @@ class Users::DossiersController < UsersController
def facade id = params[:id] def facade id = params[:id]
DossierFacades.new id, current_user.email DossierFacades.new id, current_user.email
end end
def param_liste
@liste ||= params[:liste] || cookies[:liste] || 'a_traiter'
end
end end

View file

@ -14,7 +14,7 @@ class DossiersListGestionnaireService
'termine' => termine}[@liste] 'termine' => termine}[@liste]
end end
def self.dossiers_list_libelle def self.dossiers_liste_libelle
['nouveaux', 'a_traiter', 'en_attente', 'deposes', 'a_instruire', 'termine'] ['nouveaux', 'a_traiter', 'en_attente', 'deposes', 'a_instruire', 'termine']
end end

View file

@ -15,6 +15,10 @@ class DossiersListUserService
'invite' => invite}[@liste] 'invite' => invite}[@liste]
end end
def self.dossiers_liste_libelle
['brouillon', 'nouveaux', 'a_traiter', 'en_attente', 'valides', 'en_instruction', 'termine', 'invite']
end
def brouillon def brouillon
@brouillon ||= @current_devise_profil.dossiers.brouillon @brouillon ||= @current_devise_profil.dossiers.brouillon
end end

View file

@ -456,4 +456,18 @@ describe Users::DossiersController, type: :controller do
end end
end end
end end
describe 'GET #list_fake' do
context 'when user is connected' do
before do
sign_in user
end
it 'returns http success' do
get :index, liste: :list_fake
expect(response).to redirect_to(users_dossiers_path)
end
end
end
end end