X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FViewSonePage.java;h=758b93d222ea095a209e8fd3c1a27bea3515a78c;hb=36b04bfd8452536ab43cf060c424f15332742da5;hp=cd79e43dfad69cc25aa1c6b475db026561374a6a;hpb=453ff369775ad37fb63a8dc632c8ebe4fb2c69aa;p=Sone.git 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");