Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
f4cff4dc
Commit
f4cff4dc
authored
Dec 28, 2015
by
Tomasz Maczukin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify build pagination to use 'paginate' helper
parent
f39959d0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
6 deletions
+5
-6
lib/api/builds.rb
lib/api/builds.rb
+1
-4
lib/api/helpers.rb
lib/api/helpers.rb
+4
-2
No files found.
lib/api/builds.rb
View file @
f4cff4dc
...
...
@@ -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
...
...
lib/api/helpers.rb
View file @
f4cff4dc
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment