proposition de simplification

This commit is contained in:
simon lehericey 2021-05-17 15:42:21 +02:00 committed by kara Diaby
parent 02e2128fb7
commit 663d287962
3 changed files with 18 additions and 8 deletions

View file

@ -17,14 +17,16 @@ class RechercheController < ApplicationController
expert_dossiers_ids = @dossier_avis_ids_h.keys
matching_dossiers_ids.concat(DossierSearchService.matching_dossiers(expert_dossiers_ids, @search_terms))
@dossiers_count = matching_dossiers_ids.count
@paginated_ids = Kaminari
.paginate_array(matching_dossiers_ids.uniq)
.page(page)
.per(ITEMS_PER_PAGE)
@dossiers_count = matching_dossiers_ids.count
@projected_dossiers = DossierProjectionService.project(@paginated_ids, PROJECTIONS)
@followed_dossiers_id = current_instructeur&.followed_dossiers&.where(id: @paginated_ids)&.ids || []
end
private

View file

@ -1,19 +1,19 @@
- if Dossier::EN_CONSTRUCTION_OU_INSTRUCTION.include?(state)
- if dossier_is_followed
= link_to unfollow_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, class: defined?(button_class) && button_class.blank? ? '' : 'button' do
= link_to unfollow_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, class: 'button' do
%span.icon.unfollow>
Ne plus suivre
- else
= link_to follow_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, class: defined?(button_class) && button_class.blank? ? '' : 'button' do
= link_to follow_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, class: 'button' do
%span.icon.follow>
Suivre le dossier
- elsif Dossier::TERMINE.include?(state)
- if archived
= link_to unarchive_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, class: defined?(button_class) && button_class.blank? ? '' : 'button' do
= link_to unarchive_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, class: 'button' do
%span.icon.unarchive>
Désarchiver le dossier
- else
= link_to archive_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, class: defined?(button_class) && button_class.blank? ? '' : 'button' do
= link_to archive_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, class: 'button' do
%span.icon.archive>
Archiver le dossier

View file

@ -36,7 +36,7 @@
.cell-link= procedure_libelle
%td
.cell-link= user_email
%td
%td.status-col
.cell-link= status_badge(p.state)
- else
@ -74,11 +74,19 @@
%span.icon.in-progress>
.dropdown-description
Donner mon avis
- elsif instructeur_dossier
%td.action-col.follow-col= render partial: "instructeurs/procedures/dossier_actions",
locals: { procedure_id: procedure_id,
dossier_id: p.dossier_id,
state: p.state,
archived: p.archived,
dossier_is_followed: @followed_dossiers_id.include?(p.dossier_id) }
- else
%td
= pagination
- else
%h2 Aucun dossier correspondant à votre recherche n'a été trouvé