ChangeScreen: Hide assignee link on edit
When editing the assignee an input box was shown below the current assignee. This gave the impression like another assignee is added (similar to how more reviewers can be added), but not that the current assignee is edited. Instead hide the assignee link when the assignee is edited and populate the input box with the current assignee. This is similar to how editing the topic works. The text with current assignee in the input box is selected so that it can be easily erased by typing a new assignee. Change-Id: I3d2533c018ddd4018199e68c0b7e5c3205f35856 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
package com.google.gerrit.client.change;
|
package com.google.gerrit.client.change;
|
||||||
|
|
||||||
|
import com.google.gerrit.client.FormatUtil;
|
||||||
import com.google.gerrit.client.NotSignedInDialog;
|
import com.google.gerrit.client.NotSignedInDialog;
|
||||||
import com.google.gerrit.client.changes.ChangeApi;
|
import com.google.gerrit.client.changes.ChangeApi;
|
||||||
import com.google.gerrit.client.changes.Util;
|
import com.google.gerrit.client.changes.Util;
|
||||||
@@ -50,20 +51,18 @@ public class Assignee extends Composite {
|
|||||||
|
|
||||||
private static final Binder uiBinder = GWT.create(Binder.class);
|
private static final Binder uiBinder = GWT.create(Binder.class);
|
||||||
|
|
||||||
@UiField
|
@UiField Element show;
|
||||||
InlineHyperlink assigneeLink;
|
@UiField InlineHyperlink assigneeLink;
|
||||||
@UiField
|
@UiField Image editAssigneeIcon;
|
||||||
Image editAssigneeIcon;
|
@UiField Element form;
|
||||||
@UiField
|
@UiField Element error;
|
||||||
Element form;
|
|
||||||
@UiField
|
|
||||||
Element error;
|
|
||||||
@UiField(provided = true)
|
@UiField(provided = true)
|
||||||
RemoteSuggestBox suggestBox;
|
RemoteSuggestBox suggestBox;
|
||||||
|
|
||||||
private AssigneeSuggestOracle assigneeSuggestOracle;
|
private AssigneeSuggestOracle assigneeSuggestOracle;
|
||||||
private Change.Id changeId;
|
private Change.Id changeId;
|
||||||
private boolean canEdit;
|
private boolean canEdit;
|
||||||
|
private AccountInfo currentAssignee;
|
||||||
|
|
||||||
Assignee() {
|
Assignee() {
|
||||||
assigneeSuggestOracle = new AssigneeSuggestOracle();
|
assigneeSuggestOracle = new AssigneeSuggestOracle();
|
||||||
@@ -98,18 +97,24 @@ public class Assignee extends Composite {
|
|||||||
setAssignee(info.assignee());
|
setAssignee(info.assignee());
|
||||||
assigneeSuggestOracle.setChange(changeId);
|
assigneeSuggestOracle.setChange(changeId);
|
||||||
editAssigneeIcon.setVisible(canEdit);
|
editAssigneeIcon.setVisible(canEdit);
|
||||||
|
if (!canEdit) {
|
||||||
|
show.setTitle(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void onOpenForm() {
|
void onOpenForm() {
|
||||||
UIObject.setVisible(form, true);
|
UIObject.setVisible(form, true);
|
||||||
|
UIObject.setVisible(show, false);
|
||||||
UIObject.setVisible(error, false);
|
UIObject.setVisible(error, false);
|
||||||
editAssigneeIcon.setVisible(false);
|
editAssigneeIcon.setVisible(false);
|
||||||
suggestBox.setFocus(true);
|
suggestBox.setFocus(true);
|
||||||
suggestBox.setText("");
|
suggestBox.setText(FormatUtil.nameEmail(currentAssignee));
|
||||||
|
suggestBox.selectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onCloseForm() {
|
void onCloseForm() {
|
||||||
UIObject.setVisible(form, false);
|
UIObject.setVisible(form, false);
|
||||||
|
UIObject.setVisible(show, true);
|
||||||
UIObject.setVisible(error, false);
|
UIObject.setVisible(error, false);
|
||||||
editAssigneeIcon.setVisible(true);
|
editAssigneeIcon.setVisible(true);
|
||||||
suggestBox.setFocus(false);
|
suggestBox.setFocus(false);
|
||||||
@@ -174,6 +179,7 @@ public class Assignee extends Composite {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setAssignee(AccountInfo assignee) {
|
private void setAssignee(AccountInfo assignee) {
|
||||||
|
currentAssignee = assignee;
|
||||||
assigneeLink.setText(assignee != null ? assignee.name() : null);
|
assigneeLink.setText(assignee != null ? assignee.name() : null);
|
||||||
assigneeLink.setTargetHistoryToken(assignee != null
|
assigneeLink.setTargetHistoryToken(assignee != null
|
||||||
? PageLinks.toAssigneeQuery(assignee.name() != null
|
? PageLinks.toAssigneeQuery(assignee.name() != null
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ limitations under the License.
|
|||||||
}
|
}
|
||||||
</ui:style>
|
</ui:style>
|
||||||
<g:HTMLPanel>
|
<g:HTMLPanel>
|
||||||
<div>
|
<div ui:field='show'>
|
||||||
<u:InlineHyperlink ui:field='assigneeLink'
|
<u:InlineHyperlink ui:field='assigneeLink'
|
||||||
title='Search for changes assigned to this user'/>
|
title='Search for changes assigned to this user'/>
|
||||||
<g:Image ui:field='editAssigneeIcon'
|
<g:Image ui:field='editAssigneeIcon'
|
||||||
|
|||||||
@@ -134,4 +134,8 @@ public class RemoteSuggestBox extends Composite implements Focusable, HasText,
|
|||||||
public HandlerRegistration addCloseHandler(CloseHandler<RemoteSuggestBox> h) {
|
public HandlerRegistration addCloseHandler(CloseHandler<RemoteSuggestBox> h) {
|
||||||
return addHandler(h, CloseEvent.getType());
|
return addHandler(h, CloseEvent.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void selectAll() {
|
||||||
|
suggestBox.getValueBox().selectAll();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user