Disallow valuation comment creation on finished budget
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
<% valuation = local_assigns.fetch(:valuation, false) %>
|
||||
<% allow_votes = local_assigns.fetch(:allow_votes, true) %>
|
||||
<% allow_flagging = local_assigns.fetch(:allow_flagging, true) %>
|
||||
<% allow_comments = local_assigns.fetch(:allow_comments, true) %>
|
||||
<% cache [locale_and_user_status(comment), comment, commentable_cache_key(comment.commentable), comment.author, (comment_flags[comment.id] if comment_flags)] do %>
|
||||
<ul id="<%= dom_id(comment) %>" class="comment no-bullet small-12">
|
||||
<li class="comment-body">
|
||||
@@ -94,10 +95,12 @@
|
||||
<%= render 'comments/actions', { comment: comment,
|
||||
allow_flagging: allow_flagging } %>
|
||||
|
||||
<%= render 'comments/form', {commentable: comment.commentable,
|
||||
parent_id: comment.id,
|
||||
toggeable: true,
|
||||
valuation: valuation } %>
|
||||
<% if allow_comments %>
|
||||
<%= render 'comments/form', {commentable: comment.commentable,
|
||||
parent_id: comment.id,
|
||||
toggeable: true,
|
||||
valuation: valuation } %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -110,7 +113,8 @@
|
||||
<%= render 'comments/comment', { comment: child,
|
||||
valuation: valuation,
|
||||
allow_votes: allow_votes,
|
||||
allow_flagging: allow_flagging } %>
|
||||
allow_flagging: allow_flagging,
|
||||
allow_comments: allow_comments } %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<% commentable = comment_tree.commentable %>
|
||||
<% valuation = local_assigns.fetch(:valuation, false) %>
|
||||
<% allow_comments = local_assigns.fetch(:allow_comments, true) %>
|
||||
<% cache [locale_and_user_status, comment_tree.order, commentable_cache_key(commentable), comment_tree.comments, comment_tree.comment_authors, commentable.comments_count, comment_flags] do %>
|
||||
<section class="expanded comments">
|
||||
<div class="row">
|
||||
@@ -24,7 +25,7 @@
|
||||
<div data-alert class="callout primary">
|
||||
<%= t("comments.verified_only", verify_account: link_to(t("comments.verify_account"), verification_path )).html_safe %>
|
||||
</div>
|
||||
<% else %>
|
||||
<% elsif allow_comments %>
|
||||
<%= render 'comments/form', { commentable: commentable,
|
||||
parent_id: nil,
|
||||
toggeable: false,
|
||||
@@ -44,7 +45,8 @@
|
||||
comment_flags: comment_flags,
|
||||
valuation: valuation,
|
||||
allow_votes: !valuation,
|
||||
allow_flagging: !valuation } %>
|
||||
allow_flagging: !valuation,
|
||||
allow_comments: allow_comments } %>
|
||||
<% end %>
|
||||
<%= paginate comment_tree.root_comments %>
|
||||
</div>
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
<% valuation = local_assigns.fetch(:valuation, false) %>
|
||||
<% allow_comments = local_assigns.fetch(:allow_comments, true) %>
|
||||
<% cache [locale_and_user_status, @current_order, commentable_cache_key(@investment), @comment_tree.comments, @comment_tree.comment_authors, @investment.comments_count, @comment_flags] do %>
|
||||
<section class="expanded comments">
|
||||
<div class="row">
|
||||
@@ -9,11 +11,11 @@
|
||||
|
||||
<%= render 'shared/wide_order_selector', i18n_namespace: "comments" %>
|
||||
|
||||
<% if user_signed_in? %>
|
||||
<% if user_signed_in? && allow_comments %>
|
||||
<%= render 'comments/form', { commentable: @investment,
|
||||
parent_id: nil,
|
||||
toggeable: false,
|
||||
valuation: local_assigns.fetch(:valuation, false) } %>
|
||||
valuation: valuation } %>
|
||||
<% else %>
|
||||
<br>
|
||||
|
||||
@@ -26,7 +28,8 @@
|
||||
|
||||
<% @comment_tree.root_comments.each do |comment| %>
|
||||
<%= render 'comments/comment', { comment: comment,
|
||||
valuation: local_assigns.fetch(:valuation, false) } %>
|
||||
valuation: valuation,
|
||||
allow_comments: allow_comments } %>
|
||||
<% end %>
|
||||
<%= paginate @comment_tree.root_comments %>
|
||||
</div>
|
||||
|
||||
@@ -3,5 +3,6 @@
|
||||
<%= render partial: '/comments/comment_tree', locals: { comment_tree: @comment_tree,
|
||||
comment_flags: @comment_flags,
|
||||
display_comments_count: false,
|
||||
valuation: true } %>
|
||||
valuation: true,
|
||||
allow_comments: !@budget.finished? } %>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user