Download all gestionnaire dossier with a button

This commit is contained in:
Xavier J 2016-08-25 12:30:15 +02:00
parent 39df032c8c
commit e4cf25b677
3 changed files with 11 additions and 0 deletions

View file

@ -13,6 +13,14 @@ class Backoffice::DossiersController < ApplicationController
@champs = @facade.champs_private unless @facade.nil? @champs = @facade.champs_private unless @facade.nil?
end end
def download_dossiers_tps
dossiers = current_gestionnaire.dossiers.where.not(state: :draft)
response.headers['Content-Type'] = 'text/csv'
render csv: dossiers, status: 200
end
def search def search
@search_terms = params[:q] @search_terms = params[:q]
@dossiers_search, @dossier = Dossier.search(current_gestionnaire, @search_terms) @dossiers_search, @dossier = Dossier.search(current_gestionnaire, @search_terms)

View file

@ -1,3 +1,4 @@
=link_to 'Tous mes dossiers en CSV', backoffice_download_dossiers_tps_path, {class: 'btn btn-success btn-sm', style: 'float: right; margin-right: 4%; margin-top: 7px'}
%h1 Gestion des dossiers %h1 Gestion des dossiers
%br %br

View file

@ -152,6 +152,8 @@ Rails.application.routes.draw do
get 'reload_pref_list' get 'reload_pref_list'
end end
get 'download_dossiers_tps' => 'dossiers#download_dossiers_tps'
resources :dossiers do resources :dossiers do
post 'valid' => 'dossiers#valid' post 'valid' => 'dossiers#valid'
post 'close' => 'dossiers#close' post 'close' => 'dossiers#close'