Merge pull request #1706 from consul/refactor_test
Refactor comments partial
This commit is contained in:
@@ -1,41 +0,0 @@
|
||||
<% commentable = comment_tree.commentable %>
|
||||
<% current_order = comment_tree.order %>
|
||||
|
||||
<% cache [locale_and_user_status, current_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">
|
||||
<div id="comments" class="small-12 column">
|
||||
|
||||
<%= render 'shared/wide_order_selector', i18n_namespace: "comments" %>
|
||||
|
||||
<% if user_signed_in? %>
|
||||
<% if comments_closed_for_commentable?(commentable) %>
|
||||
<br>
|
||||
<div data-alert class="callout primary">
|
||||
<%= comments_closed_text(commentable) %>
|
||||
</div>
|
||||
<% elsif require_verified_resident_for_commentable?(commentable, current_user) %>
|
||||
<br>
|
||||
<div data-alert class="callout primary">
|
||||
<%= t("comments.verified_only", verify_account: link_to(t("comments.verify_account"), verification_path )).html_safe %>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render 'comments/form', {commentable: commentable, parent_id: nil, toggeable: false} %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<br>
|
||||
<div data-alert class="callout primary">
|
||||
<%= t("debates.show.login_to_comment",
|
||||
signin: link_to(t("votes.signin"), new_user_session_path),
|
||||
signup: link_to(t("votes.signup"), new_user_registration_path)).html_safe %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% comment_tree.root_comments.each do |comment| %>
|
||||
<%= render 'comments/comment', {comment: comment, comment_flags: comment_flags} %>
|
||||
<% end %>
|
||||
<%= paginate comment_tree.root_comments %>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<% end %>
|
||||
@@ -15,6 +15,8 @@
|
||||
<%= render "budgets/investments/milestones" %>
|
||||
|
||||
<div class="tabs-panel is-active" id="tab-comments">
|
||||
<%= render partial: 'budgets/investments/comments', locals: { comment_tree: @comment_tree, comment_flags: @comment_flags } %>
|
||||
<%= render partial: '/comments/comment_tree', locals: { comment_tree: @comment_tree,
|
||||
comment_flags: @comment_flags,
|
||||
display_comments_count: false } %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
<% commentable = comment_tree.commentable %>
|
||||
<% current_order = comment_tree.order %>
|
||||
|
||||
<% cache [locale_and_user_status, current_order, commentable_cache_key(commentable), comment_tree.comments, comment_tree.comment_authors, commentable.comments_count, comment_flags] do %>
|
||||
<% 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">
|
||||
<div id="comments" class="small-12 column">
|
||||
<h2>
|
||||
<%= comment_tree_title_text(commentable) %>
|
||||
<span class="js-comments-count">(<%= commentable.comments_count %>)</span>
|
||||
</h2>
|
||||
<% if display_comments_count %>
|
||||
<h2>
|
||||
<%= comment_tree_title_text(commentable) %>
|
||||
<span class="js-comments-count">(<%= commentable.comments_count %>)</span>
|
||||
</h2>
|
||||
<% end %>
|
||||
|
||||
<%= render 'shared/wide_order_selector', i18n_namespace: "comments" %>
|
||||
|
||||
|
||||
@@ -40,7 +40,9 @@
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
<%= render partial: '/comments/comment_tree', locals: { comment_tree: @comment_tree, comment_flags: @comment_flags } %>
|
||||
<%= render partial: '/comments/comment_tree', locals: { comment_tree: @comment_tree,
|
||||
comment_flags: @comment_flags,
|
||||
display_comments_count: true } %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
<%= render partial: '/comments/comment_tree', locals: { comment_tree: @comment_tree, comment_flags: @comment_flags } %>
|
||||
|
||||
<%= render partial: '/comments/comment_tree', locals: { comment_tree: @comment_tree,
|
||||
comment_flags: @comment_flags,
|
||||
display_comments_count: true } %>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user