Merge pull request #3410 from LextrendIT/report_generation

Report generation, download CSV
This commit is contained in:
Raimond Garcia
2019-06-12 11:45:59 +02:00
committed by GitHub
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
@@ -14,6 +15,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
@@ -139,6 +148,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