Dossier_list_controller: factorize smart_listing_create

This commit is contained in:
Simon Lehericey 2017-03-01 14:19:22 +01:00
parent 87865fcf1b
commit 8dc634f4d3

View file

@ -38,38 +38,28 @@ class Backoffice::DossiersListController < ApplicationController
params[:dossiers_smart_listing] = {page: dossiers_list_facade.service.default_page} params[:dossiers_smart_listing] = {page: dossiers_list_facade.service.default_page}
end end
smart_listing_create :new_dossiers, default_smart_listing_create :new_dossiers, new_dossiers_list
new_dossiers_list,
partial: "backoffice/dossiers/list",
array: true,
default_sort: dossiers_list_facade.service.default_sort
smart_listing_create :follow_dossiers, default_smart_listing_create :follow_dossiers, follow_dossiers_list
follow_dossiers_list,
partial: "backoffice/dossiers/list",
array: true,
default_sort: dossiers_list_facade.service.default_sort
smart_listing_create :all_state_dossiers,
all_state_dossiers_list,
partial: "backoffice/dossiers/list",
array: true,
default_sort: dossiers_list_facade.service.default_sort
default_smart_listing_create :all_state_dossiers, all_state_dossiers_list
procedure_id = params[:id] || params[:procedure_id] procedure_id = params[:id] || params[:procedure_id]
@procedure = current_gestionnaire.procedures.find(procedure_id) @procedure = current_gestionnaire.procedures.find(procedure_id)
@dossiers_archived = @procedure.dossiers.archived @dossiers_archived = @procedure.dossiers.archived
smart_listing_create :dossiers_archived, default_smart_listing_create :dossiers_archived, @dossiers_archived
@dossiers_archived,
partial: "backoffice/dossiers/list",
array: true,
default_sort: dossiers_list_facade.service.default_sort
end end
private private
def default_smart_listing_create name, collection
smart_listing_create name,
collection,
partial: 'backoffice/dossiers/list',
array: true,
default_sort: dossiers_list_facade.service.default_sort
end
def param_smart_listing def param_smart_listing
params[:dossiers_smart_listing] params[:dossiers_smart_listing]
end end