Show valuation comments at admin investment show page

This commit is contained in:
Bertocq
2018-01-31 16:35:45 +01:00
parent 528c9be925
commit b926740a32
2 changed files with 19 additions and 1 deletions

View File

@@ -1,8 +1,10 @@
class Admin::BudgetInvestmentsController < Admin::BaseController class Admin::BudgetInvestmentsController < Admin::BaseController
include FeatureFlags include FeatureFlags
include CommentableActions
feature_flag :budgets feature_flag :budgets
has_orders %w{oldest}, only: [:show, :edit]
has_filters(%w{all without_admin without_valuator under_valuation has_filters(%w{all without_admin without_valuator under_valuation
valuation_finished winners}, valuation_finished winners},
only: [:index, :toggle_selection]) only: [:index, :toggle_selection])
@@ -24,6 +26,7 @@ class Admin::BudgetInvestmentsController < Admin::BaseController
end end
def show def show
load_comments
end end
def edit def edit
@@ -55,6 +58,20 @@ class Admin::BudgetInvestmentsController < Admin::BaseController
private 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) def sort_by(params)
if params.present? && Budget::Investment::SORTING_OPTIONS.include?(params) if params.present? && Budget::Investment::SORTING_OPTIONS.include?(params)
"#{params == 'supports' ? 'cached_votes_up' : params} ASC" "#{params == 'supports' ? 'cached_votes_up' : params} ASC"

View File

@@ -45,6 +45,7 @@
<%= link_to t("admin.budget_investments.show.edit_dossier"), edit_valuation_budget_budget_investment_path(@budget, @investment) unless @budget.finished? %> <%= link_to t("admin.budget_investments.show.edit_dossier"), edit_valuation_budget_budget_investment_path(@budget, @investment) unless @budget.finished? %>
</p> </p>
<%= render 'valuation/budget_investments/valuation_comments' %>
<h2><%= t("admin.budget_investments.show.milestone") %></h2> <h2><%= t("admin.budget_investments.show.milestone") %></h2>