Add support for branch web links

Change-Id: I1a56aa26c74a1bd6ac26aa6bc8c93adeac829e87
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2014-09-10 18:23:29 +02:00
parent cae1df3c59
commit 0f697bdbec
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())) {