Deprecation warnings (#12774).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11139 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2013-01-08 20:18:12 +00:00
parent b29d74f9d5
commit 9394d739b1
11 changed files with 20 additions and 20 deletions

View File

@ -42,12 +42,12 @@ class BoardsController < ApplicationController
'updated_on' => "#{Message.table_name}.updated_on" 'updated_on' => "#{Message.table_name}.updated_on"
@topic_count = @board.topics.count @topic_count = @board.topics.count
@topic_pages = Paginator.new self, @topic_count, per_page_option, params['page'] @topic_pages = Paginator.new @topic_count, per_page_option, params['page']
@topics = @board.topics. @topics = @board.topics.
reorder("#{Message.table_name}.sticky DESC"). reorder("#{Message.table_name}.sticky DESC").
includes(:author, {:last_reply => :author}). includes(:author, {:last_reply => :author}).
limit(@topic_pages.items_per_page). limit(@topic_pages.items_per_page).
offset(@topic_pages.current.offset). offset(@topic_pages.offset).
order(sort_clause). order(sort_clause).
all all
@message = Message.new(:board => @board) @message = Message.new(:board => @board)

View File

@ -71,8 +71,8 @@ class IssuesController < ApplicationController
end end
@issue_count = @query.issue_count @issue_count = @query.issue_count
@issue_pages = Paginator.new self, @issue_count, @limit, params['page'] @issue_pages = Paginator.new @issue_count, @limit, params['page']
@offset ||= @issue_pages.current.offset @offset ||= @issue_pages.offset
@issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version], @issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version],
:order => sort_clause, :order => sort_clause,
:offset => @offset, :offset => @offset,

View File

@ -26,8 +26,8 @@ class MembersController < ApplicationController
def index def index
@offset, @limit = api_offset_and_limit @offset, @limit = api_offset_and_limit
@member_count = @project.member_principals.count @member_count = @project.member_principals.count
@member_pages = Paginator.new self, @member_count, @limit, params['page'] @member_pages = Paginator.new @member_count, @limit, params['page']
@offset ||= @member_pages.current.offset @offset ||= @member_pages.offset
@members = @project.member_principals.all( @members = @project.member_principals.all(
:order => "#{Member.table_name}.id", :order => "#{Member.table_name}.id",
:limit => @limit, :limit => @limit,

View File

@ -40,12 +40,12 @@ class MessagesController < ApplicationController
end end
@reply_count = @topic.children.count @reply_count = @topic.children.count
@reply_pages = Paginator.new self, @reply_count, REPLIES_PER_PAGE, page @reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page
@replies = @topic.children. @replies = @topic.children.
includes(:author, :attachments, {:board => :project}). includes(:author, :attachments, {:board => :project}).
reorder("#{Message.table_name}.created_on ASC"). reorder("#{Message.table_name}.created_on ASC").
limit(@reply_pages.items_per_page). limit(@reply_pages.items_per_page).
offset(@reply_pages.current.offset). offset(@reply_pages.offset).
all all
@reply = Message.new(:subject => "RE: #{@message.subject}") @reply = Message.new(:subject => "RE: #{@message.subject}")

View File

@ -40,8 +40,8 @@ class NewsController < ApplicationController
scope = @project ? @project.news.visible : News.visible scope = @project ? @project.news.visible : News.visible
@news_count = scope.count @news_count = scope.count
@news_pages = Paginator.new self, @news_count, @limit, params['page'] @news_pages = Paginator.new @news_count, @limit, params['page']
@offset ||= @news_pages.current.offset @offset ||= @news_pages.offset
@newss = scope.all(:include => [:author, :project], @newss = scope.all(:include => [:author, :project],
:order => "#{News.table_name}.created_on DESC", :order => "#{News.table_name}.created_on DESC",
:offset => @offset, :offset => @offset,

View File

@ -33,7 +33,7 @@ class QueriesController < ApplicationController
end end
@query_count = IssueQuery.visible.count @query_count = IssueQuery.visible.count
@query_pages = Paginator.new self, @query_count, @limit, params['page'] @query_pages = Paginator.new @query_count, @limit, params['page']
@queries = IssueQuery.visible.all(:limit => @limit, :offset => @offset, :order => "#{Query.table_name}.name") @queries = IssueQuery.visible.all(:limit => @limit, :offset => @offset, :order => "#{Query.table_name}.name")
respond_to do |format| respond_to do |format|

View File

@ -138,12 +138,12 @@ class RepositoriesController < ApplicationController
def revisions def revisions
@changeset_count = @repository.changesets.count @changeset_count = @repository.changesets.count
@changeset_pages = Paginator.new self, @changeset_count, @changeset_pages = Paginator.new @changeset_count,
per_page_option, per_page_option,
params['page'] params['page']
@changesets = @repository.changesets. @changesets = @repository.changesets.
limit(@changeset_pages.items_per_page). limit(@changeset_pages.items_per_page).
offset(@changeset_pages.current.offset). offset(@changeset_pages.offset).
includes(:user, :repository, :parents). includes(:user, :repository, :parents).
all all

View File

@ -51,12 +51,12 @@ class TimelogController < ApplicationController
format.html { format.html {
# Paginate results # Paginate results
@entry_count = scope.count @entry_count = scope.count
@entry_pages = Paginator.new self, @entry_count, per_page_option, params['page'] @entry_pages = Paginator.new @entry_count, per_page_option, params['page']
@entries = scope.all( @entries = scope.all(
:include => [:project, :activity, :user, {:issue => :tracker}], :include => [:project, :activity, :user, {:issue => :tracker}],
:order => sort_clause, :order => sort_clause,
:limit => @entry_pages.items_per_page, :limit => @entry_pages.items_per_page,
:offset => @entry_pages.current.offset :offset => @entry_pages.offset
) )
@total_hours = scope.sum(:hours).to_f @total_hours = scope.sum(:hours).to_f

View File

@ -45,8 +45,8 @@ class UsersController < ApplicationController
scope = scope.in_group(params[:group_id]) if params[:group_id].present? scope = scope.in_group(params[:group_id]) if params[:group_id].present?
@user_count = scope.count @user_count = scope.count
@user_pages = Paginator.new self, @user_count, @limit, params['page'] @user_pages = Paginator.new @user_count, @limit, params['page']
@offset ||= @user_pages.current.offset @offset ||= @user_pages.offset
@users = scope.order(sort_clause).limit(@limit).offset(@offset).all @users = scope.order(sort_clause).limit(@limit).offset(@offset).all
respond_to do |format| respond_to do |format|

View File

@ -212,13 +212,13 @@ class WikiController < ApplicationController
# show page history # show page history
def history def history
@version_count = @page.content.versions.count @version_count = @page.content.versions.count
@version_pages = Paginator.new self, @version_count, per_page_option, params['page'] @version_pages = Paginator.new @version_count, per_page_option, params['page']
# don't load text # don't load text
@versions = @page.content.versions. @versions = @page.content.versions.
select("id, author_id, comments, updated_on, version"). select("id, author_id, comments, updated_on, version").
reorder('version DESC'). reorder('version DESC').
limit(@version_pages.items_per_page + 1). limit(@version_pages.items_per_page + 1).
offset(@version_pages.current.offset). offset(@version_pages.offset).
all all
render :layout => false if request.xhr? render :layout => false if request.xhr?

View File

@ -142,7 +142,7 @@ module Redmine
page_param = options[:parameter] || :page page_param = options[:parameter] || :page
page = (params[page_param] || 1).to_i page = (params[page_param] || 1).to_i
per_page = options[:per_page] || per_page_option per_page = options[:per_page] || per_page_option
Paginator.new(self, item_count, per_page, page, page_param) Paginator.new(item_count, per_page, page, page_param)
end end
module Helper module Helper