mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-28 22:16:15 +10:00
Modify build pagination to use 'paginate' helper
This commit is contained in:
+1
-4
@@ -26,10 +26,7 @@ module API
|
||||
builds
|
||||
end
|
||||
|
||||
page = (params[:page] || 1).to_i
|
||||
per_page = (params[:per_page] || 30).to_i
|
||||
|
||||
present builds.page(page).per(per_page), with: Entities::Build
|
||||
present paginate(builds), with: Entities::Build
|
||||
end
|
||||
|
||||
# Get a specific build of a project
|
||||
|
||||
+4
-2
@@ -97,8 +97,10 @@ module API
|
||||
end
|
||||
|
||||
def paginate(relation)
|
||||
per_page = params[:per_page].to_i
|
||||
paginated = relation.page(params[:page]).per(per_page)
|
||||
page = (params[:page] || 1).to_i
|
||||
per_page = (params[:per_page] || 30).to_i
|
||||
|
||||
paginated = relation.page(page).per(per_page)
|
||||
add_pagination_headers(paginated, per_page)
|
||||
|
||||
paginated
|
||||
|
||||
Reference in New Issue
Block a user