1、新编辑器增加HomeworkCommon的Type

2、老师创建作业加入老师个人动态
This commit is contained in:
sw 2015-06-02 11:58:21 +08:00
parent 8d23815169
commit 66c02f0667
3 changed files with 14 additions and 2 deletions

View File

@ -6,4 +6,5 @@ module OwnerTypeHelper
COMMENT = 5 COMMENT = 5
BID = 6 BID = 6
JOURNALSFORMESSAGE = 7 JOURNALSFORMESSAGE = 7
HOMEWORKCOMMON = 8
end end

View File

@ -11,6 +11,17 @@ class HomeworkCommon < ActiveRecord::Base
has_many :homework_tests, :dependent => :destroy has_many :homework_tests, :dependent => :destroy
has_many :student_works, :dependent => :destroy has_many :student_works, :dependent => :destroy
has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表 has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy #用户活动
acts_as_attachable acts_as_attachable
after_create :act_as_activity
after_destroy :delete_kindeditor_assets
def act_as_activity
self.acts << Activity.new(:user_id => self.user_id)
end
#删除对应的图片
def delete_kindeditor_assets
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::HOMEWORKCOMMON
end
end end

View File

@ -12,7 +12,7 @@
<label class="label02 ">&nbsp;&nbsp;&nbsp;<%= l(:field_quote)%>&nbsp;</label> <label class="label02 ">&nbsp;&nbsp;&nbsp;<%= l(:field_quote)%>&nbsp;</label>
<!--<textarea name="" placeholder="请在此填入作业的要求及评分依据" class=" w548 h150 mb10 fl" ></textarea>--> <!--<textarea name="" placeholder="请在此填入作业的要求及评分依据" class=" w548 h150 mb10 fl" ></textarea>-->
<% if edit_mode %> <% if edit_mode %>
<%= f.kindeditor :description,:width=>'83%',:editor_id => 'homework_description_editor',:owner_id => homework.id,:owner_type =>OwnerTypeHelper::BID %> <%= f.kindeditor :description,:width=>'83%',:editor_id => 'homework_description_editor',:owner_id => homework.id,:owner_type =>OwnerTypeHelper::HOMEWORKCOMMON %>
<% else %> <% else %>
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<%= f.kindeditor :description,:width=>'83%',:editor_id => 'homework_description_editor' %> <%= f.kindeditor :description,:width=>'83%',:editor_id => 'homework_description_editor' %>