ChangeScreen2: Make Reply button configurable

There were several complaints on Google Groups and in the issue tracker
about the Reply… button in the New Change Screen. People new to
Gerrit/the New Change Screen didn't know where to click in order to
submit a review.

Add a setting in gerrit.config, where the administrator can customize
the label and tooltip of the Reply… button.

Bug: issue 2541
Bug: issue 2974
Change-Id: Ib9e95aa2f03debc88ea091c4d3fb91c83ad9d1ba
This commit is contained in:
Richard Möhn
2014-11-13 20:05:13 +01:00
parent 3e7054a4c7
commit e4abe9a93d
6 changed files with 60 additions and 2 deletions

View File

@@ -805,6 +805,21 @@ abbreviated commit SHA-1 (`c9c0edb`).
+
Default is "Submit patch set ${patchSet} into ${branch}".
[[change.replyLabel]]change.replyLabel::
+
Label name for the reply button. In the user interface an ellipsis (…)
is appended.
+
Default is "Reply". In the user interface it becomes "Reply…".
[[change.replyTooltip]]change.replyTooltip::
+
Tooltip for the reply button. In the user interface a note about the
keyboard shortcut is appended.
+
Default is "Reply and score". In the user interface it becomes "Reply
and score (Shortcut: a)".
[[changeMerge]]
=== Section changeMerge

View File

@@ -597,6 +597,9 @@ Clicking on the `Reply...` button opens a popup panel.
A text box allows to type a summary comment for the currently viewed
patch set.
Note that you can set the text and tooltip of the button in
link:config-gerrit.html#change.replyLabel[gerrit.config].
[[vote]]
If the current patch set is viewed, radio buttons are displayed for
each label on which the user is allowed to vote. Voting on non-current

View File

@@ -57,6 +57,8 @@ public class GerritConfig implements Cloneable {
protected List<String> archiveFormats;
protected int largeChangeSize;
protected boolean newFeatures;
protected String replyLabel;
protected String replyTitle;
public String getLoginUrl() {
return loginUrl;
@@ -308,4 +310,20 @@ public class GerritConfig implements Cloneable {
public void setNewFeatures(boolean n) {
newFeatures = n;
}
public String getReplyTitle() {
return replyTitle;
}
public void setReplyTitle(String r) {
replyTitle = r;
}
public String getReplyLabel() {
return replyLabel;
}
public void setReplyLabel(String r) {
replyLabel = r;
}
}

View File

@@ -87,6 +87,7 @@ import com.google.gwt.user.client.ui.ToggleButton;
import com.google.gwtexpui.globalkey.client.GlobalKey;
import com.google.gwtexpui.globalkey.client.KeyCommand;
import com.google.gwtexpui.globalkey.client.KeyCommandSet;
import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
import com.google.gwtorm.client.KeyUtil;
import java.sql.Timestamp;
@@ -266,6 +267,8 @@ public class ChangeScreen2 extends Screen {
reviewers.init(style, ccText);
hashtags.init(style);
initReplyButton();
keysNavigation = new KeyCommandSet(Gerrit.C.sectionNavigation());
keysNavigation.add(new KeyCommand(0, 'u', Util.C.upToChangeList()) {
@Override
@@ -330,6 +333,14 @@ public class ChangeScreen2 extends Screen {
}
}
private void initReplyButton() {
reply.setTitle(Gerrit.getConfig().getReplyTitle());
reply.setHTML(new SafeHtmlBuilder()
.openDiv()
.append(Gerrit.getConfig().getReplyLabel())
.closeDiv());
}
private void gotoSibling(final int offset) {
if (offset > 0 && changeInfo.current_revision().equals(revision)) {
return;

View File

@@ -356,9 +356,8 @@ limitations under the License.
<div class='{style.headerButtons} {style.infoLineHeaderButtons}'>
<g:Button ui:field='reply'
styleName=''
title='Reply and score (Shortcut: a)'>
title=''>
<ui:attribute name='title'/>
<div><ui:msg>Reply&#8230;</ui:msg></div>
</g:Button>
<c:QuickApprove ui:field='quickApprove'
styleName='{style.quickApprove}'

View File

@@ -15,6 +15,7 @@
package com.google.gerrit.httpd;
import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.gerrit.common.data.GerritConfig;
@@ -173,6 +174,17 @@ class GerritConfigProvider implements Provider<GerritConfig> {
config.setSshdAddress(sshInfo.getHostKeys().get(0).getHost());
}
String replyTitle =
Optional.fromNullable(cfg.getString("change", null, "replyTooltip"))
.or("Reply and score")
+ " (Shortcut: a)";
String replyLabel =
Optional.fromNullable(cfg.getString("change", null, "replyLabel"))
.or("Reply")
+ "\u2026";
config.setReplyTitle(replyTitle);
config.setReplyLabel(replyLabel);
return config;
}