From b926740a32480a9350765a1f76d645e23d69152b Mon Sep 17 00:00:00 2001
From: Bertocq
Date: Wed, 31 Jan 2018 16:35:45 +0100
Subject: [PATCH] Show valuation comments at admin investment show page
---
.../admin/budget_investments_controller.rb | 19 ++++++++++++++++++-
.../admin/budget_investments/show.html.erb | 1 +
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/app/controllers/admin/budget_investments_controller.rb b/app/controllers/admin/budget_investments_controller.rb
index 869ba1ad4..2e5c17329 100644
--- a/app/controllers/admin/budget_investments_controller.rb
+++ b/app/controllers/admin/budget_investments_controller.rb
@@ -1,8 +1,10 @@
class Admin::BudgetInvestmentsController < Admin::BaseController
-
include FeatureFlags
+ include CommentableActions
+
feature_flag :budgets
+ has_orders %w{oldest}, only: [:show, :edit]
has_filters(%w{all without_admin without_valuator under_valuation
valuation_finished winners},
only: [:index, :toggle_selection])
@@ -24,6 +26,7 @@ class Admin::BudgetInvestmentsController < Admin::BaseController
end
def show
+ load_comments
end
def edit
@@ -55,6 +58,20 @@ class Admin::BudgetInvestmentsController < Admin::BaseController
private
+ def load_comments
+ @commentable = @investment
+ @comment_tree = CommentTree.new(@commentable, params[:page], @current_order, valuations: true)
+ set_comment_flags(@comment_tree.comments)
+ end
+
+ def resource_model
+ Budget::Investment
+ end
+
+ def resource_name
+ resource_model.parameterize('_')
+ end
+
def sort_by(params)
if params.present? && Budget::Investment::SORTING_OPTIONS.include?(params)
"#{params == 'supports' ? 'cached_votes_up' : params} ASC"
diff --git a/app/views/admin/budget_investments/show.html.erb b/app/views/admin/budget_investments/show.html.erb
index 2c13d50e3..939830aff 100644
--- a/app/views/admin/budget_investments/show.html.erb
+++ b/app/views/admin/budget_investments/show.html.erb
@@ -45,6 +45,7 @@
<%= link_to t("admin.budget_investments.show.edit_dossier"), edit_valuation_budget_budget_investment_path(@budget, @investment) unless @budget.finished? %>
+<%= render 'valuation/budget_investments/valuation_comments' %>
<%= t("admin.budget_investments.show.milestone") %>