feat(account): add comments and edit

This commit is contained in:
dualfroz committed 2026-09-04 18:31:38 +02:00
1 parent 4160704b23
commit 8660046b42
3 files changed
+73

No files matched your search

@@ -0,0 +1,25 @@
<h1><%= t('account.comments_heading') %></h1>
<% if comments.none? %>
<p><%= t('account.comments_empty') %></p>
<% else %>
<ul class="comments mine">
<% comments.each do |comment| %>
<li class="comment" id="comment-<%= comment.id %>">
<p>
<% if comment_post_linkable?(comment) %>
<%== link_to(comment_post_label(comment), url_for(:post, slug: comment_post_slug(comment))) %>
<% else %>
<%= comment_post_label(comment) %>
<% end %>
<span class="comment-status"><%= t("comments.status_#{comment.status}") %></span>
</p>
<p><%= comment.body %></p>
</li>
<% end %>
</ul>
<% end %>
<%== paginate(comments, path: ->(page) { "#{url_for(:account_comments)}?page=#{page}" }) %>
<p><%== link_to(t('posts.back_to_list'), url_for(:posts)) %></p>
+21
View File
@@ -0,0 +1,21 @@
<h1><%= t('account.heading') %></h1>
<% unless errors.empty? %>
<h2><%= t('posts.errors_heading') %></h2>
<ul class="errors">
<% errors.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
<% end %>
<% form_for(user, url: '/account', method: :patch) do |f| %>
<p>
<%== f.label(:email, t('account.email_label')) %>
<%== f.email_field(:email) %>
<%== f.error_messages(:email) %>
</p>
<%== f.submit(t('account.submit')) %>
<% end %>
<p><%== link_to(t('posts.back_to_list'), url_for(:root)) %></p>
@@ -0,0 +1,27 @@
<h1><%= t('account.moderation_heading') %></h1>
<% if comments.none? %>
<p><%= t('account.moderation_empty') %></p>
<% else %>
<ul class="comments moderation">
<% comments.each do |comment| %>
<li class="comment" id="comment-<%= comment.id %>">
<p>
<% if comment_post_linkable?(comment) %>
<%== link_to(comment_post_label(comment), url_for(:post, slug: comment_post_slug(comment))) %>
<% else %>
<%= comment_post_label(comment) %>
<% end %>
</p>
<p><strong><%= comment.author %></strong></p>
<p><%= comment.body %></p>
<%== button_to(t('comments.approve'), "/posts/#{comment_post_slug(comment)}/comments/#{comment.id}/approve", method: :patch) %>
<%== button_to(t('comments.reject'), "/posts/#{comment_post_slug(comment)}/comments/#{comment.id}/reject", method: :patch) %>
</li>
<% end %>
</ul>
<% end %>
<%== paginate(comments, path: ->(page) { "#{url_for(:account_moderation)}?page=#{page}" }) %>
<p><%== link_to(t('posts.back_to_list'), url_for(:posts)) %></p>