summaryrefslogtreecommitdiffstats
path: root/app/controllers/issues_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2010-12-11 13:13:49 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2010-12-11 13:13:49 +0000
commit00d50157d3d6ee8a12cf41d74c0a4e0da7fc9c35 (patch)
treed58b9e3238fdfd46429d860f0f5d54429aeaf9e5 /app/controllers/issues_controller.rb
parent67f1131a2051b03c8214ce82dcc2051e0e9871a2 (diff)
downloadredmine-00d50157d3d6ee8a12cf41d74c0a4e0da7fc9c35.tar.gz
redmine-00d50157d3d6ee8a12cf41d74c0a4e0da7fc9c35.zip
Restores object count and adds offset/limit attributes to API responses for paginated collections (#6140).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4489 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/issues_controller.rb')
-rw-r--r--app/controllers/issues_controller.rb17
1 files changed, 10 insertions, 7 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index b0c41ff29..474c68c91 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -65,21 +65,24 @@ class IssuesController < ApplicationController
sort_update(@query.sortable_columns)
if @query.valid?
- limit = case params[:format]
+ case params[:format]
when 'csv', 'pdf'
- Setting.issues_export_limit.to_i
+ @limit = Setting.issues_export_limit.to_i
when 'atom'
- Setting.feeds_limit.to_i
+ @limit = Setting.feeds_limit.to_i
+ when 'xml', 'json'
+ @offset, @limit = api_offset_and_limit
else
- per_page_option
+ @limit = per_page_option
end
@issue_count = @query.issue_count
- @issue_pages = Paginator.new self, @issue_count, limit, params['page']
+ @issue_pages = Paginator.new self, @issue_count, @limit, params['page']
+ @offset ||= @issue_pages.current.offset
@issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version],
:order => sort_clause,
- :offset => @issue_pages.current.offset,
- :limit => limit)
+ :offset => @offset,
+ :limit => @limit)
@issue_count_by_group = @query.issue_count_by_group
respond_to do |format|