From c815ec5e826326b3af2cc3a115040c65843721d9 Mon Sep 17 00:00:00 2001 From: Xavier J Date: Thu, 5 Jan 2017 19:07:01 +0100 Subject: [PATCH] Add tab for follow dossier in gestionnaire dashboard --- .../backoffice/dossiers_controller.rb | 2 +- .../backoffice/dossiers_list_controller.rb | 8 ++++---- .../dossiers_list_gestionnaire_service.rb | 20 ++++++++++--------- app/views/backoffice/dossiers/index.html.haml | 13 ++++++++++++ ...dossiers_list_gestionnaire_service_spec.rb | 2 +- 5 files changed, 30 insertions(+), 15 deletions(-) diff --git a/app/controllers/backoffice/dossiers_controller.rb b/app/controllers/backoffice/dossiers_controller.rb index 3227eac29..43d679926 100644 --- a/app/controllers/backoffice/dossiers_controller.rb +++ b/app/controllers/backoffice/dossiers_controller.rb @@ -150,7 +150,7 @@ class Backoffice::DossiersController < Backoffice::DossiersListController begin @liste = URI(request.referer).query.split('=').second rescue NoMethodError - @liste = cookies[:liste] || 'a_traiter' + @liste = cookies[:liste] || 'all_state' end smartlisting_dossier diff --git a/app/controllers/backoffice/dossiers_list_controller.rb b/app/controllers/backoffice/dossiers_list_controller.rb index ad38d17e5..2bcb2a6dd 100644 --- a/app/controllers/backoffice/dossiers_list_controller.rb +++ b/app/controllers/backoffice/dossiers_list_controller.rb @@ -8,7 +8,7 @@ class Backoffice::DossiersListController < ApplicationController cookies[:liste] = param_liste unless DossiersListGestionnaireService.dossiers_liste_libelle.include?(param_liste) - cookies[:liste] = 'a_traiter' + cookies[:liste] = 'all_state' end dossiers_list_facade param_liste @@ -23,11 +23,11 @@ class Backoffice::DossiersListController < ApplicationController dossiers_list_facade.service.add_filter param_filter end - def dossiers_list_facade liste='a_traiter' + def dossiers_list_facade liste='all_state' @facade_data_view ||= DossiersListFacades.new current_gestionnaire, liste, retrieve_procedure end - def smartlisting_dossier dossiers_list=nil, liste='a_traiter' + def smartlisting_dossier dossiers_list=nil, liste='all_state' dossiers_list_facade liste new_dossiers_list = dossiers_list_facade.service.nouveaux @@ -79,6 +79,6 @@ class Backoffice::DossiersListController < ApplicationController end def param_liste - @liste ||= params[:liste] || cookies[:liste] || 'a_traiter' + @liste ||= params[:liste] || cookies[:liste] || 'all_state' end end diff --git a/app/services/dossiers_list_gestionnaire_service.rb b/app/services/dossiers_list_gestionnaire_service.rb index 85d0b32e5..5b3f5cc22 100644 --- a/app/services/dossiers_list_gestionnaire_service.rb +++ b/app/services/dossiers_list_gestionnaire_service.rb @@ -6,14 +6,16 @@ class DossiersListGestionnaireService end def dossiers_to_display - {'nouveaux' => nouveaux, - 'suivi' => suivi, - 'a_traiter' => ouvert, - 'fige' => fige, - 'deposes' => deposes, - 'a_instruire' => a_instruire, - 'termine' => termine, - 'all_state' => all_state}[@liste] + @dossiers_to_display ||= + {'nouveaux' => nouveaux, + # 'suivi' => suivi, + 'a_traiter' => ouvert, + 'fige' => fige, + 'deposes' => deposes, + 'a_instruire' => a_instruire, + 'termine' => termine, + 'all_state' => all_state}[@liste] + end def self.dossiers_liste_libelle @@ -25,7 +27,7 @@ class DossiersListGestionnaireService end def suivi - @suivi ||= @current_devise_profil.dossiers_follow.merge(all_state) + @suivi ||= @current_devise_profil.dossiers_follow.merge(dossiers_to_display) end def nouveaux diff --git a/app/views/backoffice/dossiers/index.html.haml b/app/views/backoffice/dossiers/index.html.haml index adaeeed1e..4c622f1ec 100644 --- a/app/views/backoffice/dossiers/index.html.haml +++ b/app/views/backoffice/dossiers/index.html.haml @@ -15,6 +15,19 @@ %div.body = smart_listing_render :new_dossiers + .row.center + .col-lg-1.col-md-1.col-sm-1.col-xs-1 + .col-lg-2.col-md-2.col-sm-2.col-xs-2 + =link_to 'Tous les états', '?liste=all_state', class: 'text-info', style:"text-decoration: #{@facade_data_view.liste == 'all_state'? 'underline' : ''}" + .col-lg-2.col-md-2.col-sm-2.col-xs-2 + =link_to 'En construction', '?liste=a_traiter', class: 'text-danger', style:"text-decoration: #{@facade_data_view.liste == 'a_traiter'? 'underline' : ''}" + .col-lg-2.col-md-2.col-sm-2.col-xs-2 + =link_to 'À receptionner', '?liste=deposes', class: 'text-purple', style:"text-decoration: #{@facade_data_view.liste == 'deposes'? 'underline' : ''}" + .col-lg-2.col-md-2.col-sm-2.col-xs-2 + =link_to 'À instruire', '?liste=a_instruire', class: 'text-warning', style:"text-decoration: #{@facade_data_view.liste == 'a_instruire'? 'underline' : ''}" + .col-lg-2.col-md-2.col-sm-2.col-xs-2 + =link_to 'Terminés', '?liste=termine', class: 'text-success', style:"text-decoration: #{@facade_data_view.liste == 'termine'? 'underline' : ''}" + .default_data_block.default_visible %div.row.show-block#follow_dossiers %div.header diff --git a/spec/services/dossiers_list_gestionnaire_service_spec.rb b/spec/services/dossiers_list_gestionnaire_service_spec.rb index 13cbb7334..1594aa286 100644 --- a/spec/services/dossiers_list_gestionnaire_service_spec.rb +++ b/spec/services/dossiers_list_gestionnaire_service_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe DossiersListGestionnaireService do let(:gestionnaire) { create :gestionnaire } let(:preference_smart_listing_page) { gestionnaire.preference_smart_listing_page } - let(:liste) { 'a_traiter' } + let(:liste) { 'all_state' } let(:dossier) { create :dossier } let(:accompagnateur_service) { AccompagnateurService.new gestionnaire, procedure, 'assign' }