From 169d70758376ceff8d9161aa8447951f9d206c28 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 19 Apr 2012 16:01:25 +0200 Subject: [PATCH] Get tracks directly from artist. --- .../java/net/pterodactylus/demoscenemusic/page/ArtistPage.java | 9 +-------- src/main/resources/templates/artist | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/main/java/net/pterodactylus/demoscenemusic/page/ArtistPage.java b/src/main/java/net/pterodactylus/demoscenemusic/page/ArtistPage.java index e92726f..45ef5c9 100644 --- a/src/main/java/net/pterodactylus/demoscenemusic/page/ArtistPage.java +++ b/src/main/java/net/pterodactylus/demoscenemusic/page/ArtistPage.java @@ -17,11 +17,8 @@ package net.pterodactylus.demoscenemusic.page; -import java.util.Collection; - import net.pterodactylus.demoscenemusic.core.Core; import net.pterodactylus.demoscenemusic.data.Artist; -import net.pterodactylus.demoscenemusic.data.Track; import net.pterodactylus.util.database.DatabaseException; import net.pterodactylus.util.template.Template; import net.pterodactylus.util.template.TemplateContext; @@ -56,11 +53,7 @@ public class ArtistPage extends BasePage { protected void processTemplate(TemplateContext templateContext, ServletRequest request) throws RedirectException { try { Artist artist = getCore().getDataManager().getArtistById(request.getServletRequest().getParameter("id")); - if (artist != null) { - Collection tracks = getCore().getDataManager().getTracksByArtist(artist.id()); - templateContext.set("artist", artist); - templateContext.set("tracks", tracks); - } + templateContext.set("artist", artist); } catch (DatabaseException de1) { /* TODO */ } diff --git a/src/main/resources/templates/artist b/src/main/resources/templates/artist index 655c4d8..9429468 100644 --- a/src/main/resources/templates/artist +++ b/src/main/resources/templates/artist @@ -8,7 +8,7 @@

Tracks by <% artist.name|html>

-<%foreach tracks track|sort> +<%foreach artist.tracks track|sort> <%first><%/last> -- 2.7.4