From c171fa8ea17c7e3c75caed5e2cc6747a11dd4bf9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 22 Mar 2011 20:46:25 +0100 Subject: [PATCH] Add browsing albums of a Sone. --- .../pterodactylus/sone/web/ImageBrowserPage.java | 10 +++++++++ src/main/resources/i18n/sone.en.properties | 1 + src/main/resources/templates/imageBrowser.html | 24 +++++++++++++++------- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java b/src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java index 6da7cda..778b429 100644 --- a/src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java @@ -19,6 +19,7 @@ package net.pterodactylus.sone.web; import net.pterodactylus.sone.data.Album; import net.pterodactylus.sone.data.Image; +import net.pterodactylus.sone.data.Sone; import net.pterodactylus.util.template.Template; import net.pterodactylus.util.template.TemplateContext; @@ -63,6 +64,15 @@ public class ImageBrowserPage extends SoneTemplatePage { Image image = webInterface.getCore().getImage(imageId, false); templateContext.set("imageRequested", true); 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); } + templateContext.set("soneRequested", true); + templateContext.set("sone", sone); } + } diff --git a/src/main/resources/i18n/sone.en.properties b/src/main/resources/i18n/sone.en.properties index e58389f..e599ea3 100644 --- a/src/main/resources/i18n/sone.en.properties +++ b/src/main/resources/i18n/sone.en.properties @@ -159,6 +159,7 @@ Page.UnfollowSone.Title=Unfollow Sone - Sone Page.ImageBrowser.Title=Image Browser - Sone Page.ImageBrowser.Page.Title=Image Browser Page.ImageBrowser.Album.Error.NotFound.Text=The requested album could not be found. It is possible that it has not yet been downloaded, or that it has been deleted. +Page.ImageBrowser.Sone.Error.NotFound.Text=The requested Sone could not be found. It is possible that it has not yet been downloaded. Page.ImageBrowser.CreateAlbum.Button.CreateAlbum=Create Album Page.CreateAlbum.Title=Create Album - Sone diff --git a/src/main/resources/templates/imageBrowser.html b/src/main/resources/templates/imageBrowser.html index a441206..b1d9997 100644 --- a/src/main/resources/templates/imageBrowser.html +++ b/src/main/resources/templates/imageBrowser.html @@ -47,15 +47,25 @@ <%elseif imageRequested> - <%else> + <%elseif soneRequested> - <%foreach currentSone.albums album> -
-
<% album.name|html>
-
- <%/foreach> + <%ifnull sone> + +

<%= Page.ImageBrowser.Sone.Error.NotFound.Text|l10n|html>

+ + <%else> - <%include include/createAlbum.html> + <%foreach sone.albums album> +
+ +
+ <%/foreach> + + <%if sone.current> + <%include include/createAlbum.html> + <%/if> + + <%/if> <%/if> -- 2.7.4