Submit: improve submit button label when having parents
Change-Id: I5f9952d6f0746e586c92df727dfcfbcaade308a8
This commit is contained in:
@@ -863,6 +863,13 @@ Label name for the submit button.
|
||||
+
|
||||
Default is "Submit".
|
||||
|
||||
[[change.submitLabelWithParents]]change.submitLabelWithParents::
|
||||
+
|
||||
Label name for the submit button if the change has parents which will
|
||||
be submitted together with this change.
|
||||
+
|
||||
Default is "Submit including parents".
|
||||
|
||||
[[change.submitTooltip]]change.submitTooltip::
|
||||
+
|
||||
Tooltip for the submit button. Variables available for replacement
|
||||
@@ -903,9 +910,12 @@ Defaults to "Submit whole topic"
|
||||
If `change.submitWholeTopic` is configuerd to true and a change has a
|
||||
topic, this configuration determines the tooltip for the submit button
|
||||
instead of `change.submitTooltip`. The variable `${topicSize}` is available
|
||||
for the number of changes to be submitted.
|
||||
for the number of changes in the same topic to be submitted. The number of
|
||||
all changes to be submitted is in the variable `${submitSize}`.
|
||||
+
|
||||
Defaults to "Submit all ${topicSize} changes within the topic".
|
||||
Defaults to "Submit all ${topicSize} changes of the same topic
|
||||
(${submitSize} changes including ancestors and other
|
||||
changes related by topic)".
|
||||
|
||||
[[change.replyLabel]]change.replyLabel::
|
||||
+
|
||||
|
@@ -154,7 +154,11 @@ public class ActionsIT extends AbstractDaemonTest {
|
||||
int nrChanges) {
|
||||
ActionInfo info = actions.get("submit");
|
||||
assertThat(info.enabled).isTrue();
|
||||
assertThat(info.label).isEqualTo("Submit");
|
||||
if (nrChanges == 1) {
|
||||
assertThat(info.label).isEqualTo("Submit");
|
||||
} else {
|
||||
assertThat(info.label).isEqualTo("Submit including parents");
|
||||
}
|
||||
assertThat(info.method).isEqualTo("POST");
|
||||
if (nrChanges == 1) {
|
||||
assertThat(info.title).isEqualTo("Submit patch set 1 into master");
|
||||
|
@@ -102,6 +102,7 @@ public class Submit implements RestModifyView<RevisionResource, SubmitInput>,
|
||||
private final AccountsCollection accounts;
|
||||
private final ChangesCollection changes;
|
||||
private final String label;
|
||||
private final String labelWithParents;
|
||||
private final ParameterizedString titlePattern;
|
||||
private final ParameterizedString titlePatternWithAncestors;
|
||||
private final String submitTopicLabel;
|
||||
@@ -133,6 +134,10 @@ public class Submit implements RestModifyView<RevisionResource, SubmitInput>,
|
||||
this.label = MoreObjects.firstNonNull(
|
||||
Strings.emptyToNull(cfg.getString("change", null, "submitLabel")),
|
||||
"Submit");
|
||||
this.labelWithParents = MoreObjects.firstNonNull(
|
||||
Strings.emptyToNull(
|
||||
cfg.getString("change", null, "submitLabelWithParents")),
|
||||
"Submit including parents");
|
||||
this.titlePattern = new ParameterizedString(MoreObjects.firstNonNull(
|
||||
cfg.getString("change", null, "submitTooltip"),
|
||||
DEFAULT_TOOLTIP));
|
||||
@@ -319,7 +324,9 @@ public class Submit implements RestModifyView<RevisionResource, SubmitInput>,
|
||||
resource.getUser());
|
||||
if (submitProblems != null) {
|
||||
return new UiAction.Description()
|
||||
.setLabel(treatWithTopic ? submitTopicLabel : label)
|
||||
.setLabel(treatWithTopic
|
||||
? submitTopicLabel : (cs.size() > 1)
|
||||
? labelWithParents : label)
|
||||
.setTitle(submitProblems)
|
||||
.setVisible(true)
|
||||
.setEnabled(false);
|
||||
@@ -345,7 +352,7 @@ public class Submit implements RestModifyView<RevisionResource, SubmitInput>,
|
||||
ParameterizedString tp = cs.size() > 1 ? titlePatternWithAncestors :
|
||||
titlePattern;
|
||||
return new UiAction.Description()
|
||||
.setLabel(label)
|
||||
.setLabel(cs.size() > 1 ? labelWithParents : label)
|
||||
.setTitle(Strings.emptyToNull(tp.replace(params)))
|
||||
.setVisible(true)
|
||||
.setEnabled(Boolean.TRUE.equals(enabled));
|
||||
|
Reference in New Issue
Block a user