From 395fb8fae6227ad12f50c15bf994a35a1e427c67 Mon Sep 17 00:00:00 2001
From: alan <547533434@qq.com>
Date: Mon, 28 Mar 2016 22:37:01 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9pagination,=E8=B5=84=E6=BA=90?=
=?UTF-8?q?=E5=8C=BAbug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/users_controller.rb | 2 +
app/views/users/_resources_list.html.erb | 343 ------------------
app/views/users/_user_resource_info.html.erb | 350 ++++++++++++++++++-
app/views/users/user_resource_create.js.erb | 29 +-
lib/redmine/pagination.rb | 8 +-
5 files changed, 372 insertions(+), 360 deletions(-)
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index f885c5c1c..1cf4534bb 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -1618,8 +1618,10 @@ class UsersController < ApplicationController
@attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
end
end
+
@status = params[:status]
@type = params[:type]
+ @path = user_resource_user_path(User.current, :type => @type)
@limit = 25
@is_remote = true
@atta_count = @attachments.count
diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb
index a545038f1..69b512653 100644
--- a/app/views/users/_resources_list.html.erb
+++ b/app/views/users/_resources_list.html.erb
@@ -27,348 +27,5 @@
<% end %>
diff --git a/app/views/users/_user_resource_info.html.erb b/app/views/users/_user_resource_info.html.erb
index bea78130a..0a3f94bb3 100644
--- a/app/views/users/_user_resource_info.html.erb
+++ b/app/views/users/_user_resource_info.html.erb
@@ -42,7 +42,353 @@
预览
重命名
- 发送
+ 发送
删除
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/app/views/users/user_resource_create.js.erb b/app/views/users/user_resource_create.js.erb
index e818f2870..cc7e543c8 100644
--- a/app/views/users/user_resource_create.js.erb
+++ b/app/views/users/user_resource_create.js.erb
@@ -1,15 +1,16 @@
-closeModal();
-$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>');
-$("#resource_tip_list").html('<%= escape_javascript( render :partial => 'users/user_resource_tip_list', :locals => {:user => @user, :type => @type, :status => @status}) %>');
-$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
-$("#res_all_count").html(<%= @atta_count%>);
-$("#res_count").html(0);
-$("#checkboxAll").attr('checked',false);
-//更新状态
-$("#public_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '6') %>');
-$("#my_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '1') %>');
-$("#resource_type_all").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 1, :search => @switch_search) %>');
-$("#resource_type_course").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 2, :search => @switch_search) %>');
-$("#resource_type_project").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 3, :search => @switch_search) %>');
-$("#resource_type_user").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 5, :search => @switch_search) %>');
+closeModal();
+$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>');
+$("#resource_tip_list").html('<%= escape_javascript( render :partial => 'users/user_resource_tip_list', :locals => {:user => @user, :type => @type, :status => @status}) %>');
+debugger
+$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true, :path => @path %>');
+$("#res_all_count").html(<%= @atta_count%>);
+$("#res_count").html(0);
+$("#checkboxAll").attr('checked',false);
+//更新状态
+$("#public_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '6') %>');
+$("#my_resource_list").attr('href','<%= user_resource_user_path(@user, :type => '1') %>');
+$("#resource_type_all").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 1, :search => @switch_search) %>');
+$("#resource_type_course").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 2, :search => @switch_search) %>');
+$("#resource_type_project").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 3, :search => @switch_search) %>');
+$("#resource_type_user").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 5, :search => @switch_search) %>');
$("#resource_type_file").attr('href','<%= resource_search_user_path(@user,:type => @type, :status => 4, :search => @switch_search) %>');
\ No newline at end of file
diff --git a/lib/redmine/pagination.rb b/lib/redmine/pagination.rb
index 41702e2ce..4f1e8ac46 100644
--- a/lib/redmine/pagination.rb
+++ b/lib/redmine/pagination.rb
@@ -163,11 +163,17 @@ module Redmine
# :per_page_links if set to false, the "Per page" links are not rendered
#
def pagination_links_full(*args)
+ page = ""
pagination_links_each(*args) do |text, parameters, options|
if block_given?
yield text, parameters, options
else
- link_to text, params.merge(parameters), options
+ if args[2][:path].nil?
+ link_to text, params.merge(parameters), options
+ else
+ page = "&page" + parameters[:page].to_s unless parameters[:page].nil?
+ link_to text, args[2][:path].to_s + page, options
+ end
end
end
end