@@ -42,12 +42,12 class BoardsController < ApplicationController | |||||
42 | 'updated_on' => "#{Message.table_name}.updated_on" |
|
42 | 'updated_on' => "#{Message.table_name}.updated_on" | |
43 |
|
43 | |||
44 | @topic_count = @board.topics.count |
|
44 | @topic_count = @board.topics.count | |
45 |
@topic_pages = Paginator.new |
|
45 | @topic_pages = Paginator.new @topic_count, per_page_option, params['page'] | |
46 | @topics = @board.topics. |
|
46 | @topics = @board.topics. | |
47 | reorder("#{Message.table_name}.sticky DESC"). |
|
47 | reorder("#{Message.table_name}.sticky DESC"). | |
48 | includes(:author, {:last_reply => :author}). |
|
48 | includes(:author, {:last_reply => :author}). | |
49 | limit(@topic_pages.items_per_page). |
|
49 | limit(@topic_pages.items_per_page). | |
50 |
offset(@topic_pages. |
|
50 | offset(@topic_pages.offset). | |
51 | order(sort_clause). |
|
51 | order(sort_clause). | |
52 | all |
|
52 | all | |
53 | @message = Message.new(:board => @board) |
|
53 | @message = Message.new(:board => @board) |
@@ -71,8 +71,8 class IssuesController < ApplicationController | |||||
71 | end |
|
71 | end | |
72 |
|
72 | |||
73 | @issue_count = @query.issue_count |
|
73 | @issue_count = @query.issue_count | |
74 |
@issue_pages = Paginator.new |
|
74 | @issue_pages = Paginator.new @issue_count, @limit, params['page'] | |
75 |
@offset ||= @issue_pages. |
|
75 | @offset ||= @issue_pages.offset | |
76 | @issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version], |
|
76 | @issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version], | |
77 | :order => sort_clause, |
|
77 | :order => sort_clause, | |
78 | :offset => @offset, |
|
78 | :offset => @offset, |
@@ -26,8 +26,8 class MembersController < ApplicationController | |||||
26 | def index |
|
26 | def index | |
27 | @offset, @limit = api_offset_and_limit |
|
27 | @offset, @limit = api_offset_and_limit | |
28 | @member_count = @project.member_principals.count |
|
28 | @member_count = @project.member_principals.count | |
29 |
@member_pages = Paginator.new |
|
29 | @member_pages = Paginator.new @member_count, @limit, params['page'] | |
30 |
@offset ||= @member_pages. |
|
30 | @offset ||= @member_pages.offset | |
31 | @members = @project.member_principals.all( |
|
31 | @members = @project.member_principals.all( | |
32 | :order => "#{Member.table_name}.id", |
|
32 | :order => "#{Member.table_name}.id", | |
33 | :limit => @limit, |
|
33 | :limit => @limit, |
@@ -40,12 +40,12 class MessagesController < ApplicationController | |||||
40 | end |
|
40 | end | |
41 |
|
41 | |||
42 | @reply_count = @topic.children.count |
|
42 | @reply_count = @topic.children.count | |
43 |
@reply_pages = Paginator.new |
|
43 | @reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page | |
44 | @replies = @topic.children. |
|
44 | @replies = @topic.children. | |
45 | includes(:author, :attachments, {:board => :project}). |
|
45 | includes(:author, :attachments, {:board => :project}). | |
46 | reorder("#{Message.table_name}.created_on ASC"). |
|
46 | reorder("#{Message.table_name}.created_on ASC"). | |
47 | limit(@reply_pages.items_per_page). |
|
47 | limit(@reply_pages.items_per_page). | |
48 |
offset(@reply_pages. |
|
48 | offset(@reply_pages.offset). | |
49 | all |
|
49 | all | |
50 |
|
50 | |||
51 | @reply = Message.new(:subject => "RE: #{@message.subject}") |
|
51 | @reply = Message.new(:subject => "RE: #{@message.subject}") |
@@ -40,8 +40,8 class NewsController < ApplicationController | |||||
40 | scope = @project ? @project.news.visible : News.visible |
|
40 | scope = @project ? @project.news.visible : News.visible | |
41 |
|
41 | |||
42 | @news_count = scope.count |
|
42 | @news_count = scope.count | |
43 |
@news_pages = Paginator.new |
|
43 | @news_pages = Paginator.new @news_count, @limit, params['page'] | |
44 |
@offset ||= @news_pages. |
|
44 | @offset ||= @news_pages.offset | |
45 | @newss = scope.all(:include => [:author, :project], |
|
45 | @newss = scope.all(:include => [:author, :project], | |
46 | :order => "#{News.table_name}.created_on DESC", |
|
46 | :order => "#{News.table_name}.created_on DESC", | |
47 | :offset => @offset, |
|
47 | :offset => @offset, |
@@ -33,7 +33,7 class QueriesController < ApplicationController | |||||
33 | end |
|
33 | end | |
34 |
|
34 | |||
35 | @query_count = IssueQuery.visible.count |
|
35 | @query_count = IssueQuery.visible.count | |
36 |
@query_pages = Paginator.new |
|
36 | @query_pages = Paginator.new @query_count, @limit, params['page'] | |
37 | @queries = IssueQuery.visible.all(:limit => @limit, :offset => @offset, :order => "#{Query.table_name}.name") |
|
37 | @queries = IssueQuery.visible.all(:limit => @limit, :offset => @offset, :order => "#{Query.table_name}.name") | |
38 |
|
38 | |||
39 | respond_to do |format| |
|
39 | respond_to do |format| |
@@ -138,12 +138,12 class RepositoriesController < ApplicationController | |||||
138 |
|
138 | |||
139 | def revisions |
|
139 | def revisions | |
140 | @changeset_count = @repository.changesets.count |
|
140 | @changeset_count = @repository.changesets.count | |
141 |
@changeset_pages = Paginator.new |
|
141 | @changeset_pages = Paginator.new @changeset_count, | |
142 | per_page_option, |
|
142 | per_page_option, | |
143 | params['page'] |
|
143 | params['page'] | |
144 | @changesets = @repository.changesets. |
|
144 | @changesets = @repository.changesets. | |
145 | limit(@changeset_pages.items_per_page). |
|
145 | limit(@changeset_pages.items_per_page). | |
146 |
offset(@changeset_pages. |
|
146 | offset(@changeset_pages.offset). | |
147 | includes(:user, :repository, :parents). |
|
147 | includes(:user, :repository, :parents). | |
148 | all |
|
148 | all | |
149 |
|
149 |
@@ -51,12 +51,12 class TimelogController < ApplicationController | |||||
51 | format.html { |
|
51 | format.html { | |
52 | # Paginate results |
|
52 | # Paginate results | |
53 | @entry_count = scope.count |
|
53 | @entry_count = scope.count | |
54 |
@entry_pages = Paginator.new |
|
54 | @entry_pages = Paginator.new @entry_count, per_page_option, params['page'] | |
55 | @entries = scope.all( |
|
55 | @entries = scope.all( | |
56 | :include => [:project, :activity, :user, {:issue => :tracker}], |
|
56 | :include => [:project, :activity, :user, {:issue => :tracker}], | |
57 | :order => sort_clause, |
|
57 | :order => sort_clause, | |
58 | :limit => @entry_pages.items_per_page, |
|
58 | :limit => @entry_pages.items_per_page, | |
59 |
:offset => @entry_pages. |
|
59 | :offset => @entry_pages.offset | |
60 | ) |
|
60 | ) | |
61 | @total_hours = scope.sum(:hours).to_f |
|
61 | @total_hours = scope.sum(:hours).to_f | |
62 |
|
62 |
@@ -45,8 +45,8 class UsersController < ApplicationController | |||||
45 | scope = scope.in_group(params[:group_id]) if params[:group_id].present? |
|
45 | scope = scope.in_group(params[:group_id]) if params[:group_id].present? | |
46 |
|
46 | |||
47 | @user_count = scope.count |
|
47 | @user_count = scope.count | |
48 |
@user_pages = Paginator.new |
|
48 | @user_pages = Paginator.new @user_count, @limit, params['page'] | |
49 |
@offset ||= @user_pages. |
|
49 | @offset ||= @user_pages.offset | |
50 | @users = scope.order(sort_clause).limit(@limit).offset(@offset).all |
|
50 | @users = scope.order(sort_clause).limit(@limit).offset(@offset).all | |
51 |
|
51 | |||
52 | respond_to do |format| |
|
52 | respond_to do |format| |
@@ -212,13 +212,13 class WikiController < ApplicationController | |||||
212 | # show page history |
|
212 | # show page history | |
213 | def history |
|
213 | def history | |
214 | @version_count = @page.content.versions.count |
|
214 | @version_count = @page.content.versions.count | |
215 |
@version_pages = Paginator.new |
|
215 | @version_pages = Paginator.new @version_count, per_page_option, params['page'] | |
216 | # don't load text |
|
216 | # don't load text | |
217 | @versions = @page.content.versions. |
|
217 | @versions = @page.content.versions. | |
218 | select("id, author_id, comments, updated_on, version"). |
|
218 | select("id, author_id, comments, updated_on, version"). | |
219 | reorder('version DESC'). |
|
219 | reorder('version DESC'). | |
220 | limit(@version_pages.items_per_page + 1). |
|
220 | limit(@version_pages.items_per_page + 1). | |
221 |
offset(@version_pages. |
|
221 | offset(@version_pages.offset). | |
222 | all |
|
222 | all | |
223 |
|
223 | |||
224 | render :layout => false if request.xhr? |
|
224 | render :layout => false if request.xhr? |
@@ -142,7 +142,7 module Redmine | |||||
142 | page_param = options[:parameter] || :page |
|
142 | page_param = options[:parameter] || :page | |
143 | page = (params[page_param] || 1).to_i |
|
143 | page = (params[page_param] || 1).to_i | |
144 | per_page = options[:per_page] || per_page_option |
|
144 | per_page = options[:per_page] || per_page_option | |
145 |
Paginator.new( |
|
145 | Paginator.new(item_count, per_page, page, page_param) | |
146 | end |
|
146 | end | |
147 |
|
147 | |||
148 | module Helper |
|
148 | module Helper |
General Comments 0
You need to be logged in to leave comments.
Login now