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