课程列表显示内容统一

This commit is contained in:
huang 2016-04-01 11:38:20 +08:00
parent 638280a07e
commit 25da925497
2 changed files with 34 additions and 1 deletions

View File

@ -176,7 +176,8 @@ class OrganizationsController < ApplicationController
def get_course_activities_org org
course_ids = org.courses.map{|course| course.id}.join(",")
unless course_ids.blank?
project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course' order by updated_at desc limit 8;")
project_acts = OrgActivity.find_by_sql("SELECT * FROM org_activities where container_id in (#{course_ids}) and container_type = 'course'
and org_act_type in ('HomeworkCommon', 'Poll', 'Message', 'News', 'Course') order by updated_at desc limit 8;")
else
project_acts = nil
end

View File

@ -43,6 +43,38 @@
<span class="fr right-info2"> <%= activity.comments.count %></span> </p>
</div>
</div><!--row-ziyuan end-->
<% elsif act.org_act_type == "Poll" %>
<% activity = Poll.find(act.org_act_id) %>
<% has_commit = has_commit_poll?(activity.id ,User.current)%>
<% poll_name = activity.polls_name.empty? ? l(:label_poll_new) : activity.polls_name%>
<% if ( activity.polls_status==2) %>
<div class="row-ziyuan fl">
<%= link_to image_tag(url_to_avatar(activity.user),:width => "40", :height => "40"), user_path(activity.user), :class => "fl user-img" %>
<!--<a href="#" class="fl user-img" ><img src="images/detailimg4.jpg" /></a>-->
<div class="note-box fl">
<% if has_commit %>
<%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => '_blank', :class => "fl note-title" %>
<% else %>
<%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s, :target => '_blank', :class => "fl note-title" %>
<% end %>
<p class="fl"><span >发布时间:<%= format_date activity.published_at %></span>
<span> 作者:<%= activity.try(:user).try(:realname).nil? ? activity.try(:user) : activity.try(:user).try(:realname) %></span>
<span class="fr right-info2"> 0 </span> </p>
</div>
</div><!--row-ziyuan end-->
<% end %>
<% elsif act.org_act_type == "Course" %>
<% activity = Course.find(act.org_act_id) %>
<div class="row-ziyuan fl">
<%= link_to image_tag(url_to_avatar(activity.teacher),:width => "40", :height => "40"), user_path(activity.teacher), :class => "fl user-img" %>
<!--<a href="#" class="fl user-img" ><img src="images/detailimg4.jpg" /></a>-->
<div class="note-box fl">
<%= link_to activity.name.to_s, course_url_in_org(activity.id), :target => '_blank', :class => "fl note-title" %>
<p class="fl"><span >发布时间:<%= format_date activity.created_at %></span>
<span> 作者:<%= activity.try(:teacher).try(:realname).nil? ? activity.try(:teacher) : activity.try(:teacher).try(:realname) %></span>
<span class="fr right-info2"> 0</span> </p>
</div>
</div><!--row-ziyuan end-->
<% end %>
<% end %>