Add tab Invitation on user dossier index view

This commit is contained in:
Xavier J 2016-02-09 12:23:31 +01:00
parent e8fcebeea9
commit dcd943a4b5
5 changed files with 37 additions and 4 deletions
app
controllers/users
views/users/dossiers
spec

View file

@ -107,7 +107,8 @@ class Users::DossiersController < UsersController
def dossiers_to_display
{'a_traiter' => waiting_for_user,
'en_attente' => waiting_for_gestionnaire,
'termine' => termine}[@liste]
'termine' => termine,
'invite' => invite}[@liste]
end
def waiting_for_user
@ -125,10 +126,16 @@ class Users::DossiersController < UsersController
@termine ||= current_user.dossiers.termine 'DESC'
end
def invite
@invite_class = (@liste == 'invite' ? 'active' : '')
@invite ||= current_user.invites
end
def total_dossiers_per_state
@dossiers_a_traiter_total = waiting_for_user.count
@dossiers_en_attente_total = waiting_for_gestionnaire.count
@dossiers_termine_total = termine.count
@dossiers_invite_total = invite.count
end
def check_siret

View file

@ -6,12 +6,18 @@
%th.col-md-2.col-lg-2= smart_listing.sortable 'État', 'state'
%th.col-md-2.col-lg-2= smart_listing.sortable 'Date de mise à jour', 'updated_at'
- @dossiers.each do |dossier|
- dossier = dossier.decorate
- if dossier.class == Invite
-invite = dossier
-dossier = dossier.dossier.decorate
- else
- dossier = dossier.decorate
%tr
%td
= dossier.procedure.libelle
%td
= link_to(dossier.nom_projet, users_dossier_recapitulatif_path(dossier))
= link_to(dossier.nom_projet, users_dossiers_invite_path(id: invite.id)) unless invite.nil?
= link_to(dossier.nom_projet, users_dossier_recapitulatif_path(dossier)) if invite.nil?
%td{id: "dossier_#{dossier.id}_state"}= dossier.display_state
%td= dossier.last_update

View file

@ -23,4 +23,11 @@
= "Terminé"
.badge.progress-bar-success
= @dossiers_termine_total
%li{ class: @invite_class }
%a{:href => "#{url_for users_dossiers_path(liste: 'invite')}"}
%h5{style: 'color: #696969'}
= "Invitation"
.badge{style: 'background-color: #696969'}
= @dossiers_invite_total
%br

View file

@ -345,4 +345,17 @@ describe Users::DossiersController, type: :controller do
end
end
end
describe 'GET #invite' do
context 'when user is connected' do
before do
sign_in user
end
it 'returns http success' do
get :index, liste: :invite
expect(response).to have_http_status(200)
end
end
end
end

View file

@ -399,7 +399,7 @@ describe Dossier do
end
end
context 'gestionnaire backoffice methods' do
describe 'gestionnaire backoffice methods' do
let(:admin) { create(:administrateur) }
let(:admin_2) { create(:administrateur) }