From: David ‘Bombe’ Roden Date: Fri, 22 Oct 2010 09:46:44 +0000 (+0200) Subject: Move pagination to template. X-Git-Tag: 0.1-RC1~94 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=55135a2fbb98c7a17a9c4a080a5a1173704e7774 Move pagination to template. --- diff --git a/src/main/java/net/pterodactylus/sone/web/IndexPage.java b/src/main/java/net/pterodactylus/sone/web/IndexPage.java index 67d11c6..47f2715 100644 --- a/src/main/java/net/pterodactylus/sone/web/IndexPage.java +++ b/src/main/java/net/pterodactylus/sone/web/IndexPage.java @@ -24,7 +24,6 @@ import java.util.List; import net.pterodactylus.sone.data.Post; import net.pterodactylus.sone.data.Sone; -import net.pterodactylus.util.collection.Pagination; import net.pterodactylus.util.template.Template; /** @@ -69,11 +68,7 @@ public class IndexPage extends SoneTemplatePage { } }); - int page = request.getHttpRequest().getIntParam("page", 0); - Pagination postPagination = new Pagination(allPosts, 25).setPage(page); - List postsOnPage = postPagination.getItems(); - template.set("posts", postsOnPage); - template.set("pagination", postPagination); + template.set("posts", allPosts); } // diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 4c21bf6..fc8eedb 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -3,8 +3,10 @@

<%= Page.Index.PostList.Title|l10n|html>

+ <%getpage> + <%paginate list=posts pagesize=2> <%include include/pagination.html> - <%foreach posts post> + <%foreach pagination.items post> <%include include/viewPost.html> <%foreachelse>
<%= Page.Index.PostList.Text.NoPostYet|l10n|html>