diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 5b9de921..ff2d172b 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -485,18 +485,24 @@ class ProjectsController < ApplicationController end def new - @project_type = params[:project_type] - @course_tag = params[:course] + @project_type = params[:project_type] @issue_custom_fields = IssueCustomField.sorted.all - @trackers = Tracker.sorted.all - @project = Project.new - @project.safe_attributes = params[:project] + @trackers = Tracker.sorted.all - ##TODO: , viewed by nyan - ##add by huang - @course=Course.new - @course.safe_attributes = params[:course] - ##end + case @project_type + when '0' # Project + @project = Project.new + @project.safe_attributes = params[:project] + when '1' # Course + @project = Project.new + @project.safe_attributes = params[:project] + @course_tag = params[:course] + @course = Course.new + @course.safe_attributes = params[:course] + else + render_404 + return -1 + end render :layout => 'base' end