|
|
|
@ -443,26 +443,19 @@ class CoursesController < ApplicationController
|
|
|
|
|
def create
|
|
|
|
|
cs = CoursesService.new
|
|
|
|
|
@course = cs.create_course(params,User.current)[:course]
|
|
|
|
|
if @course.new_record?
|
|
|
|
|
if @course
|
|
|
|
|
respond_to do |format|
|
|
|
|
|
format.html { render :action => 'new', :layout => 'new_base' } #Added by young
|
|
|
|
|
format.api { render_validation_errors(@course) }
|
|
|
|
|
flash[:notice] = l(:notice_successful_create)
|
|
|
|
|
format.html {redirect_to settings_course_url(@course, :course_type => 1)}
|
|
|
|
|
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'courses', :action => 'show', :id => @course.id) }
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
respond_to do |format|
|
|
|
|
|
format.html {
|
|
|
|
|
# render :layout => 'base_courses'
|
|
|
|
|
flash[:notice] = l(:notice_successful_create)
|
|
|
|
|
if params[:continue]
|
|
|
|
|
redirect_to new_course_url(attrs, :course => '0')
|
|
|
|
|
elsif params[:course_continue]
|
|
|
|
|
redirect_to new_course_url(:course => '1')
|
|
|
|
|
else
|
|
|
|
|
redirect_to settings_course_url(@course, :course_type => 1)
|
|
|
|
|
end
|
|
|
|
|
}
|
|
|
|
|
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'courses', :action => 'show', :id => @course.id) }
|
|
|
|
|
end
|
|
|
|
|
flash[:notice] = l(:notice_create_failed)
|
|
|
|
|
# @course = Course.new
|
|
|
|
|
format.html { redirect_to new_course_path } #Added by young
|
|
|
|
|
format.api { render_validation_errors(@course) }
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@ -532,7 +525,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
@trackers = Tracker.sorted.all
|
|
|
|
|
@course = Course.new
|
|
|
|
|
@course.safe_attributes = params[:course]
|
|
|
|
|
month = Time.now.month
|
|
|
|
|
# month = Time.now.month
|
|
|
|
|
render :layout => 'new_base'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|