From 25da9254970d8be5358157b2b1692245712f299a Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 1 Apr 2016 11:38:20 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=88=97=E8=A1=A8=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=86=85=E5=AE=B9=E7=BB=9F=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 3 +- .../_org_new_course_act_list.html.erb | 32 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 920b9f2c4..2af1f1d9e 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -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 diff --git a/app/views/organizations/_org_new_course_act_list.html.erb b/app/views/organizations/_org_new_course_act_list.html.erb index 81f1b6410..8dceeb6cb 100644 --- a/app/views/organizations/_org_new_course_act_list.html.erb +++ b/app/views/organizations/_org_new_course_act_list.html.erb @@ -43,6 +43,38 @@ <%= activity.comments.count %>

+ <% 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) %> +
+ <%= link_to image_tag(url_to_avatar(activity.user),:width => "40", :height => "40"), user_path(activity.user), :class => "fl user-img" %> + +
+ <% 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 %> +

发布时间:<%= format_date activity.published_at %> + 作者:<%= activity.try(:user).try(:realname).nil? ? activity.try(:user) : activity.try(:user).try(:realname) %> + 0

+
+
+ <% end %> + <% elsif act.org_act_type == "Course" %> + <% activity = Course.find(act.org_act_id) %> +
+ <%= link_to image_tag(url_to_avatar(activity.teacher),:width => "40", :height => "40"), user_path(activity.teacher), :class => "fl user-img" %> + +
+ <%= link_to activity.name.to_s, course_url_in_org(activity.id), :target => '_blank', :class => "fl note-title" %> +

发布时间:<%= format_date activity.created_at %> + 作者:<%= activity.try(:teacher).try(:realname).nil? ? activity.try(:teacher) : activity.try(:teacher).try(:realname) %> + 0

+
+
<% end %> <% end %> \ No newline at end of file