Skip to content

Commit

Permalink
Submissions pagination improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenn Jacobsen committed May 2, 2016
1 parent fd01ae6 commit e2b9bfa
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion Source/Umbraco/Plugin/js/controllers/editor.data.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,26 @@
row._createdDateLong = $filter("date")(row._createdDate, "yyyy-MM-dd HH:mm:ss");
});

// make sure we don't end up with a gazillion pagination links if we have lots of submissions
var start, end;
var maxPages = 10;
if (data.totalPages > maxPages) {
start = page - maxPages / 2;
if (start < 1) {
start = 1;
}
end = start + maxPages;
if (end > data.totalPages) {
end = data.totalPages;
start = end - maxPages;
}
}
else {
start = 1;
end = data.totalPages;
}
data.pages = [];
for (var i = 1; i <= data.totalPages; i++) {
for (var i = start; i <= end; i++) {
data.pages.push(i);
}

Expand Down

0 comments on commit e2b9bfa

Please sign in to comment.