ChangeScreen: Add icon for adding reviewer

Replace 'Add' button with an icon. This is consistent with editing the
topic which is also done by clicking on an icon.

The user_add icon is taken from the silk icons [1].

[1] http://famfamfam.com/lab/icons/silk/

Change-Id: I5af8bb2814437bf77c0eaafc5c9dd131f802e6d4
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2015-12-23 15:47:18 +01:00
parent 89773d89f9
commit 0b839f3615
4 changed files with 23 additions and 35 deletions

View File

@@ -24,6 +24,9 @@ public interface Resources extends ClientBundle {
@Source("note_add.png") @Source("note_add.png")
ImageResource addFileComment(); ImageResource addFileComment();
@Source("user_add.png")
ImageResource addUser();
// derived from resultset_next.png // derived from resultset_next.png
@Source("resultset_down_gray.png") @Source("resultset_down_gray.png")
ImageResource arrowDown(); ImageResource arrowDown();

Binary file not shown.

After

Width:  |  Height:  |  Size: 746 B

View File

@@ -35,6 +35,7 @@ import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArray; import com.google.gwt.core.client.JsArray;
import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Element;
import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.logical.shared.CloseEvent; import com.google.gwt.event.logical.shared.CloseEvent;
import com.google.gwt.event.logical.shared.CloseHandler; import com.google.gwt.event.logical.shared.CloseHandler;
import com.google.gwt.event.logical.shared.SelectionEvent; import com.google.gwt.event.logical.shared.SelectionEvent;
@@ -46,6 +47,7 @@ import com.google.gwt.user.client.rpc.StatusCodeException;
import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel; import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.UIObject; import com.google.gwt.user.client.ui.UIObject;
import com.google.gwtexpui.safehtml.client.SafeHtml; import com.google.gwtexpui.safehtml.client.SafeHtml;
import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder; import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
@@ -60,7 +62,7 @@ public class Reviewers extends Composite {
private static final Binder uiBinder = GWT.create(Binder.class); private static final Binder uiBinder = GWT.create(Binder.class);
@UiField Element reviewersText; @UiField Element reviewersText;
@UiField Button openForm; @UiField Image addReviewerIcon;
@UiField Button addMe; @UiField Button addMe;
@UiField Element form; @UiField Element form;
@UiField Element error; @UiField Element error;
@@ -92,6 +94,14 @@ public class Reviewers extends Composite {
}); });
initWidget(uiBinder.createAndBindUi(this)); initWidget(uiBinder.createAndBindUi(this));
addReviewerIcon.addDomHandler(
new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
onOpenForm();
}
},
ClickEvent.getType());
} }
void init(ChangeScreen.Style style, Element ccText) { void init(ChangeScreen.Style style, Element ccText) {
@@ -103,18 +113,13 @@ public class Reviewers extends Composite {
this.changeId = info.legacyId(); this.changeId = info.legacyId();
display(info); display(info);
reviewerSuggestOracle.setChange(changeId); reviewerSuggestOracle.setChange(changeId);
openForm.setVisible(Gerrit.isSignedIn()); addReviewerIcon.setVisible(Gerrit.isSignedIn());
}
@UiHandler("openForm")
void onOpenForm(@SuppressWarnings("unused") ClickEvent e) {
onOpenForm();
} }
void onOpenForm() { void onOpenForm() {
UIObject.setVisible(form, true); UIObject.setVisible(form, true);
UIObject.setVisible(error, false); UIObject.setVisible(error, false);
openForm.setVisible(false); addReviewerIcon.setVisible(false);
suggestBox.setFocus(true); suggestBox.setFocus(true);
} }
@@ -131,7 +136,7 @@ public class Reviewers extends Composite {
@UiHandler("cancel") @UiHandler("cancel")
void onCancel(@SuppressWarnings("unused") ClickEvent e) { void onCancel(@SuppressWarnings("unused") ClickEvent e) {
openForm.setVisible(true); addReviewerIcon.setVisible(true);
UIObject.setVisible(form, false); UIObject.setVisible(form, false);
suggestBox.setFocus(false); suggestBox.setFocus(false);
} }

View File

@@ -19,26 +19,9 @@ limitations under the License.
xmlns:c='urn:import:com.google.gwtexpui.globalkey.client' xmlns:c='urn:import:com.google.gwtexpui.globalkey.client'
xmlns:g='urn:import:com.google.gwt.user.client.ui' xmlns:g='urn:import:com.google.gwt.user.client.ui'
xmlns:u='urn:import:com.google.gerrit.client.ui'> xmlns:u='urn:import:com.google.gerrit.client.ui'>
<ui:with field='ico' type='com.google.gerrit.client.GerritResources'/>
<ui:with field='res' type='com.google.gerrit.client.change.Resources'/> <ui:with field='res' type='com.google.gerrit.client.change.Resources'/>
<ui:style gss='false'> <ui:style gss='false'>
button.openAdd {
margin: 3px 3px 0 0;
float: right;
color: rgba(0, 0, 0, 0.15);
background-color: #f5f5f5;
background-image: none;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
button.openAdd div {
width: auto;
color: #444;
}
.suggestBox { .suggestBox {
margin-bottom: 2px; margin-bottom: 2px;
} }
@@ -48,6 +31,7 @@ limitations under the License.
font-weight: bold; font-weight: bold;
} }
.addReviewer,
.cancel { .cancel {
float: right; float: right;
} }
@@ -55,14 +39,10 @@ limitations under the License.
<g:HTMLPanel> <g:HTMLPanel>
<div> <div>
<span ui:field='reviewersText'/> <span ui:field='reviewersText'/>
<g:Button ui:field='openForm' <g:Image ui:field='addReviewerIcon'
title='Add reviewers to this change' resource='{ico.addUser}'
styleName='{res.style.button}' styleName='{style.addReviewer}'
addStyleNames='{style.openAdd}' title='Add Reviewer'/>
visible='false'>
<ui:attribute name='title'/>
<div><ui:msg>Add&#8230;</ui:msg></div>
</g:Button>
</div> </div>
<div ui:field='form' style='display: none' aria-hidden='true'> <div ui:field='form' style='display: none' aria-hidden='true'>
<u:RemoteSuggestBox ui:field='suggestBox' styleName='{style.suggestBox}'/> <u:RemoteSuggestBox ui:field='suggestBox' styleName='{style.suggestBox}'/>