104 lines
4.5 KiB
Plaintext
104 lines
4.5 KiB
Plaintext
<% cache [locale_and_user_status(comment), comment, commentable_cache_key(comment.commentable), comment.author, (@comment_flags[comment.id] if @comment_flags)] do %>
|
|
<div class="row">
|
|
<div id="<%= dom_id(comment) %>" class="comment small-12 column">
|
|
|
|
<% if comment.hidden? || comment.user.hidden? %>
|
|
<% if comment.children.size > 0 %>
|
|
<div class="is-deleted">
|
|
<p><%= t("comments.comment.deleted") %></p>
|
|
</div>
|
|
<% end %>
|
|
<% else %>
|
|
<% if comment.as_administrator? %>
|
|
<%= image_tag("admin_avatar.png", size: 32, class: "admin-avatar float-left") %>
|
|
<% elsif comment.as_moderator? %>
|
|
<%= image_tag("moderator_avatar.png", size: 32, class: "moderator-avatar float-left") %>
|
|
<% else %>
|
|
<% if comment.user.hidden? || comment.user.erased? %>
|
|
<span class="icon-deleted user-deleted"></span>
|
|
<% elsif comment.user.organization? %>
|
|
<%= image_tag("collective_avatar.png", size: 32, class: "avatar float-left") %>
|
|
<% else %>
|
|
<%= avatar_image(comment.user, seed: comment.user_id, size: 32, class: "float-left") %>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<div class="comment-body">
|
|
<div class="comment-info">
|
|
|
|
<% if comment.as_administrator? %>
|
|
<span class="user-name"><%= t("comments.comment.admin") %> #<%= comment.administrator_id%></span>
|
|
<% elsif comment.as_moderator? %>
|
|
<span class="user-name"><%= t("comments.comment.moderator") %> #<%= comment.moderator_id%></span>
|
|
<% else %>
|
|
|
|
<% if comment.user.hidden? || comment.user.erased? %>
|
|
<span class="user-name"><%= t("comments.comment.user_deleted") %></span>
|
|
<% else %>
|
|
<span class="user-name"><%= link_to comment.user.name, user_path(comment.user) %></span>
|
|
<% if comment.user.official? %>
|
|
•
|
|
<span class="label round level-<%= comment.user.official_level %>">
|
|
<%= comment.user.official_position %>
|
|
</span>
|
|
<% end %>
|
|
<% end %>
|
|
<% if comment.user.verified_organization? %>
|
|
•
|
|
<span class="label round is-association">
|
|
<%= t("shared.collective") %>
|
|
</span>
|
|
<% end %>
|
|
<% if comment.user_id == comment.commentable.author_id %>
|
|
•
|
|
<span class="label round is-author">
|
|
<%= t("comments.comment.author") %>
|
|
</span>
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
• <time><%= l comment.created_at.to_datetime, format: :datetime %></time>
|
|
</div>
|
|
|
|
<div class="comment-user
|
|
<%= user_level_class comment %>
|
|
<%= comment_author_class comment, comment.commentable.author_id %>">
|
|
<%= simple_format text_with_links(comment.body), {}, sanitize: false %>
|
|
</div>
|
|
|
|
<div id="<%= dom_id(comment) %>_reply" class="reply">
|
|
<span id="<%= dom_id(comment) %>_votes" class="comment-votes float-right">
|
|
<%= render 'comments/votes', comment: comment %>
|
|
</span>
|
|
|
|
<% if comment.children.size > 0 %>
|
|
<%= link_to "", class: "js-toggle-children", data: {'id': "#{dom_id(comment)}"} do %>
|
|
<span id="<%= dom_id(comment) %>_children_arrow" class="icon-angle-down"></span> <%= t("comments.comment.responses", count: comment.children.size) %>
|
|
<% end %>
|
|
<% else %>
|
|
<%= t("comments.comment.responses", count: 0) %>
|
|
<% end %>
|
|
|
|
<% if user_signed_in? %>
|
|
<span class="divider"> | </span>
|
|
<%= link_to(comment_link_text(comment), "",
|
|
class: "js-add-comment-link", data: {'id': dom_id(comment)}) %>
|
|
|
|
<%= render 'comments/actions', comment: comment %>
|
|
|
|
<%= render 'comments/form', {commentable: comment.commentable, parent_id: comment.id, toggeable: true} %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
|
|
<div id="<%= dom_id(comment) %>_children" class="comment-children">
|
|
<% child_comments_of(comment).each do |child| %>
|
|
<%= render 'comments/comment', comment: child %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<% end %>
|