Allow the text of the "Report Bug" link to be configured

The title text shown on the link to the bug tracker can be configured
in the gerrit.config file.  If not set, it defaults to "Report Bug".

Bug: Issue 2318
Change-Id: I38c6057b96bf97fc96341621c9d8bbb49060dc40
This commit is contained in:
David Pursehouse 2013-12-10 15:36:29 +09:00
parent 6a5850e3d0
commit 753ca33878
4 changed files with 18 additions and 1 deletions

View File

@ -1378,6 +1378,12 @@ Gerrit service. By default this links to the upstream Gerrit
Code Review's own bug tracker but could be directed to the system
administrator's ticket queue.
[[gerrit.reportBugText]]gerrit.reportBugText::
+
Text to be displayed in the link to the bug report URL.
+
Defaults to "Report Bug".
[[gerrit.changeScreen]]gerrit.changeScreen::
+
Default change screen UI to direct users to. Valid values are

View File

@ -32,6 +32,7 @@ public class GerritConfig implements Cloneable {
protected String switchAccountUrl;
protected String httpPasswordUrl;
protected String reportBugUrl;
protected String reportBugText;
protected boolean gitBasicAuth;
protected GitwebConfig gitweb;
@ -103,6 +104,14 @@ public class GerritConfig implements Cloneable {
reportBugUrl = u;
}
public String getReportBugText() {
return reportBugText;
}
public void setReportBugText(String t) {
reportBugText = t;
}
public boolean isGitBasicAuth() {
return gitBasicAuth;
}

View File

@ -464,8 +464,9 @@ public class Gerrit implements EntryPoint {
btmmenu.add(new InlineLabel(" | "));
btmmenu.add(new InlineHTML(M.poweredBy(vs)));
final String reportBugText = getConfig().getReportBugText();
Anchor a = new Anchor(
C.reportBug(),
reportBugText == null ? C.reportBug() : reportBugText,
getConfig().getReportBugUrl());
a.setTarget("_blank");
a.setStyleName("");

View File

@ -132,6 +132,7 @@ class GerritConfigProvider implements Provider<GerritConfig> {
final String reportBugUrl = cfg.getString("gerrit", null, "reportBugUrl");
config.setReportBugUrl(reportBugUrl != null ?
reportBugUrl : "http://code.google.com/p/gerrit/issues/list");
config.setReportBugText(cfg.getString("gerrit", null, "reportBugText"));
config.setGitBasicAuth(authConfig.isGitBasicAuth());