大纲设置的图标改动 ,添加删除动作

This commit is contained in:
lizanle 2015-10-30 10:52:56 +08:00
parent a27c359df4
commit 00157b4302
1 changed files with 15 additions and 5 deletions

View File

@ -56,12 +56,22 @@ class BlogCommentsController < ApplicationController
end end
def destroy def destroy
@article = BlogComment.find(params[:id]) @article = BlogComment.find(params[:id])
if @article.parent_id.nil? #如果是文章被删,那么跳转到用户博客界面 if @article.parent_id.nil? #如果是文章被删那么跳转到用户博客界面如果带了course_id过来那么就要跳转到课程首页
@article.children.delete if params[:course_id]
@article.delete @article.children.delete
redirect_to user_blogs_path(:user_id=>User.current) @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#如果是回复被删, else#如果是回复被删,
if params[:course_id] #如果呆了course_id过来了那么这是要跳到课程大纲去的 if params[:course_id] #如果了course_id过来了那么这是要跳到课程大纲去的
@article.delete @article.delete
redirect_to show_course_outline_course_path(:id=>params[:course_id]) redirect_to show_course_outline_course_path(:id=>params[:course_id])
else else