Report generation. Download csv

This commit is contained in:
German Galia
2019-06-12 10:17:31 +02:00
parent 139b2720d8
commit 9d1ca3bfd4
63 changed files with 1528 additions and 40 deletions

View File

@@ -1,5 +1,6 @@
class Legislation::ProcessesController < Legislation::BaseController
include RandomSeed
include DownloadSettingsHelper
has_filters %w[open past], only: :index
has_filters %w[random winners], only: :proposals
@@ -12,6 +13,14 @@ class Legislation::ProcessesController < Legislation::BaseController
@current_filter ||= "open"
@processes = ::Legislation::Process.send(@current_filter).published
.not_in_draft.order(start_date: :desc).page(params[:page])
respond_to do |format|
format.html
format.csv { send_data to_csv(process_for_download, Legislation::Process),
type: "text/csv",
disposition: "attachment",
filename: "legislation_processes.csv" }
end
end
def show
@@ -122,6 +131,10 @@ class Legislation::ProcessesController < Legislation::BaseController
private
def process_for_download
Legislation::Process.send(@current_filter).order(start_date: :desc)
end
def member_method?
params[:id].present?
end