import net.pterodactylus.sone.data.Image;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.web.page.FreenetRequest;
+import net.pterodactylus.util.collection.Pagination;
+import net.pterodactylus.util.number.Numbers;
import net.pterodactylus.util.template.Template;
import net.pterodactylus.util.template.TemplateContext;
albums.addAll(sone.getAllAlbums());
}
Collections.sort(albums, Album.TITLE_COMPARATOR);
- templateContext.set("albums", albums);
+ Pagination<Album> albumPagination = new Pagination<Album>(albums, 12).setPage(Numbers.safeParseInteger(request.getHttpRequest().getParam("page"), 0));
+ templateContext.set("albumPagination", albumPagination);
+ templateContext.set("albums", albumPagination.getItems());
return;
}
Sone sone = getCurrentSone(request.getToadletContext(), false);
<%elseif galleryRequested>
<%foreach albums album>
- <%first><h2><%= Page.ImageBrowser.Header.Albums|l10n|html></h2><%/first>
+ <%first>
+ <h2><%= Page.ImageBrowser.Header.Albums|l10n|html></h2>
+ <%include include/pagination.html pagination=albumPagination pageParameter=="page">
+ <%/first>
<%if loop.count|mod divisor=3><div class="album-row"><%/if>
<div id="album-<% album.id|html>" class="album">
<div class="album-id hidden"><% album.id|html></div>
<%= false|store key=endRow>
<%if loop.count|mod divisor=3 offset=1><%= true|store key=endRow><%/if>
<%last><%= true|store key=endRow><%/last>
- <%if endRow></div><%/if>
+ <%if endRow>
+ </div>
+ <%include include/pagination.html pagination=albumPagination pageParameter=="page">
+ <%/if>
<%/foreach>
<%/if>