[#2874] Show archived / followed status of dossier in search result

This commit is contained in:
Frederic Merizen 2018-10-18 15:21:58 +02:00
parent 447e54fe45
commit 4b2a06acb5
2 changed files with 6 additions and 0 deletions

View file

@ -3,6 +3,10 @@ module NewGestionnaire
def index
@search_terms = params[:q]
@dossiers = DossierSearchService.matching_dossiers_for_gestionnaire(@search_terms, current_gestionnaire)
@followed_dossiers_id = current_gestionnaire
.followed_dossiers
.where(procedure_id: @dossiers.pluck(:procedure_id))
.pluck(:id)
end
end
end

View file

@ -14,6 +14,7 @@
%th Démarche
%th Demandeur
%th.status-col Statut
%th.follow-col
%tbody
- @dossiers.each do |dossier|
/ # FIXME: here we have a n+1, we fire a request
@ -30,5 +31,6 @@
%td.status-col
= link_to(dossier_linked_path(current_gestionnaire, dossier), class: 'cell-link') do
= render partial: 'shared/dossiers/status_badge', locals: { dossier: dossier }
%td.follow-col= render partial: 'new_gestionnaire/procedures/dossier_actions', locals: { procedure: dossier.procedure, dossier: dossier, dossier_is_followed: @followed_dossiers_id.include?(dossier.id) }
- else
%h2 Aucun dossier correspondant à votre recherche n'a été trouvé