评论的内容过长时不美观, 处理一下, 并处理管理评论时排序问题

This commit is contained in:
yafeilee 2014-05-25 23:08:48 +08:00
parent 36fe8db384
commit 7a58f78cd0
3 changed files with 8 additions and 2 deletions

View File

@ -35,7 +35,9 @@
} }
.pre { .pre {
white-space: pre; white-space: pre-wrap;
word-break: break-all;
word-wrap: break-word;
} }
} }

View File

@ -7,7 +7,7 @@ class Admin::CommentsController < ApplicationController
end end
def index def index
@comments = @post.comments @comments = @post.comments.order(created_at: :desc)
end end
def destroy def destroy

View File

@ -9,6 +9,7 @@
th 名字 th 名字
th 邮箱 th 邮箱
th 内容 th 内容
th 时间
th 操作 th 操作
tbody tbody
- @comments.each do |comment| - @comments.each do |comment|
@ -18,6 +19,9 @@
= mail_to comment.email = mail_to comment.email
td td
p.pre #{comment.content} p.pre #{comment.content}
td
= format_time(comment.created_at)
td td
= link_to '回复', blog_path(@post), target: '_blank', class: 'edit-post-link' = link_to '回复', blog_path(@post), target: '_blank', class: 'edit-post-link'
= link_to '删除', admin_post_comment_path(@post, comment), method: 'DELETE', 'data-confirm'=> '确认删除?' = link_to '删除', admin_post_comment_path(@post, comment), method: 'DELETE', 'data-confirm'=> '确认删除?'