From 44419eff04c284f3a7e88fbbfb1d2fa1b47bae2e Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 25 Aug 2015 15:39:50 +0800 Subject: [PATCH 1/2] rake db --- db/schema.rb | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 4440af24a..1c77ff04b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -776,16 +776,6 @@ ActiveRecord::Schema.define(:version => 20150820025358) do add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" - create_table "journal_details_copy", :force => true do |t| - t.integer "journal_id", :default => 0, :null => false - t.string "property", :limit => 30, :default => "", :null => false - t.string "prop_key", :limit => 30, :default => "", :null => false - t.text "old_value" - t.text "value" - end - - add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id" - create_table "journal_replies", :id => false, :force => true do |t| t.integer "journal_id" t.integer "user_id" From 0d9a397453c1a1cb83f21f47ae14a609a9467179 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 25 Aug 2015 16:01:31 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=99=BB=E5=BD=95=E3=80=81=E6=9C=AA?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E6=90=9C=E7=B4=A2=E6=9D=A1=E4=BB=B6=E9=80=89?= =?UTF-8?q?=E6=8B=A9js=20=E7=94=A8=E6=88=B7=E4=B8=BB=E9=A1=B5=20show?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 12 ++++---- app/views/layouts/_logined_header.html.erb | 32 ++++++++++++---------- app/views/layouts/_unlogin_header.html.erb | 32 ++++++++++++---------- public/javascripts/new_user.js | 7 ----- 4 files changed, 41 insertions(+), 42 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index e1b9f4252..22d8deb0c 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -549,13 +549,11 @@ class UsersController < ApplicationController end def show - #if @user == User.current - - @user_activities = UserActivity.where("(container_type='Course' and container_id in (select course_id FROM members WHERE user_id=#{@user.id})) or (container_type='Project' and container_id in (SELECT project_id FROM members WHERE user_id=#{@user.id}))").order('created_at desc') - @user_activities = paginateHelper @user_activities,500 - #SELECT * FROM user_activities WHERE (container_type='Course' AND container_id IN (SELECT course_id FROM members WHERE user_id=4)) OR (container_type='Project' AND container_id IN (SELECT project_id FROM members WHERE user_id=4)) - #else - #end + @page = (params[:page] || -1).to_i + 1 + user_project_ids = "(" + @user.projects.visible.map{|project| project.id}.join(",") + ")" + user_course_ids = "(" + @user.courses.visible.map{|course| course.id}.join(",") + ")" + @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids}) or (container_type = 'Course' and container_id in #{user_course_ids})").order('created_at desc').limit(10).offset(@page * 10) + # @user_activities = paginateHelper @user_activities,500 render :layout=>'new_base_user' end diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index 16e5be059..74c4bb9a9 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -25,23 +25,18 @@
+ + \ No newline at end of file diff --git a/app/views/layouts/_unlogin_header.html.erb b/app/views/layouts/_unlogin_header.html.erb index b4423a713..9d9ed813f 100644 --- a/app/views/layouts/_unlogin_header.html.erb +++ b/app/views/layouts/_unlogin_header.html.erb @@ -16,23 +16,18 @@