From ae6260571b4d4321cf68d433f8d0c793dd9d0c94 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 18 Aug 2015 16:57:41 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 8 ++++---- app/views/users/user_resource.html.erb | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 6bbfbd12b..c3c5da9cf 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1106,25 +1106,25 @@ class UsersController < ApplicationController #确定container_type # @user = User.find(params[:id]) if(params[:type].nil? || params[:type] == "1") #全部 - if User.current.id == params[:id] + if User.current.id.to_i == params[:id].to_i @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon') ").order("created_on desc") else @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon') ").order("created_on desc") end elsif params[:type] == "2" #课程资源 - if User.current.id == params[:id] + if User.current.id.to_i == params[:id].to_i @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Course'").order("created_on desc") else @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Course' ").order("created_on desc") end elsif params[:type] == "3" #项目资源 - if User.current.id == params[:id] + if User.current.id.to_i == params[:id].to_i @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Project'").order("created_on desc") else @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Project' ").order("created_on desc") end elsif params[:type] == "4" #附件 - if User.current.id == params[:id] + if User.current.id.to_i == params[:id].to_i @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc") else @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc") diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index f5a6c57f0..09bee5ac6 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -199,7 +199,7 @@ $(".resourcesList").click(function(e) { '"/> '+ '<% end %>'); $("#res_name").focus(); - $("html,body").animate({scrollTop:$("#res_name").offset().top},1000) + $("html,body").animate({scrollTop:$("#res_name").offset().top},1000) } String.prototype.trim = function() { var str = this,