feat(comments): add edit and index
This commit is contained in:
1 parent
8660046b42
commit
4af7964451
3 files changed
+65
No files matched your search
@@ -0,0 +1,22 @@
|
||||
<h1><%= t('comments.edit_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(comment, url: url_for(:comment, post_id: post.to_param, id: comment.id)) do |f| %>
|
||||
<%== f.hidden_field(:lock_version) %>
|
||||
<p>
|
||||
<%== f.label(:body, t('comments.body_label')) %>
|
||||
<%== f.text_area(:body) %>
|
||||
<%== f.error_messages(:body) %>
|
||||
</p>
|
||||
<%== f.submit(t('comments.update_submit')) %>
|
||||
<% end %>
|
||||
|
||||
<p><%== link_to(t('posts.back_to_list'), url_for(:post, slug: post.to_param)) %></p>
|
||||
@@ -0,0 +1,16 @@
|
||||
<h1><%= t('comments.heading') %></h1>
|
||||
<p><%== link_to(post.title, url_for(:post, slug: post.to_param)) %></p>
|
||||
|
||||
<% if comments.none? %>
|
||||
<p><%= t('comments.empty') %></p>
|
||||
<% else %>
|
||||
<ul class="comments">
|
||||
<% comments.each do |comment| %>
|
||||
<%== partial('posts/comment', locals: { comment: comment, post: post }) %>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
<%== paginate(comments, path: ->(page) { "#{url_for(:comments, post_id: post.to_param)}?page=#{page}" }) %>
|
||||
|
||||
<p><%== link_to(t('posts.back_to_list'), url_for(:posts)) %></p>
|
||||
@@ -0,0 +1,27 @@
|
||||
<% if notice %>
|
||||
<p class="notice"><%= notice %></p>
|
||||
<% end %>
|
||||
|
||||
<h1><%= t('comments.trash_heading') %></h1>
|
||||
|
||||
<% if comments.empty? %>
|
||||
<p><%= t('comments.trash_empty') %></p>
|
||||
<% else %>
|
||||
<ul class="comments trash">
|
||||
<% 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><%= comment.body %></p>
|
||||
<%== button_to(t('comments.restore'), url_for(:restore_comment, id: comment.id), method: :patch) %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
<p><%== link_to(t('posts.back_to_list'), url_for(:posts)) %></p>
|
||||
Reference in new issue
Block a user