管理员创建课程逻辑修改,管理员创建课程后成为该课程成员

This commit is contained in:
nwb 2014-06-19 09:37:58 +08:00
parent f0b016bcbe
commit f5c9123647
2 changed files with 2 additions and 3 deletions

View File

@ -235,7 +235,7 @@ class CoursesController < ApplicationController
if User.current.user_extensions.identity == 0 if User.current.user_extensions.identity == 0
if @course.save if @course.save
unless User.current.admin? #unless User.current.admin?
r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first 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]) m = Member.new(:user => User.current, :roles => [r])
m.project_id = -1 m.project_id = -1
@ -246,7 +246,7 @@ class CoursesController < ApplicationController
end end
@course.members << m @course.members << m
@course.course_infos << course @course.course_infos << course
end #end
respond_to do |format| respond_to do |format|
format.html { format.html {
flash[:notice] = l(:notice_successful_create) flash[:notice] = l(:notice_successful_create)

View File

@ -26,7 +26,6 @@ class Course < ActiveRecord::Base
has_many :enabled_modules, :dependent => :delete_all has_many :enabled_modules, :dependent => :delete_all
has_many :boards, :dependent => :destroy, :order => "position ASC" has_many :boards, :dependent => :destroy, :order => "position ASC"
#has_many :course_journals_for_messages, :class_name => 'CourseJournalsForMessage', :as => :jour, :dependent => :destroy #has_many :course_journals_for_messages, :class_name => 'CourseJournalsForMessage', :as => :jour, :dependent => :destroy
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
has_many :news, :dependent => :destroy, :include => :author has_many :news, :dependent => :destroy, :include => :author
acts_as_taggable acts_as_taggable