adds helper to fix links to commentable
This commit is contained in:
@@ -20,6 +20,14 @@ module CommentsHelper
|
||||
end
|
||||
end
|
||||
|
||||
def commentable_path(comment)
|
||||
if comment.commentable_type == "Budget::Investment"
|
||||
budget_investment_path(comment.commentable.budget_id, comment.commentable)
|
||||
else
|
||||
comment.commentable
|
||||
end
|
||||
end
|
||||
|
||||
def user_level_class(comment)
|
||||
if comment.as_administrator?
|
||||
"is-admin"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="row">
|
||||
<div class="small-12 column margin-top">
|
||||
<%= link_to @comment.commentable, class: "back" do %>
|
||||
<%= link_to commentable_path(@comment), class: "back" do %>
|
||||
<span class="icon-angle-left"></span>
|
||||
<%= t("comments.show.return_to_commentable") + @comment.commentable.title %>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user