评论的内容过长时不美观, 处理一下, 并处理管理评论时排序问题
This commit is contained in:
parent
36fe8db384
commit
7a58f78cd0
|
@ -35,7 +35,9 @@
|
|||
}
|
||||
|
||||
.pre {
|
||||
white-space: pre;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ class Admin::CommentsController < ApplicationController
|
|||
end
|
||||
|
||||
def index
|
||||
@comments = @post.comments
|
||||
@comments = @post.comments.order(created_at: :desc)
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
th 名字
|
||||
th 邮箱
|
||||
th 内容
|
||||
th 时间
|
||||
th 操作
|
||||
tbody
|
||||
- @comments.each do |comment|
|
||||
|
@ -18,6 +19,9 @@
|
|||
= mail_to comment.email
|
||||
td
|
||||
p.pre #{comment.content}
|
||||
td
|
||||
= format_time(comment.created_at)
|
||||
|
||||
td
|
||||
= link_to '回复', blog_path(@post), target: '_blank', class: 'edit-post-link'
|
||||
= link_to '删除', admin_post_comment_path(@post, comment), method: 'DELETE', 'data-confirm'=> '确认删除?'
|
||||
|
|
Loading…
Reference in New Issue