From 8d858cccfc7ac66e4bf8ef2bf238cbae223c3a13 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Fri, 17 Jul 2015 13:40:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 2 +- app/helpers/activities_helper.rb | 12 ++--- app/models/activity.rb | 4 +- app/views/layouts/base_users_new.html.erb | 46 ++++++++++--------- app/views/users/_course_form.html.erb | 4 +- app/views/users/user_courses4show.html.erb | 2 +- ..._activity_container_type_to_activities.rb} | 2 + ...62300_change_activities_container_type.rb} | 2 +- 8 files changed, 40 insertions(+), 34 deletions(-) rename db/migrate/{20150714161200_add_activity_container_type_to_activities.rb => 20150714162200_add_activity_container_type_to_activities.rb} (67%) rename db/migrate/{20150715161300_change_activities_container_type.rb => 20150715162300_change_activities_container_type.rb} (85%) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index dd43e3e5b..d684240a4 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -455,7 +455,7 @@ class UsersController < ApplicationController query = query.where("r.role_id in(3,7,9)") end query = query.where(Course.table_name+".is_public = 1") - # TODO or exists (select 1 from courses c2,members m2 where c2.id=m2.course_id and c2.id=#{Course.table_name}.id and m2.user_id= User.current.id) + # or exists (select 1 from courses c2,members m2 where c2.id=m2.course_id and c2.id=#{Course.table_name}.id and m2.user_id= User.current.id) end if params[:lastid]!=nil && !params[:lastid].empty? diff --git a/app/helpers/activities_helper.rb b/app/helpers/activities_helper.rb index 54f030e40..cf8679da6 100644 --- a/app/helpers/activities_helper.rb +++ b/app/helpers/activities_helper.rb @@ -46,26 +46,26 @@ module ActivitiesHelper def get_container_type(activity) #问卷 if activity.act_type == 'Poll' - return 'Course' + return ['Course',activity.act.polls_group_id] end #注册 if activity.act_type == 'Principal' - return 'Principal' + return ['Principal',activity.act.id] end #留言 if activity.act_type == 'JournalsForMessage' - return activity.act.jour.class.to_s + return [activity.act.jour_type,activity.act.jour_id] end # HomeworkCommon Issue Journal Message News if activity.act.respond_to?('course') && activity.act.course - return 'Course' + return ['Course',activity.act.course.id] end if activity.act.respond_to?('project') && activity.act.project - return 'Project' + return ['Project',activity.act.project.id] end # Contest Contestnotification - return 'Unknow' + return ['Unknow',0] end end diff --git a/app/models/activity.rb b/app/models/activity.rb index 22aa533d2..ff3f06ff6 100644 --- a/app/models/activity.rb +++ b/app/models/activity.rb @@ -13,6 +13,8 @@ class Activity < ActiveRecord::Base #helper :activities include ActivitiesHelper def set_container_type_val - self.activity_container_type = get_container_type(self) + container_type,container_id =get_container_type(self) + self.activity_container_type = container_type + self.activity_container_id = container_id end end diff --git a/app/views/layouts/base_users_new.html.erb b/app/views/layouts/base_users_new.html.erb index c0fe7421a..49322c19c 100644 --- a/app/views/layouts/base_users_new.html.erb +++ b/app/views/layouts/base_users_new.html.erb @@ -197,6 +197,30 @@ $(".subNav").click(function(){
+ <% if @center_flag %> +主讲老师:<%= item.teacher.show_name %>
-课程作业:<%= item.homework_commons.count %> 成员:<%= item.members.count %>
+课程作业:<%= item.homework_commons.count %> 学生:item.id,:role=>2, :host=>Setting.host_course) %>"><%= studentCount(item) %>