]> source.dussan.org Git - gitblit.git/commitdiff
Use repository swatch coloring in registrant permissions panel
authorJames Moger <james.moger@gitblit.com>
Mon, 29 Oct 2012 13:19:03 +0000 (09:19 -0400)
committerJames Moger <james.moger@gitblit.com>
Mon, 29 Oct 2012 13:19:03 +0000 (09:19 -0400)
src/com/gitblit/wicket/panels/RegistrantPermissionsPanel.html
src/com/gitblit/wicket/panels/RegistrantPermissionsPanel.java

index c23094811e12905b1f02b3eece8d818ebf2d54ce..4c8c4efd8efbf97fa98aee31a5c27591b85e9f93 100644 (file)
@@ -9,7 +9,7 @@
 \r
        <div wicket:id="permissionRow">\r
                <div style="padding-top:10px;border-left:1px solid #ccc;border-right:1px solid #ccc;" class="row-fluid">\r
-                       <div style="padding-top:5px;padding-left:5px;" class="span6" wicket:id="registrant"></div><div style="padding-top:5px;padding-right:5px;text-align:right;" class="span2"><span class="label label-info" wicket:id="regex">[regex]</span></div> <select class="input-medium" wicket:id="permission"></select>\r
+                       <div style="padding-top:5px;padding-left:5px;" class="span6"><span wicket:id="registrant"></span></div><div style="padding-top:5px;padding-right:5px;text-align:right;" class="span2"><span class="label label-info" wicket:id="regex">[regex]</span></div> <select class="input-medium" wicket:id="permission"></select>\r
                </div>\r
        </div>\r
 \r
index 9dee2f2674b81cd8de19c89783924e2536d7d45d..b6ed890f1d48194f141f31e7793312b8fbfd755a 100644 (file)
@@ -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<RegistrantAccessPermission> 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 {