|
|
|
@ -3,6 +3,7 @@ class HomeworkCommonController < ApplicationController
|
|
|
|
|
before_filter :find_course, :only => [:index,:new,:create]
|
|
|
|
|
before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy]
|
|
|
|
|
before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment]
|
|
|
|
|
after_create :send_mail
|
|
|
|
|
|
|
|
|
|
def index
|
|
|
|
|
homeworks = @course.homework_commons.order("created_at desc")
|
|
|
|
@ -183,6 +184,10 @@ class HomeworkCommonController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def send_mail
|
|
|
|
|
Mailer.run.homework_added(self)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|
#获取课程
|
|
|
|
|
def find_course
|
|
|
|
|