Skip to content

Commit

Permalink
Fix Star Pagination on User Pages (#591)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ewoutvans authored and phase committed Jul 30, 2018
1 parent c89cbbf commit 887e086
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/controllers/Users.scala
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class Users @Inject()(fakeUser: FakeUser,
(p, user, v, tags)
}
val starredData = starred zip starredRv
Ok(views.users.projects(userData.get, orgaData.flatMap(a => scopedOrgaData.map(b => (a, b))), data, starredData, p))
Ok(views.users.projects(userData.get, orgaData.flatMap(a => scopedOrgaData.map(b => (a, b))), data, starredData.take(5), p))
}
}.getOrElse(notFound)
}
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/projects.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<div class="col-md-4">
@if(!u.isOrga) {
<div class="panel-stars panel panel-default">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"> @messages("org.plural")</h3>
</div>
Expand Down
8 changes: 7 additions & 1 deletion public/javascripts/userPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ function loadStars(increment) {
$.ajax({
url: 'api/projects/' + star,
dataType: 'json',
error: function() {
++count;
},
success: function(projectData) {
var href = projectData.href;
var slug = href.substr(href.lastIndexOf('/') + 1, href.length);
Expand All @@ -79,7 +82,10 @@ function loadStars(increment) {
+ '</div>'
+ '</td>';

if (++count == newStars.length) {
++count
},
complete: function() {
if (count == newStars.length) {
// Done loading, set the table to the result
tbody.html(content);
currentStarsPage += increment;
Expand Down

0 comments on commit 887e086

Please sign in to comment.