<% if !@query.new_record? && @query.editable_by?(User.current) %>
<%= link_to l(:button_edit), edit_query_path(@query), :class => 'icon icon-edit' %>
From de0f49f8501da28df8106b2fe92f5cb2b552af53 Mon Sep 17 00:00:00 2001
From: huang
Date: Thu, 22 Sep 2016 14:38:45 +0800
Subject: [PATCH 3/5] =?UTF-8?q?ISSUE=E5=88=97=E8=A1=A8=E6=B7=BB=E5=8A=A0?=
=?UTF-8?q?=E6=96=B0=E7=9A=84=E5=88=86=E9=A1=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/issues_controller.rb | 46 ++++++++++++++-----------
app/views/issues/_list.html.erb | 11 ++++--
app/views/issues/index.js.erb | 8 ++---
app/views/users/_project_issue.html.erb | 4 +--
4 files changed, 38 insertions(+), 31 deletions(-)
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index 088ecac58..820b1d7ac 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -66,16 +66,16 @@ class IssuesController < ApplicationController
@project_base_tag = (params[:project_id] || @issue.project) ? 'base_projects':'base'
if @query.valid?
- case params[:format]
- when 'csv', 'pdf'
- @limit = 10#Setting.issues_export_limit.to_i
- when 'atom'
- @limit = 10#Setting.feeds_limit.to_i
- when 'xml', 'json'
- @offset, @limit = api_offset_and_limit({:limit => 10})
- else
- @limit = 10#per_page_option
- end
+ # case params[:format]
+ # when 'csv', 'pdf'
+ # @limit = 10#Setting.issues_export_limit.to_i
+ # when 'atom'
+ # @limit = 10#Setting.feeds_limit.to_i
+ # when 'xml', 'json'
+ # @offset, @limit = api_offset_and_limit({:limit => 10})
+ # else
+ # @limit = 10#per_page_option
+ # end
@assign_to_id = params[:assigned_to_id]
@author_id = params[:author_id]
@priority_id = params[:priority_id]
@@ -83,17 +83,23 @@ class IssuesController < ApplicationController
@subject = params[:subject]
@done_ratio = params[:done_ratio]
@issue_count = @query.issue_count
- @issue_pages = Paginator.new @issue_count, @limit, params['page']
- params[:page] = (params[:page] || 1).to_i + 1 #页码需要加1
+ # @issue_pages = Paginator.new @issue_count, @limit, params['page']
+ # params[:page] = (params[:page] || 1).to_i + 1 #页码需要加1
+ # @offset ||= @issue_pages.offset
+ @issues_filter = @query.issues
+ # (:include => [:assigned_to, :tracker, :priority, :category, :fixed_version],
+ # :order => 'issues.updated_on desc',
+ # :offset => @offset,
+ # :limit => @limit)
+ @limit = 10
+ @is_remote = true
+ @issue_pages = Paginator.new @issue_count, @limit, params['page'] || 1
@offset ||= @issue_pages.offset
- @issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version],
- :order => 'issues.updated_on desc',
- :offset => @offset,
- :limit => @limit)
- if params[:set_filter]
- @set_filter = params[:set_filter]
- end
- @issue_count_by_group = @query.issue_count_by_group
+ @issues = paginateHelper @issues_filter, @limit
+ # if params[:set_filter]
+ # @set_filter = params[:set_filter]
+ # end
+ # @issue_count_by_group = @query.issue_count_by_group
respond_to do |format|
format.js
format.html { render :template => 'issues/index', :layout => @project_base_tag }#by young
diff --git a/app/views/issues/_list.html.erb b/app/views/issues/_list.html.erb
index 0eb3b4a0c..4fee89d6a 100644
--- a/app/views/issues/_list.html.erb
+++ b/app/views/issues/_list.html.erb
@@ -6,6 +6,11 @@
<%= render :partial => 'users/project_issue', :locals => {:activity => issue, :user_activity_id => issue.id} %>
<% end %>
- <% if issues.count == 10%>
- <%= link_to "点击展开更多",project_issues_path({:project_id => project.id}.merge(params)),:id => "show_more_issues",:remote => "true",:class => "loadMore mt10 f_grey"%>
- <% end%>
+
diff --git a/app/views/issues/index.js.erb b/app/views/issues/index.js.erb
index 399c6a977..9068aac9e 100644
--- a/app/views/issues/index.js.erb
+++ b/app/views/issues/index.js.erb
@@ -1,6 +1,4 @@
//$("#issue_list").html("<%#= escape_javascript(render :partial => 'issues/list',:locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count})%>");
-<% if @set_filter && @issue_pages.page == 1%> //只有搜索的第一页才需要替换整个issue_list,其余的都是替换show_more_issues
- $("#issue_list").html("<%= escape_javascript(render :partial => 'issues/list',:locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count,:project=>@project})%>");
-<%else%>
- $("#show_more_issues").replaceWith("<%= escape_javascript( render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count,:project=>@project} )%>");
-<%end%>
+$("#issue_list").html("<%= escape_javascript(render :partial => 'issues/list',:locals => {:issues => @issues, :query => @query, :issue_pages=> @issue_pages, :issue_count => @issue_count, :project=> @project})%>");
+$("#issue_list_pagination").html('<%= pagination_links_full @issue_pages, @issue_count, :issues => @issues, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>');
+
diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb
index 5a0065f86..e4f24d4e0 100644
--- a/app/views/users/_project_issue.html.erb
+++ b/app/views/users/_project_issue.html.erb
@@ -95,9 +95,7 @@