X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ftemplate%2FAlbumAccessor.java;h=fcd7a70d5fc17f03707cc7102cc2c830c96ccf43;hp=5042995b7d40aa26e2de52ab01be177607880de2;hb=c2e868714435ac7c75d77d1911d0dfb00393d051;hpb=33f333b35a73d3d4a4e79f41e9dd7b342db87b1a diff --git a/src/main/java/net/pterodactylus/sone/template/AlbumAccessor.java b/src/main/java/net/pterodactylus/sone/template/AlbumAccessor.java index 5042995..fcd7a70 100644 --- a/src/main/java/net/pterodactylus/sone/template/AlbumAccessor.java +++ b/src/main/java/net/pterodactylus/sone/template/AlbumAccessor.java @@ -1,5 +1,5 @@ /* - * Sone - AlbumAccessor.java - Copyright © 2011 David Roden + * Sone - AlbumAccessor.java - Copyright © 2011–2013 David Roden * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -45,11 +45,11 @@ public class AlbumAccessor extends ReflectionAccessor { if ("backlinks".equals(member)) { List> backlinks = new ArrayList>(); Album currentAlbum = album; - while (currentAlbum != null) { - backlinks.add(0, createLink("imageBrowser.html?album=" + album.getId(), album.getName())); + while (!currentAlbum.equals(album.getSone().getRootAlbum())) { + backlinks.add(0, createLink("imageBrowser.html?album=" + currentAlbum.getId(), currentAlbum.getTitle())); currentAlbum = currentAlbum.getParent(); } - backlinks.add(0, createLink("viewSone.html?sone=" + album.getSone().getId(), SoneAccessor.getNiceName(album.getSone()))); + backlinks.add(0, createLink("imageBrowser.html?sone=" + album.getSone().getId(), SoneAccessor.getNiceName(album.getSone()))); return backlinks; } return super.get(templateContext, object, member); @@ -68,7 +68,7 @@ public class AlbumAccessor extends ReflectionAccessor { * The name of the link * @return The created map containing the mappings */ - private Map createLink(String target, String name) { + private static Map createLink(String target, String name) { Map link = new HashMap(); link.put("target", target); link.put("name", name);