The new CSV report was more configurable and could work on proposals,
processes and comments. However, it had several issues.
In the public area, by default it generated a blank file.
In the admin section, the report was hard to configure and it generated
a file with less quality than the old system.
So until we improve this system, we're bringing back the old investment
CSV exporter.
This commit reverts most of commit 9d1ca3bf.
28 lines
686 B
Ruby
28 lines
686 B
Ruby
module Budgets
|
|
class ResultsController < ApplicationController
|
|
before_action :load_budget
|
|
before_action :load_heading
|
|
|
|
load_and_authorize_resource :budget
|
|
|
|
def show
|
|
authorize! :read_results, @budget
|
|
@investments = Budget::Result.new(@budget, @heading).investments
|
|
@headings = @budget.headings.sort_by_name
|
|
end
|
|
|
|
private
|
|
|
|
def load_budget
|
|
@budget = Budget.find_by_slug_or_id(params[:budget_id]) || Budget.first
|
|
end
|
|
|
|
def load_heading
|
|
if @budget.present?
|
|
headings = @budget.headings
|
|
@heading = headings.find_by_slug_or_id(params[:heading_id]) || headings.first
|
|
end
|
|
end
|
|
end
|
|
end
|