From: David ‘Bombe’ Roden Date: Tue, 15 Nov 2011 05:54:02 +0000 (+0100) Subject: Add gallery mode to image browser. X-Git-Tag: 0.7.3^2~2 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=7bfd17c9c8b2fd5717308019bd2821ca643b4814;p=Sone.git Add gallery mode to image browser. This resolves #235. --- diff --git a/src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java b/src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java index 3afaae6..406a762 100644 --- a/src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java @@ -18,6 +18,8 @@ package net.pterodactylus.sone.web; import java.net.URI; +import java.util.HashSet; +import java.util.Set; import net.pterodactylus.sone.data.Album; import net.pterodactylus.sone.data.Image; @@ -69,11 +71,24 @@ public class ImageBrowserPage extends SoneTemplatePage { templateContext.set("image", image); return; } - Sone sone = getCurrentSone(request.getToadletContext(), false); String soneId = request.getHttpRequest().getParam("sone", null); if (soneId != null) { - sone = webInterface.getCore().getSone(soneId, false); + Sone sone = webInterface.getCore().getSone(soneId, false); + templateContext.set("soneRequested", true); + templateContext.set("sone", sone); + return; } + String mode = request.getHttpRequest().getParam("mode", null); + if ("gallery".equals(mode)) { + templateContext.set("galleryRequested", true); + Set albums = new HashSet(); + for (Sone sone : webInterface.getCore().getSones()) { + albums.addAll(sone.getAllAlbums()); + } + templateContext.set("albums", albums); + return; + } + Sone sone = getCurrentSone(request.getToadletContext(), false); templateContext.set("soneRequested", true); templateContext.set("sone", sone); } diff --git a/src/main/resources/static/css/sone.css b/src/main/resources/static/css/sone.css index f30bb03..e46540a 100644 --- a/src/main/resources/static/css/sone.css +++ b/src/main/resources/static/css/sone.css @@ -684,6 +684,10 @@ textarea { width: 95%; } +#sone .image .album-sone { + font-size: 80%; +} + #sone .image .image-title, #sone .album .album-title { font-weight: bold; } diff --git a/src/main/resources/templates/imageBrowser.html b/src/main/resources/templates/imageBrowser.html index 66eb33d..58ed8ab 100644 --- a/src/main/resources/templates/imageBrowser.html +++ b/src/main/resources/templates/imageBrowser.html @@ -588,6 +588,34 @@ <%/if> + <%elseif galleryRequested> + + <%foreach albums album> + <%first>

<%= Page.ImageBrowser.Header.Albums|l10n|html>

<%/first> + <%if loop.count|mod divisor=3>
<%/if> +
+ + +
+ +
<% album.title|html> (<%= View.Sone.Stats.Images|l10n 0=album.images.size>)
+
<% album.description|parse sone=album.sone>
+
+
+ <%= 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>
<%/if> + <%/foreach> + <%/if> <%include include/tail.html>