mirror of
https://github.com/redmine/redmine.git
synced 2026-05-06 20:36:53 +02:00
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
This commit is contained in:
@@ -349,6 +349,23 @@ class ApplicationController < ActionController::Base
|
||||
per_page
|
||||
end
|
||||
|
||||
def api_offset_and_limit
|
||||
offset = nil
|
||||
if params[:offset].present?
|
||||
offset = params[:offset].to_i
|
||||
if offset < 0
|
||||
offset = 0
|
||||
end
|
||||
end
|
||||
limit = params[:limit].to_i
|
||||
if limit < 1
|
||||
limit = 25
|
||||
elsif limit > 100
|
||||
limit = 100
|
||||
end
|
||||
[offset, limit]
|
||||
end
|
||||
|
||||
# qvalues http header parser
|
||||
# code taken from webrick
|
||||
def parse_qvalues(value)
|
||||
|
||||
Reference in New Issue
Block a user