scinote-web/app/views/shared/comments/_comment.html.erb

41 lines
1.7 KiB
Text
Raw Normal View History

2020-11-20 19:29:40 +08:00
<% user = comment.user %>
2020-11-21 03:25:28 +08:00
<div class="comment-container <%= 'current-user' if user == current_user %>" data-comment-id="<%= comment.id %>">
2022-05-25 21:04:14 +08:00
<% unless skip_header%>
<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>
2020-11-20 19:29:40 +08:00
</div>
2022-05-25 21:04:14 +08:00
<% end %>
2020-11-20 19:29:40 +08:00
<div class="comment-body">
<div class="comment-message">
2020-11-21 03:25:28 +08:00
<%= custom_auto_link(comment.message, team: current_team, simple_format: false) %>
2020-11-20 19:29:40 +08:00
</div>
<div class="comment-footer">
<div class="comment-create-date">
<%= I18n.l(comment.created_at, format: :full_date) %>
</div>
2020-11-21 03:25:28 +08:00
<% 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>
2020-11-21 19:31:49 +08:00
<%= t('general.edit') %>
2020-11-21 03:25:28 +08:00
</a>
</li>
<li>
<a href="#" data-delete-url="<%= comment_path(comment) %>" class="delete-comment">
<i class="fas fa-trash"></i>
2020-11-21 19:31:49 +08:00
<%= t('general.delete') %>
2020-11-21 03:25:28 +08:00
</a>
</li>
</ul>
</div>
<% end %>
2020-11-20 19:29:40 +08:00
</div>
</div>
</div>