Use comments component for investments valuation comments
This commit is contained in:
@@ -4,13 +4,13 @@
|
||||
|
||||
<% cache cache_key do %>
|
||||
<% if current_user %>
|
||||
<%= render "comments/form", { commentable: record, parent_id: nil } %>
|
||||
<%= render "comments/form", { commentable: record, parent_id: nil, valuation: valuation } %>
|
||||
<% else %>
|
||||
<%= render "shared/login_to_comment" %>
|
||||
<% end %>
|
||||
|
||||
<%= render Shared::OrderLinksComponent.new("comments", anchor: "comments") %>
|
||||
<%= render "comments/comment_list", comments: comment_tree.root_comments %>
|
||||
<%= render "comments/comment_list", comments: comment_tree.root_comments, valuation: valuation %>
|
||||
<%= paginate comment_tree.root_comments, params: { anchor: "comments" } %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
class Shared::CommentsComponent < ApplicationComponent
|
||||
attr_reader :record, :comment_tree
|
||||
attr_reader :record, :comment_tree, :valuation
|
||||
use_helpers :current_user, :current_order, :locale_and_user_status, :commentable_cache_key
|
||||
|
||||
def initialize(record, comment_tree)
|
||||
def initialize(record, comment_tree, valuation: false)
|
||||
@record = record
|
||||
@comment_tree = comment_tree
|
||||
@valuation = valuation
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user