Merge "Add support for branch web links"

This commit is contained in:
Edwin Kempin
2014-09-11 09:27:40 +00:00
committed by Gerrit Code Review
9 changed files with 94 additions and 4 deletions

View File

@@ -20,6 +20,7 @@ import com.google.gerrit.client.ErrorDialog;
import com.google.gerrit.client.Gerrit;
import com.google.gerrit.client.GitwebLink;
import com.google.gerrit.client.VoidResult;
import com.google.gerrit.client.WebLinkInfo;
import com.google.gerrit.client.access.AccessMap;
import com.google.gerrit.client.access.ProjectAccessInfo;
import com.google.gerrit.client.actions.ActionButton;
@@ -396,6 +397,22 @@ public class ProjectBranchesScreen extends ProjectScreen {
actionsPanel.add(new Anchor(c.getLinkName(), false,
c.toBranch(new Branch.NameKey(getProjectKey(), k.ref()))));
}
if (k.web_links() != null) {
for (WebLinkInfo weblink : Natives.asList(k.web_links())) {
Anchor a = new Anchor();
a.setHref(weblink.url());
if (weblink.imageUrl() != null && !weblink.imageUrl().isEmpty()) {
Image img = new Image();
img.setAltText(weblink.name());
img.setUrl(weblink.imageUrl());
img.setTitle(weblink.name());
a.getElement().appendChild(img.getElement());
} else {
a.setText("(" + weblink.name() + ")");
}
actionsPanel.add(a);
}
}
if (k.actions() != null) {
k.actions().copyKeysIntoChildren("id");
for (ActionInfo a : Natives.asList(k.actions().values())) {