diff options
| author | Miquel Sabaté Solà <msabate@suse.com> | 2024-03-13 18:03:43 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <msabate@suse.com> | 2024-03-13 18:03:43 +0100 |
| commit | a7791635aa98f012d35f97c3c5288494bbb28e38 (patch) | |
| tree | bad987e6b4d10ad2f7cd02e40658d464907595ee /app/views/comments/_comment.html.erb | |
| download | operum-a7791635aa98f012d35f97c3c5288494bbb28e38.tar.gz operum-a7791635aa98f012d35f97c3c5288494bbb28e38.zip | |
Initial commit
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to 'app/views/comments/_comment.html.erb')
| -rw-r--r-- | app/views/comments/_comment.html.erb | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb new file mode 100644 index 0000000..8c0975e --- /dev/null +++ b/app/views/comments/_comment.html.erb @@ -0,0 +1,42 @@ +<div id="<%= dom_id(comment) %>" class="comment"> + <div class="comment-header"> + <div class="comment-header-title"> + <% if defined?(idx) %> + <span title="Commented on <%= comment.created_at %>"><b><%= I18n.t('comments.title') %></b> #<%= idx + 1 %></span> + <% else %> + <span title="Commented on <%= comment.created_at %>"><b><%= I18n.t('comments.title') %></b> <%= I18n.t('general.in') %> <%= link_to comment.thing.title, thing_path(comment.thing) %></span> + <% end %> + </div> + + <div class="comment-header-actions"> + <% if defined?(from) %> + <a title="<%= I18n.t('comments.edit-title') %>" href="#" class="edit-comment" data-action="comment#toggle"><%= I18n.t('general.edit').capitalize %></a> + <%= link_to I18n.t('general.delete').capitalize, thing_comment_path(comment.thing, comment, from: from), data: { "turbo-method": :delete }, title: I18n.t('comments.delete-title'), class: 'delete-comment' %> + <% end %> + </div> + </div> + + <div class="comment-body"> + <%= comment.content %> + </div> + + <% if comment.tag_references.any? %> + <div class="comment-footer"> + <small><b><%= I18n.t('tags.title') %></b>: <%= comment.tags.order(:name).pluck(:name).join(", ") %></small> + </div> + <% end %> + + <% if defined?(from) %> + <div class="comment-edit-body hidden"> + <%= form_with model: [comment.thing, comment] do |form| %> + <%= form.hidden_field :from, value: from %> + <%= form.rich_text_area :content, autofocus: true %> + + <%= render "tags/taggable", tag_references: comment.tag_references.pluck(:tag_id), form: form %> + + <%= form.submit %> + <span><%= I18n.t('general.or') %> <a title="Cancel editing of comment" href="#" data-action="comment#toggle"><%= I18n.t('general.cancel') %></a></span> + <% end %> + </div> + <% end %> +</div> |
