From 4d9fc8d74f5853b9b6c124d48f420027b9c099b2 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 5 Dec 2014 14:18:14 +0800 Subject: [PATCH] =?UTF-8?q?#1657=20=E6=96=B0=E5=BB=BA=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E6=97=B6=E5=A6=82=E7=94=A8=E6=88=B7=E6=B2=A1=E6=9C=89=E5=AF=B9?= =?UTF-8?q?=E5=BA=94=E7=9A=84=E8=BA=AB=E4=BB=BD=E3=80=81=E5=A7=93=E5=90=8D?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=EF=BC=8C=E8=B7=B3=E8=BD=AC=E5=88=B0=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E8=B5=84=E6=96=99=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 5cffcc31c..1e706b1da 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -266,12 +266,11 @@ class CoursesController < ApplicationController @course.setup_time = params[:setup_time] @course.endup_time = params[:endup_time] @course.class_period = params[:class_period] - end - @issue_custom_fields = IssueCustomField.sorted.all - @trackers = Tracker.sorted.all + @issue_custom_fields = IssueCustomField.sorted.all + @trackers = Tracker.sorted.all - if @course.save + if @course.save #unless User.current.admin? r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first m = Member.new(:user => User.current, :roles => [r]) @@ -297,13 +296,16 @@ class CoursesController < ApplicationController } format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'courses', :action => 'show', :id => @course.id) } end - else + else #@course.destroy respond_to do |format| format.html { render :action => 'new', :layout => 'base' } #Added by young format.api { render_validation_errors(@course) } end - end + end + else + redirect_to my_account_url + end end def course