From 00157b430273bed9359401cc10cb96fa42a4df39 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 30 Oct 2015 10:52:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E7=BA=B2=E8=AE=BE=E7=BD=AE=E7=9A=84?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E6=94=B9=E5=8A=A8=20=EF=BC=8C=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=88=A0=E9=99=A4=E5=8A=A8=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/blog_comments_controller.rb | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/app/controllers/blog_comments_controller.rb b/app/controllers/blog_comments_controller.rb index 42f1e2f20..e398501e4 100644 --- a/app/controllers/blog_comments_controller.rb +++ b/app/controllers/blog_comments_controller.rb @@ -56,12 +56,22 @@ class BlogCommentsController < ApplicationController end def destroy @article = BlogComment.find(params[:id]) - if @article.parent_id.nil? #如果是文章被删,那么跳转到用户博客界面 - @article.children.delete - @article.delete - redirect_to user_blogs_path(:user_id=>User.current) + if @article.parent_id.nil? #如果是文章被删,那么跳转到用户博客界面,如果带了course_id过来,那么就要跳转到课程首页 + if params[:course_id] + @article.children.delete + @article.delete + @course = Course.find(params[:course_id]) + @course.outline = 0 + @course.save + redirect_to course_path(:id=>params[:course_id]) + else + @article.children.delete + @article.delete + redirect_to user_blogs_path(:user_id=>User.current) + end + else#如果是回复被删, - if params[:course_id] #如果呆了course_id过来了,那么这是要跳到课程大纲去的 + if params[:course_id] #如果带了course_id过来了,那么这是要跳到课程大纲去的 @article.delete redirect_to show_course_outline_course_path(:id=>params[:course_id]) else