Report generation. Download csv
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
module Budgets
|
||||
class ExecutionsController < ApplicationController
|
||||
include DownloadSettingsHelper
|
||||
before_action :load_budget
|
||||
|
||||
load_and_authorize_resource :budget
|
||||
@@ -8,6 +9,19 @@ module Budgets
|
||||
authorize! :read_executions, @budget
|
||||
@statuses = Milestone::Status.all
|
||||
@investments_by_heading = investments_by_heading_ordered_alphabetically.to_h
|
||||
downloadables = []
|
||||
investments_by_heading_ordered_alphabetically
|
||||
.map { |heading| downloadables.concat heading[1] }
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.csv { send_data to_csv(downloadables,
|
||||
Budget::Investment,
|
||||
1),
|
||||
type: "text/csv",
|
||||
disposition: "attachment",
|
||||
filename: "budget_investment_milestones.csv" }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user