From 7a58f78cd0b0dce0deede3da5f82caae8845cc1f Mon Sep 17 00:00:00 2001 From: yafeilee Date: Sun, 25 May 2014 23:08:48 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=84=E8=AE=BA=E7=9A=84=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E8=BF=87=E9=95=BF=E6=97=B6=E4=B8=8D=E7=BE=8E=E8=A7=82,=20?= =?UTF-8?q?=E5=A4=84=E7=90=86=E4=B8=80=E4=B8=8B,=20=E5=B9=B6=E5=A4=84?= =?UTF-8?q?=E7=90=86=E7=AE=A1=E7=90=86=E8=AF=84=E8=AE=BA=E6=97=B6=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/stylesheets/admin/posts.css.scss | 4 +++- app/controllers/admin/comments_controller.rb | 2 +- app/views/admin/comments/index.html.slim | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/admin/posts.css.scss b/app/assets/stylesheets/admin/posts.css.scss index 918527d..2d1b4a7 100644 --- a/app/assets/stylesheets/admin/posts.css.scss +++ b/app/assets/stylesheets/admin/posts.css.scss @@ -35,7 +35,9 @@ } .pre { - white-space: pre; + white-space: pre-wrap; + word-break: break-all; + word-wrap: break-word; } } diff --git a/app/controllers/admin/comments_controller.rb b/app/controllers/admin/comments_controller.rb index b68c047..1861d31 100644 --- a/app/controllers/admin/comments_controller.rb +++ b/app/controllers/admin/comments_controller.rb @@ -7,7 +7,7 @@ class Admin::CommentsController < ApplicationController end def index - @comments = @post.comments + @comments = @post.comments.order(created_at: :desc) end def destroy diff --git a/app/views/admin/comments/index.html.slim b/app/views/admin/comments/index.html.slim index b57f847..86f4777 100644 --- a/app/views/admin/comments/index.html.slim +++ b/app/views/admin/comments/index.html.slim @@ -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'=> '确认删除?'