scinote-web/app/views/shared/comments/_comment.html.erb
2023-06-15 15:12:51 +02:00

40 lines
1.7 KiB
Text

<% user = comment.user %>
<div class="comment-container <%= 'current-user' if user == current_user %>" data-comment-id="<%= comment.id %>">
<% 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>
</div>
<% end %>
<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) %>
</div>
<% if comment_editable?(comment) %>
<div class="dropdown comment-menu-container">
<div id="comment-dropdown-menu-<%= comment.id %>" class="sn-icon sn-icon-more-hori 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="sn-icon sn-icon-edit"></i>
<%= t('general.edit') %>
</a>
</li>
<li>
<a href="#" data-delete-url="<%= comment_path(comment) %>" class="delete-comment">
<i class="sn-icon sn-icon-delete"></i>
<%= t('general.delete') %>
</a>
</li>
</ul>
</div>
<% end %>
</div>
</div>
</div>