String soneId = request.getHttpRequest().getParam("sone");
Sone sone = webInterface.getCore().getSone(soneId, false);
templateContext.set("sone", sone);
+ List<Post> sonePosts = sone.getPosts();
+ Pagination<Post> postPagination = new Pagination<Post>(sonePosts, 10).setPage(Numbers.safeParseInteger(request.getHttpRequest().getParam("postPage"), 0));
+ templateContext.set("postPagination", postPagination);
+ templateContext.set("posts", postPagination.getItems());
Set<Reply> replies = sone.getReplies();
final Map<Post, List<Reply>> repliedPosts = new HashMap<Post, List<Reply>>();
for (Reply reply : replies) {
return;
}
webInterface.getCore().markSoneKnown(sone);
- List<Post> posts = sone.getPosts();
+ List<Post> posts = (List<Post>) templateContext.get("posts");
posts.addAll((List<Post>) templateContext.get("repliedPosts"));
for (Post post : posts) {
if (post.getSone() != null) {
<h1><%= Page.ViewSone.PostList.Title|l10n|replace needle="{sone}" replacementKey=sone.niceName|html></h1>
- <div id="posts">
- <%:getpage parameter=postPage>
- <%:paginate list=sone.posts pagesize=10>
- <%= postPage|store key=pageParameter>
- <%include include/pagination.html>
- <%foreach pagination.items post>
- <%include include/viewPost.html>
- <%foreachelse>
- <div><%= Page.ViewSone.PostList.Text.NoPostYet|l10n|html></div>
- <%/foreach>
- <%include include/pagination.html>
- </div>
+ <%foreach posts post>
+ <%first>
+ <div id="posts">
+ <%include include/pagination.html pagination=postPagination pageParameter==postPage>
+ <%/first>
+ <%include include/viewPost.html>
+ <%last>
+ <%include include/pagination.html pagination=postPagination pageParameter==postPage>
+ </div>
+ <%/last>
+ <%foreachelse>
+ <div><%= Page.ViewSone.PostList.Text.NoPostYet|l10n|html></div>
+ <%/foreach>
<%foreach repliedPosts post>
<%first>