From 1c3bff0007c1bcdca9d6b095f3c6054580cdc29f Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Mon, 30 Nov 2015 10:39:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93=E7=9A=84=E5=88=A0?= =?UTF-8?q?=E9=99=A4bug=20=E5=92=8C=E5=8F=B3=E9=94=AE=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E7=9A=84bug=20=E5=92=8C=E5=8F=98=E8=83=8C=E6=99=AF=E8=89=B2?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 4 +- .../users/_resource_search_form.html.erb | 2 +- app/views/users/_resources_list.html.erb | 2 +- app/views/users/user_resource.html.erb | 49 ------------------- 4 files changed, 4 insertions(+), 53 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 8188ce12e..9ff833f48 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1367,7 +1367,7 @@ class UsersController < ApplicationController end end - if(params[:type].blank? || params[:type] == "1") #全部 + if(params[:type].nil? || params[:type].blank? || params[:type] == "1" || params[:type] == 'all') #全部 if User.current.id.to_i == params[:id].to_i user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ @@ -1856,7 +1856,7 @@ class UsersController < ApplicationController # 根据资源关键字进行搜索 def resource_search search = params[:search].to_s.strip.downcase - if(params[:type].nil? || params[:type].blank? || params[:type] == "1") #全部 + if(params[:type].nil? || params[:type].blank? || params[:type] == "1" || params[:type] == 'all') #全部 if User.current.id.to_i == params[:id].to_i user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 取交集并查询 @attachments = Attachment.where("((author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ diff --git a/app/views/users/_resource_search_form.html.erb b/app/views/users/_resource_search_form.html.erb index 376007fec..c629f9f32 100644 --- a/app/views/users/_resource_search_form.html.erb +++ b/app/views/users/_resource_search_form.html.erb @@ -1,7 +1,7 @@ <%= form_tag( url_for(:controller => 'users',:action => 'resource_search',:id=>user.id), :remote=>true ,:method => 'get',:class=>'resourcesSearchloadBox',:id=>'resource_search_form') do %> - <%= hidden_field_tag(:type,type) %> + <%= hidden_field_tag(:type,type.nil? ? 1 : type) %> <%= submit_tag '',:class=>'homepageSearchIcon',:onfocus=>'this.blur();',:style=>'border-style:none' %> <% end %> \ No newline at end of file diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb index 156da0f07..ef6397ec0 100644 --- a/app/views/users/_resources_list.html.erb +++ b/app/views/users/_resources_list.html.erb @@ -5,7 +5,7 @@ <% else %> <% attachments.each do |attach| %> -