From 5ddefe21b858a71e91a7f908b0704a1fca84a4c7 Mon Sep 17 00:00:00 2001 From: cxt Date: Sat, 29 Aug 2015 16:39:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B53080?= =?UTF-8?q?=E8=B4=A6=E6=88=B7=E5=8A=A8=E6=80=81=E5=BC=82=E5=B8=B8bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 8 +++++--- app/views/users/show.html.erb | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 900af0e77..0058e6e4c 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -627,14 +627,15 @@ class UsersController < ApplicationController end def show + @page = params[:page] ? params[:page].to_i + 1 : 0 - @type = params[:type] + user_project_ids = @user.projects.visible.empty? ? "(-1)" : "(" + @user.projects.visible.map{|project| project.id}.join(",") + ")" user_course_ids = @user.courses.visible.empty? ? "(-1)" : "(" + @user.courses.visible.map{|course| course.id}.join(",") + ")" course_types = "('Message','News','HomeworkCommon','poll')" project_types = "('Message','Issue')" - if @type - case @type + if params[:type].present? + case params[:type] when "course_homework" @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'HomeworkCommon'").order('created_at desc').limit(10).offset(@page * 10) when "course_news" @@ -654,6 +655,7 @@ class UsersController < ApplicationController @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids}) and act_type in #{course_types}").order('created_at desc').limit(10).offset(@page * 10) end # @user_activities = paginateHelper @user_activities,500 + @type = params[:type] respond_to do |format| format.js format.html {render :layout => 'new_base_user'} diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 91a35e711..74ca48595 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -14,7 +14,7 @@ $(window).scroll(scrollHandler); - +
最新动态