X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FIndexPage.kt;fp=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FIndexPage.kt;h=35f0f75e7690a9a143f73e46b4a52141cf446205;hp=7753b4054c72af08e889f900bf91a3f414cb540a;hb=107af8767f5dce8c27fa4c91b3ff3bc951140cca;hpb=ac6576e72155b3691ce6e5c56ee0c57eb9ac08c6 diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/IndexPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/IndexPage.kt index 7753b40..35f0f75 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/IndexPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/IndexPage.kt @@ -1,10 +1,10 @@ package net.pterodactylus.sone.web.pages import net.pterodactylus.sone.notify.PostVisibilityFilter +import net.pterodactylus.sone.utils.Pagination import net.pterodactylus.sone.utils.parameters import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.FreenetRequest -import net.pterodactylus.util.collection.Pagination import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext @@ -28,8 +28,9 @@ class IndexPage(template: Template, webInterface: WebInterface, private val post .filter { postVisibilityFilter.isVisible(currentSone).apply(it) } .sortedByDescending { it.time } .let { posts -> - Pagination(posts, webInterface.core.preferences.postsPerPage) - .setPage(request.parameters["page"]?.toIntOrNull() ?: 0).let { pagination -> + Pagination(posts, webInterface.core.preferences.postsPerPage).apply { + page = request.parameters["page"]?.toIntOrNull() ?: 0 + }.let { pagination -> templateContext["pagination"] = pagination templateContext["posts"] = pagination.items }