老师布置作业加入个人动态
This commit is contained in:
parent
c8128cffea
commit
bd6a057008
|
@ -462,14 +462,14 @@ class UsersController < ApplicationController
|
||||||
ids = []
|
ids = []
|
||||||
ids << Issue.where(id: act_ids, project_id: p_ids).map{|x| x.id}
|
ids << Issue.where(id: act_ids, project_id: p_ids).map{|x| x.id}
|
||||||
|
|
||||||
#Bid
|
#HomeworkCommon
|
||||||
act_ids = activity.where(act_type: 'Bid').select('act_id').map{|x| x.act_id}
|
act_ids = activity.where(act_type: 'HomeworkCommon').select('act_id').map{|x| x.act_id}
|
||||||
course_ids = HomeworkForCourse.where(bid_id: act_ids).select('distinct course_id').map{|x| x.course_id}
|
course_ids = HomeworkCommon.where(id: act_ids).select('distinct course_id').map{|x| x.course_id}
|
||||||
c_ids = []
|
c_ids = []
|
||||||
Course.where(id: course_ids).each do |x|
|
Course.where(id: course_ids).each do |x|
|
||||||
c_ids << x.id unless x.is_public !=0 && User.current.member_of_course?(x)
|
c_ids << x.id unless x.is_public !=0 && User.current.member_of_course?(x)
|
||||||
end
|
end
|
||||||
ids << HomeworkForCourse.where(bid_id: act_ids, course_id: c_ids).map{|x| x.id}
|
ids << HomeworkCommon.where(id: act_ids, course_id: c_ids).map{|x| x.id}
|
||||||
|
|
||||||
#Journal
|
#Journal
|
||||||
act_ids = activity.where(act_type: 'Journal').select('act_id').map{|x| x.act_id}
|
act_ids = activity.where(act_type: 'Journal').select('act_id').map{|x| x.act_id}
|
||||||
|
|
|
@ -14,7 +14,10 @@ class HomeworkCommon < ActiveRecord::Base
|
||||||
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 #用户活动
|
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy #用户活动
|
||||||
acts_as_attachable
|
acts_as_attachable
|
||||||
|
acts_as_event :title => Proc.new {|o| "#{l(:label_course_homework)} ##{o.id}: #{o.name}" },
|
||||||
|
:description => :description,
|
||||||
|
:author => :author,
|
||||||
|
:url => Proc.new {|o| {:controller => 'student_work', :action => 'index', :homework => o.id}}
|
||||||
after_create :act_as_activity
|
after_create :act_as_activity
|
||||||
after_destroy :delete_kindeditor_assets
|
after_destroy :delete_kindeditor_assets
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
<% (Rails.logger.error "[Error] =========================================================> NameError: uninitialized constant " + e.act_type.to_s; next;) if e.act_type.safe_constantize.nil? %>
|
<% (Rails.logger.error "[Error] =========================================================> NameError: uninitialized constant " + e.act_type.to_s; next;) if e.act_type.safe_constantize.nil? %>
|
||||||
<% act = e.act %>
|
<% act = e.act %>
|
||||||
<% unless act.nil? %>
|
<% unless act.nil? %>
|
||||||
<% if e.act_type == 'JournalsForMessage' || e.act_type == 'Bid' || e.act_type == 'Journal'|| e.act_type == 'Changeset' || e.act_type == 'Message' || e.act_type == 'Principal' || e.act_type == 'News' || e.act_type == 'Issue' || e.act_type == 'Contest' %>
|
<% if e.act_type == 'JournalsForMessage' || e.act_type == 'HomeworkCommon' || e.act_type == 'Journal'|| e.act_type == 'Changeset' || e.act_type == 'Message' || e.act_type == 'Principal' || e.act_type == 'News' || e.act_type == 'Issue' || e.act_type == 'Contest' %>
|
||||||
|
|
||||||
<table width="660" border="0" align="left" style="border-bottom: 1px dashed rgb(204, 204, 204); margin-bottom: 10px;font-size:14px;">
|
<table width="660" border="0" align="left" style="border-bottom: 1px dashed rgb(204, 204, 204); margin-bottom: 10px;font-size:14px;">
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -119,52 +119,28 @@
|
||||||
<div style="display: inline-block; float: right; margin-top: 0px"></div>
|
<div style="display: inline-block; float: right; margin-top: 0px"></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<% when 'Bid' %>
|
<% when 'HomeworkCommon' %>
|
||||||
<tr>
|
<tr>
|
||||||
<% if act.reward_type == 3 && @show_course == 1 %>
|
<% if e.user == User.current %>
|
||||||
<% if e.user == User.current %>
|
<td colspan="2" valign="top">
|
||||||
<td colspan="2" valign="top">
|
<strong>
|
||||||
<strong>
|
<%= link_to("#{l(:label_i)}", user_path(e.user_id)) %>
|
||||||
<%= link_to("#{l(:label_i)}", user_path(e.user_id)) %>
|
</strong>
|
||||||
</strong>
|
|
||||||
<span class="font_lighter">
|
<span class="font_lighter">
|
||||||
<%= l(:label_i_new_activity) %>
|
<%= l(:label_i_new_activity) %>
|
||||||
</span>
|
</span>
|
||||||
<%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), course_for_bid_path(e.act_id) %>
|
<%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), student_work_index_path(:homework => e.act_id) %>
|
||||||
</td>
|
</td>
|
||||||
<% else %>
|
<% else %>
|
||||||
<td colspan="2" valign="top">
|
<td colspan="2" valign="top">
|
||||||
<strong>
|
<strong>
|
||||||
<%= link_to(h(e.user), user_path(e.user_id)) %>
|
<%= link_to(h(e.user), user_path(e.user_id)) %>
|
||||||
</strong>
|
</strong>
|
||||||
<span class="font_lighter">
|
<span class="font_lighter">
|
||||||
<%= l(:label_new_activity) %>
|
<%= l(:label_new_activity) %>
|
||||||
</span>
|
</span>
|
||||||
<%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), course_for_bid_path(e.act_id) %>
|
<%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), student_work_index_path(:homework => e.act_id) %>
|
||||||
</td>
|
</td>
|
||||||
<% end %>
|
|
||||||
<% else %>
|
|
||||||
<% if e.user == User.current %>
|
|
||||||
<td colspan="2" valign="top">
|
|
||||||
<strong>
|
|
||||||
<%= link_to("#{l(:label_i)}", user_path(e.user_id)) %>
|
|
||||||
</strong>
|
|
||||||
<span class="font_lighter">
|
|
||||||
<%= l(:label_i_new_activity) %>
|
|
||||||
</span>
|
|
||||||
<%= link_to format_activity_title("#{l(:label_active_call)}##{act.id}:#{act.name}"), respond_path(e.act_id) %>
|
|
||||||
</td>
|
|
||||||
<% else %>
|
|
||||||
<td colspan="2" valign="top">
|
|
||||||
<strong>
|
|
||||||
<%= link_to(h(e.user), user_path(e.user_id)) %>
|
|
||||||
</strong>
|
|
||||||
<span class="font_lighter">
|
|
||||||
<%= l(:label_new_activity) %>
|
|
||||||
</span>
|
|
||||||
<%= link_to format_activity_title("#{l(:label_active_call)}##{act.id}:#{act.name}"), respond_path(e.act_id) %>
|
|
||||||
</td>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -177,7 +153,7 @@
|
||||||
<td>
|
<td>
|
||||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||||
<span class="font_lighter">
|
<span class="font_lighter">
|
||||||
<%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_on)).to_s %>
|
<%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_at)).to_s %>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<!--<div style="display: inline-block; float: right; margin-top: 0px">-->
|
<!--<div style="display: inline-block; float: right; margin-top: 0px">-->
|
||||||
|
|
Loading…
Reference in New Issue