diff options
author | James Moger <james.moger@gitblit.com> | 2013-12-09 17:12:02 -0500 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2013-12-30 16:53:58 -0500 |
commit | 81c90eed7323c31c7e1134e2fb21aa7819d55a30 (patch) | |
tree | 88b1a6d29177326f759a0c8308467b0ae94e2db7 | |
parent | 1ea553fd1495aa454ef970da2b13602fae3b0a4b (diff) | |
download | gitblit-81c90eed7323c31c7e1134e2fb21aa7819d55a30.tar.gz gitblit-81c90eed7323c31c7e1134e2fb21aa7819d55a30.zip |
Allow overriding the page title in a page subclass
Change-Id: I4bf65f771ab1ba0b0da6838fb07007520dd4b5e1
-rw-r--r-- | src/main/java/com/gitblit/wicket/pages/BasePage.java | 10 |
1 files 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);
|