Skip to content

Commit

Permalink
Fixed pagination in leaderboards
Browse files Browse the repository at this point in the history
  • Loading branch information
Raistlfiren committed Jun 19, 2017
1 parent f92104e commit 149cfb8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
19 changes: 19 additions & 0 deletions public/js/app/leaderboards.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@
*/

var getPage = function(pageNumber, pageSize, id) {
if (pageNumber === 1) {
$(".first").addClass("disabled");
$(".previous").addClass("disabled");
$(".next").removeClass("disabled");
$(".last").removeClass("disabled");
} else {
$(".first").removeClass("disabled");
$(".previous").removeClass("disabled");
$(".next").removeClass("disabled");
$(".last").removeClass("disabled");
}

if (pageNumber === lastPage) {
$(".first").removeClass("disabled");
$(".previous").removeClass("disabled");
$(".next").addClass("disabled");
$(".last").addClass("disabled");
}

$.ajax({
url: apiURL + "/leaderboards/" + ratingType + "?page[size]=" + pageSize + "&page[number]=" + pageNumber + "&filter[is_active]=true",
success: function (result) {
Expand Down
6 changes: 3 additions & 3 deletions templates/views/leaderboards.pug
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ extends competitive_nav
mixin pagination
.row.btn-top
.col-md-3.btn-top.pull-left.text-left.nopadding
button(class="btn btn-primary") First
button(class="btn btn-primary btn-spacing previous") Previous
button(class="btn btn-primary first disabled") First
button(class="btn btn-primary btn-spacing previous disabled") Previous
.col-md-3.col-md-offset-6.btn-top.pull-right.text-right.nopadding
button(class="btn btn-primary") Next
button(class="btn btn-primary next") Next
button(class="btn btn-primary btn-spacing last") Last

block cContent
Expand Down

0 comments on commit 149cfb8

Please sign in to comment.