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); - +
最新动态