Merge "Use download icon instead of text"
This commit is contained in:
@@ -39,4 +39,7 @@ public interface GerritResources extends ClientBundle {
|
||||
|
||||
@Source("redNot.png")
|
||||
public ImageResource redNot();
|
||||
|
||||
@Source("downloadIcon.png")
|
||||
public ImageResource downloadIcon();
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 911 B |
@@ -45,7 +45,7 @@ nextFileHelp = Next file
|
||||
|
||||
reviewedAnd = Reviewed &
|
||||
next = next
|
||||
download = (Download)
|
||||
download = Download
|
||||
|
||||
fileTypeSymlink = Type: Symbolic Link
|
||||
fileTypeGitlink = Type: Git Commit in Subproject
|
||||
|
||||
@@ -21,16 +21,18 @@ import com.google.gerrit.common.data.PatchSetDetail;
|
||||
import com.google.gerrit.reviewdb.client.Patch;
|
||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.SpanElement;
|
||||
import com.google.gwt.dom.client.DivElement;
|
||||
import com.google.gwt.dom.client.Style.Display;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.resources.client.CssResource;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.DOM;
|
||||
import com.google.gwt.user.client.ui.Anchor;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.google.gwtorm.client.KeyUtil;
|
||||
|
||||
import java.util.LinkedList;
|
||||
@@ -46,6 +48,8 @@ public class PatchSetSelectBox extends Composite {
|
||||
String selected();
|
||||
|
||||
String hidden();
|
||||
|
||||
String downloadLink();
|
||||
}
|
||||
|
||||
public enum Side {
|
||||
@@ -68,7 +72,7 @@ public class PatchSetSelectBox extends Composite {
|
||||
BoxStyle style;
|
||||
|
||||
@UiField
|
||||
SpanElement sideMarker;
|
||||
DivElement sideMarker;
|
||||
|
||||
public PatchSetSelectBox(Side side, final PatchScreen.Type type) {
|
||||
this.side = side;
|
||||
@@ -88,12 +92,20 @@ public class PatchSetSelectBox extends Composite {
|
||||
|
||||
if (screenType == PatchScreen.Type.UNIFIED) {
|
||||
sideMarker.setInnerText((side == Side.A) ? "(-)" : "(+)");
|
||||
} else {
|
||||
sideMarker.getStyle().setDisplay(Display.NONE);
|
||||
}
|
||||
|
||||
Anchor baseLink = null;
|
||||
if (detail.getInfo().getParents().size() > 1) {
|
||||
addLink(PatchUtil.C.patchBaseAutoMerge(), null);
|
||||
baseLink = createLink(PatchUtil.C.patchBaseAutoMerge(), null);
|
||||
} else {
|
||||
addLink(PatchUtil.C.patchBase(), null);
|
||||
baseLink = createLink(PatchUtil.C.patchBase(), null);
|
||||
}
|
||||
|
||||
links.add(baseLink);
|
||||
if (screenType == PatchScreen.Type.UNIFIED || side == Side.A) {
|
||||
linkPanel.add(baseLink);
|
||||
}
|
||||
|
||||
if (side == Side.B) {
|
||||
@@ -102,7 +114,9 @@ public class PatchSetSelectBox extends Composite {
|
||||
|
||||
for (Patch patch : script.getHistory()) {
|
||||
PatchSet.Id psId = patch.getKey().getParentKey();
|
||||
addLink(Integer.toString(psId.get()), psId);
|
||||
Anchor anchor = createLink(Integer.toString(psId.get()), psId);
|
||||
links.add(anchor);
|
||||
linkPanel.add(anchor);
|
||||
}
|
||||
|
||||
if (idActive == null && side == Side.A) {
|
||||
@@ -111,14 +125,13 @@ public class PatchSetSelectBox extends Composite {
|
||||
links.get(idActive.get()).setStyleName(style.selected());
|
||||
}
|
||||
|
||||
Anchor downloadLink = getDownloadLink();
|
||||
Anchor downloadLink = createDownloadLink();
|
||||
if (downloadLink != null) {
|
||||
linkPanel.add(new Label(" - "));
|
||||
linkPanel.add(downloadLink);
|
||||
}
|
||||
}
|
||||
|
||||
private void addLink(String label, final PatchSet.Id id) {
|
||||
private Anchor createLink(String label, final PatchSet.Id id) {
|
||||
final Anchor anchor = new Anchor(label);
|
||||
anchor.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
@@ -143,11 +156,10 @@ public class PatchSetSelectBox extends Composite {
|
||||
|
||||
});
|
||||
|
||||
links.add(anchor);
|
||||
linkPanel.add(anchor);
|
||||
return anchor;
|
||||
}
|
||||
|
||||
private Anchor getDownloadLink() {
|
||||
private Anchor createDownloadLink() {
|
||||
boolean isCommitMessage = Patch.COMMIT_MSG.equals(script.getNewName());
|
||||
|
||||
if (isCommitMessage || (side == Side.A && 0 >= script.getA().size())
|
||||
@@ -161,8 +173,14 @@ public class PatchSetSelectBox extends Composite {
|
||||
String sideURL = (side == Side.A) ? "1" : "0";
|
||||
final String base = GWT.getHostPageBaseURL() + "cat/";
|
||||
|
||||
final Anchor anchor = new Anchor(PatchUtil.C.download());
|
||||
Image image = new Image(Gerrit.RESOURCES.downloadIcon());
|
||||
|
||||
final Anchor anchor = new Anchor();
|
||||
anchor.setHref(base + KeyUtil.encode(key.toString()) + "^" + sideURL);
|
||||
anchor.setTitle(PatchUtil.C.download());
|
||||
anchor.setStyleName(style.downloadLink());
|
||||
DOM.insertBefore(anchor.getElement(), image.getElement(),
|
||||
DOM.getFirstChild(anchor.getElement()));
|
||||
|
||||
return anchor;
|
||||
}
|
||||
|
||||
@@ -28,18 +28,21 @@ limitations under the License.
|
||||
|
||||
.wrapper {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
font-size: 0; /* inline-block spacing fix */
|
||||
}
|
||||
|
||||
.patchSetLabel {
|
||||
font-weight: bold;
|
||||
.linkPanel {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.linkPanel > div {
|
||||
display: inline-block;
|
||||
padding: 3px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.linkPanel {
|
||||
overflow: hidden; /* div clear fix */
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
@@ -47,6 +50,27 @@ limitations under the License.
|
||||
padding: 3px;
|
||||
display: inline-block;
|
||||
text-decoration: none;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.patchSetLabel {
|
||||
font-weight: bold;
|
||||
float: left;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
.sideMarker {
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
.downloadLink {
|
||||
float: left;
|
||||
padding: 1px !important;
|
||||
margin-left: 3px;
|
||||
}
|
||||
|
||||
.downloadLink > a {
|
||||
text-size: 0;
|
||||
}
|
||||
|
||||
.selected {
|
||||
@@ -56,6 +80,7 @@ limitations under the License.
|
||||
|
||||
.sideMarker {
|
||||
font-family: monospace;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
@@ -64,7 +89,10 @@ limitations under the License.
|
||||
</ui:style>
|
||||
|
||||
<g:HTMLPanel styleName='wrapper'>
|
||||
<g:HTMLPanel styleName='{style.linkPanel}' ui:field='linkPanel'><span class='{style.patchSetLabel}'><ui:text from="{cons.patchSet}" /></span> <span class='{style.sideMarker}' ui:field='sideMarker'></span>: </g:HTMLPanel>
|
||||
<g:HTMLPanel styleName='{style.linkPanel}' ui:field='linkPanel'>
|
||||
<div class='{style.patchSetLabel}'><ui:text from="{cons.patchSet}" /></div>
|
||||
<div class='{style.sideMarker}' ui:field='sideMarker'></div>
|
||||
</g:HTMLPanel>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ limitations under the License.
|
||||
width: 100%;
|
||||
background-color: trimColor;
|
||||
overflow: hidden;
|
||||
font-size: 0; /* inline-block spacing fix */
|
||||
}
|
||||
|
||||
.wrapper .box {
|
||||
|
||||
@@ -24,6 +24,7 @@ limitations under the License.
|
||||
.wrapper {
|
||||
width: 100%;
|
||||
background-color: trimColor;
|
||||
font-size: 0; /* inline-block spacing fix */
|
||||
}
|
||||
|
||||
.wrapper .box {
|
||||
|
||||
Reference in New Issue
Block a user