From 705d31b1d0cd8165137d2aeb2617e0f680c18576 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 20 Aug 2015 17:38:30 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 6 ++++-- app/views/users/_resource_search_form.html.erb | 2 +- app/views/users/_resources_list.html.erb | 3 ++- app/views/users/resource_search.js.erb | 3 ++- app/views/users/user_resource.html.erb | 8 +++++--- app/views/users/user_resource.js.erb | 3 ++- config/routes.rb | 2 +- 7 files changed, 17 insertions(+), 10 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index ddc7ec38d..b4cb04019 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1015,7 +1015,7 @@ class UsersController < ApplicationController # 重命名资源 def rename_resource - @attachment = Attachment.find(params[:res_id]) + @attachment = Attachment.find(params[:res_id]) if params[:res_id].present? if @attachment != nil @attachment.filename = params[:res_name] @flag = @attachment.save @@ -1260,13 +1260,14 @@ class UsersController < ApplicationController end elsif params[:type] == "4" #附件 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") + @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('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") end end @type = params[:type] @limit = 10 + @is_remote = true @obj_count = @attachments.count @obj_pages = Paginator.new @obj_count, @limit, params['page'] || 1 @offset ||= @obj_pages.offset @@ -1315,6 +1316,7 @@ class UsersController < ApplicationController end @type = params[:type] @limit = 10 + @is_remote = true @obj_count = @attachments.count @obj_pages = Paginator.new @obj_count, @limit, params['page'] || 1 @offset ||= @obj_pages.offset diff --git a/app/views/users/_resource_search_form.html.erb b/app/views/users/_resource_search_form.html.erb index 5f854cba0..376007fec 100644 --- a/app/views/users/_resource_search_form.html.erb +++ b/app/views/users/_resource_search_form.html.erb @@ -1,5 +1,5 @@ <%= form_tag( url_for(:controller => 'users',:action => 'resource_search',:id=>user.id), - :remote=>true ,:method => 'post',:class=>'resourcesSearchloadBox',:id=>'resource_search_form') do %> + :remote=>true ,:method => 'get',:class=>'resourcesSearchloadBox',:id=>'resource_search_form') do %> <%= hidden_field_tag(:type,type) %> <%= submit_tag '',:class=>'homepageSearchIcon',:onfocus=>'this.blur();',:style=>'border-style:none' %> diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb index 62e819b43..0099ba40b 100644 --- a/app/views/users/_resources_list.html.erb +++ b/app/views/users/_resources_list.html.erb @@ -1,3 +1,4 @@ + <% if attachments.nil? || attachments.empty? %> <% else %> <% attachments.each do |attach| %> @@ -17,4 +18,4 @@
  • <%= attach.id %>
  • <% end %> -<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/users/resource_search.js.erb b/app/views/users/resource_search.js.erb index 69fc3dd43..1a7469f25 100644 --- a/app/views/users/resource_search.js.erb +++ b/app/views/users/resource_search.js.erb @@ -1 +1,2 @@ -$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>'); \ No newline at end of file +$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>'); +$("#pages").html('<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true %>'); \ No newline at end of file diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index 20951471a..fad50d683 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -103,9 +103,11 @@ -