From 8bc725871269aa47f8ef6db086a4cfedc75ef140 Mon Sep 17 00:00:00 2001 From: James Moger Date: Mon, 29 Oct 2012 09:19:03 -0400 Subject: [PATCH] Use repository swatch coloring in registrant permissions panel --- .../wicket/panels/RegistrantPermissionsPanel.html | 2 +- .../wicket/panels/RegistrantPermissionsPanel.java | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/com/gitblit/wicket/panels/RegistrantPermissionsPanel.html b/src/com/gitblit/wicket/panels/RegistrantPermissionsPanel.html index c2309481..4c8c4efd 100644 --- a/src/com/gitblit/wicket/panels/RegistrantPermissionsPanel.html +++ b/src/com/gitblit/wicket/panels/RegistrantPermissionsPanel.html @@ -9,7 +9,7 @@
-
[regex]
+
[regex]
diff --git a/src/com/gitblit/wicket/panels/RegistrantPermissionsPanel.java b/src/com/gitblit/wicket/panels/RegistrantPermissionsPanel.java index 9dee2f26..b6ed890f 100644 --- a/src/com/gitblit/wicket/panels/RegistrantPermissionsPanel.java +++ b/src/com/gitblit/wicket/panels/RegistrantPermissionsPanel.java @@ -36,8 +36,10 @@ import org.apache.wicket.model.CompoundPropertyModel; import org.apache.wicket.model.IModel; import com.gitblit.Constants.AccessPermission; +import com.gitblit.Constants.RegistrantType; import com.gitblit.models.RegistrantAccessPermission; import com.gitblit.utils.DeepCopier; +import com.gitblit.utils.StringUtils; import com.gitblit.wicket.WicketUtils; /** @@ -78,7 +80,16 @@ public class RegistrantPermissionsPanel extends BasePanel { public void populateItem(final Item item) { final RegistrantAccessPermission entry = item.getModelObject(); - item.add(new Label("registrant", entry.registrant)); + if (RegistrantType.REPOSITORY.equals(entry.type)) { + // repository, strip .git and show swatch + String repoName = StringUtils.stripDotGit(entry.registrant); + Label registrant = new Label("registrant", repoName); + WicketUtils.setCssClass(registrant, "repositorySwatch"); + WicketUtils.setCssBackground(registrant, repoName); + item.add(registrant); + } else { + item.add(new Label("registrant", entry.registrant)); + } if (entry.isExplicit) { item.add(new Label("regex", "").setVisible(false)); } else { -- 2.39.5