Add browsing albums of a Sone.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 22 Mar 2011 19:46:25 +0000 (20:46 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 22 Mar 2011 19:46:25 +0000 (20:46 +0100)
src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java
src/main/resources/i18n/sone.en.properties
src/main/resources/templates/imageBrowser.html

index 6da7cda..778b429 100644 (file)
@@ -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);
        }
+
 }
index e58389f..e599ea3 100644 (file)
@@ -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
index a441206..b1d9997 100644 (file)
 
        <%elseif imageRequested>
 
-       <%else>
+       <%elseif soneRequested>
 
-               <%foreach currentSone.albums album>
-                       <div class="album">
-                               <div class="name"><% album.name|html></div>
-                       </div>
-               <%/foreach>
+               <%ifnull sone>
+
+                       <p><%= Page.ImageBrowser.Sone.Error.NotFound.Text|l10n|html></p>
+
+               <%else>
 
-               <%include include/createAlbum.html>
+                       <%foreach sone.albums album>
+                               <div class="album">
+                                       <div class="name"><a href="imageBrowser.html?album=<% album.id|html>"><% album.name|html></a></div>
+                               </div>
+                       <%/foreach>
+
+                       <%if sone.current>
+                               <%include include/createAlbum.html>
+                       <%/if>
+
+               <%/if>
 
        <%/if>