From: James Moger Date: Mon, 29 Oct 2012 13:19:03 +0000 (-0400) Subject: Use repository swatch coloring in registrant permissions panel X-Git-Tag: v1.2.0~129 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8bc725871269aa47f8ef6db086a4cfedc75ef140;p=gitblit.git Use repository swatch coloring in registrant permissions panel --- 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 {