scinote-web/app/views/shared/comments/_comment.html.erb
2020-11-21 12:31:49 +01:00

38 lines
1.7 KiB
Text

<% user = comment.user %>
<div class="comment-container <%= 'current-user' if user == current_user %>" data-comment-id="<%= comment.id %>">
<div class="comment-header">
<%= image_tag avatar_path(comment.user, :icon_small), class: 'user-avatar' %>
<div class="user-name">
<%= user == current_user ? 'You' : comment.user.full_name %>
</div>
</div>
<div class="comment-body">
<div class="comment-message">
<%= custom_auto_link(comment.message, team: current_team, simple_format: false) %>
</div>
<div class="comment-footer">
<div class="comment-create-date">
<%= I18n.l(comment.created_at, format: :full_date) %>
</div>
<% if comment_editable?(comment) %>
<div class="dropdown comment-menu-container">
<div id="comment-dropdown-menu-<%= comment.id %>" class="fas fa-ellipsis-h open-dropdown-btn" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"></div>
<ul class="dropdown-menu comment-dropdown-menu dropdown-menu-right" aria-labelledby="comment-dropdown-menu-<%= comment.id %>">
<li>
<a href="#" class="edit-comment" data-comment-raw="<%= comment.message %>" data-update-url="<%= comment_path(comment) %>" data-comment-id="<%= comment.id %>">
<i class="fas fa-pen"></i>
<%= t('general.edit') %>
</a>
</li>
<li>
<a href="#" data-delete-url="<%= comment_path(comment) %>" class="delete-comment">
<i class="fas fa-trash"></i>
<%= t('general.delete') %>
</a>
</li>
</ul>
</div>
<% end %>
</div>
</div>
</div>