From: David ‘Bombe’ Roden Date: Sat, 2 Apr 2011 09:08:21 +0000 (+0200) Subject: Put the name of the Sone in the front of the title. X-Git-Tag: 0.6^2~14 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=36b04bfd8452536ab43cf060c424f15332742da5 Put the name of the Sone in the front of the title. --- diff --git a/src/main/java/net/pterodactylus/sone/web/ViewSonePage.java b/src/main/java/net/pterodactylus/sone/web/ViewSonePage.java index cd79e43..758b93d 100644 --- a/src/main/java/net/pterodactylus/sone/web/ViewSonePage.java +++ b/src/main/java/net/pterodactylus/sone/web/ViewSonePage.java @@ -28,6 +28,7 @@ import java.util.Set; import net.pterodactylus.sone.data.Post; import net.pterodactylus.sone.data.Reply; import net.pterodactylus.sone.data.Sone; +import net.pterodactylus.sone.template.SoneAccessor; import net.pterodactylus.util.collection.Pagination; import net.pterodactylus.util.number.Numbers; import net.pterodactylus.util.template.Template; @@ -49,7 +50,7 @@ public class ViewSonePage extends SoneTemplatePage { * The Sone web interface */ public ViewSonePage(Template template, WebInterface webInterface) { - super("viewSone.html", template, "Page.ViewSone.Title", webInterface, false); + super("viewSone.html", template, webInterface, false); } // @@ -60,6 +61,20 @@ public class ViewSonePage extends SoneTemplatePage { * {@inheritDoc} */ @Override + protected String getPageTitle(Request request) { + String soneId = request.getHttpRequest().getParam("sone"); + Sone sone = webInterface.getCore().getSone(soneId, false); + if ((sone != null) && (sone.getTime() > 0)) { + String soneName = SoneAccessor.getNiceName(sone); + return soneName + " - " + webInterface.getL10n().getString("Page.ViewSone.Title"); + } + return webInterface.getL10n().getString("Page.ViewSone.Page.TitleWithoutSone"); + } + + /** + * {@inheritDoc} + */ + @Override protected void processTemplate(Request request, TemplateContext templateContext) throws RedirectException { super.processTemplate(request, templateContext); String soneId = request.getHttpRequest().getParam("sone");