From 81c90eed7323c31c7e1134e2fb21aa7819d55a30 Mon Sep 17 00:00:00 2001 From: James Moger Date: Mon, 9 Dec 2013 17:12:02 -0500 Subject: [PATCH] Allow overriding the page title in a page subclass Change-Id: I4bf65f771ab1ba0b0da6838fb07007520dd4b5e1 --- src/main/java/com/gitblit/wicket/pages/BasePage.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gitblit/wicket/pages/BasePage.java b/src/main/java/com/gitblit/wicket/pages/BasePage.java index ec84df65..24ffd813 100644 --- a/src/main/java/com/gitblit/wicket/pages/BasePage.java +++ b/src/main/java/com/gitblit/wicket/pages/BasePage.java @@ -205,16 +205,20 @@ public abstract class BasePage extends SessionPage { response.setDateHeader("Expires", System.currentTimeMillis() + Duration.minutes(expires).getMilliseconds()); } - protected void setupPage(String repositoryName, String pageName) { + protected String getPageTitle(String repositoryName) { String siteName = app().settings().getString(Keys.web.siteName, Constants.NAME); if (StringUtils.isEmpty(siteName)) { siteName = Constants.NAME; } if (repositoryName != null && repositoryName.trim().length() > 0) { - add(new Label("title", repositoryName + " - " + siteName)); + return repositoryName + " - " + siteName; } else { - add(new Label("title", siteName)); + return siteName; } + } + + protected void setupPage(String repositoryName, String pageName) { + add(new Label("title", getPageTitle(repositoryName))); String rootLinkUrl = app().settings().getString(Keys.web.rootLink, urlFor(GitBlitWebApp.get().getHomePage(), null).toString()); ExternalLink rootLink = new ExternalLink("rootLink", rootLinkUrl); -- 2.39.5