自动添加讨论区当项目课程创建的时候,学生是否能回复需要在全线报表里配置.
This commit is contained in:
parent
9491781b45
commit
0381179536
|
@ -531,10 +531,6 @@ class ProjectsController < ApplicationController
|
|||
@course.endup_time = params[:endup_time]
|
||||
@course.class_period = params[:class_period]
|
||||
end
|
||||
# end
|
||||
# @course.save
|
||||
# project = ProjectInfo.create(:user_id => User.current.id, :project_id => @project.id)
|
||||
# project_status = ProjectStatus.create(:project_id => @project.id)
|
||||
end
|
||||
@issue_custom_fields = IssueCustomField.sorted.all
|
||||
@trackers = Tracker.sorted.all
|
||||
|
@ -578,7 +574,7 @@ class ProjectsController < ApplicationController
|
|||
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) }
|
||||
end
|
||||
else
|
||||
@course.destroy #TODO: yan
|
||||
@course.destroy
|
||||
respond_to do |format|
|
||||
format.html { render :action => 'new', :layout => 'base'}#Added by young
|
||||
format.api { render_validation_errors(@project) }
|
||||
|
|
|
@ -119,6 +119,7 @@ class Project < ActiveRecord::Base
|
|||
|
||||
after_save :update_position_under_parent, :if => Proc.new {|project| project.name_changed?}
|
||||
after_save :update_inherited_members, :if => Proc.new {|project| project.inherit_members_changed?}
|
||||
after_save :create_board_sync #nyan
|
||||
before_destroy :delete_all_members
|
||||
def remove_references_before_destroy
|
||||
return if self.id.nil?
|
||||
|
@ -1083,4 +1084,16 @@ class Project < ActiveRecord::Base
|
|||
after_parent_changed(parent_was)
|
||||
end
|
||||
end
|
||||
|
||||
# 创建项目后在项目下同步创建一个讨论区
|
||||
def create_board_sync
|
||||
@board = self.boards.build
|
||||
@board.name = self.name
|
||||
@board.description = self.name.to_s << " #{l(:label_board) }"
|
||||
if @board.save
|
||||
logger.debug "[Project Model] ===> #{@board.to_json}"
|
||||
else
|
||||
logger.error "[Project Model] ===> Auto create board when project saved, because #{@board.full_messages}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue