summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/wicket/WicketUtils.java
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2013-05-09 22:43:57 -0400
committerJames Moger <james.moger@gitblit.com>2013-05-09 22:43:57 -0400
commit828add77e71a567be98490403bb92d6f1afb9930 (patch)
treef6211abf4a8ce9eb19ab56d7cf2f75b65afac5ea /src/main/java/com/gitblit/wicket/WicketUtils.java
parent0b086146ffd70574b1069056e35bb11a1d782407 (diff)
downloadgitblit-828add77e71a567be98490403bb92d6f1afb9930.tar.gz
gitblit-828add77e71a567be98490403bb92d6f1afb9930.zip
Implemented application menus for repository url panel
Diffstat (limited to 'src/main/java/com/gitblit/wicket/WicketUtils.java')
-rw-r--r--src/main/java/com/gitblit/wicket/WicketUtils.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/main/java/com/gitblit/wicket/WicketUtils.java b/src/main/java/com/gitblit/wicket/WicketUtils.java
index 6e03032e..2170d0b7 100644
--- a/src/main/java/com/gitblit/wicket/WicketUtils.java
+++ b/src/main/java/com/gitblit/wicket/WicketUtils.java
@@ -41,6 +41,7 @@ import org.wicketstuff.googlecharts.AbstractChartData;
import org.wicketstuff.googlecharts.IChartData;
import com.gitblit.Constants;
+import com.gitblit.Constants.AccessPermission;
import com.gitblit.Constants.FederationPullStatus;
import com.gitblit.GitBlit;
import com.gitblit.Keys;
@@ -107,6 +108,29 @@ public class WicketUtils {
setCssClass(container, css);
}
}
+
+ public static void setPermissionClass(Component container, AccessPermission permission) {
+ if (permission == null) {
+ setCssClass(container, "badge");
+ return;
+ }
+ switch (permission) {
+ case REWIND:
+ case DELETE:
+ case CREATE:
+ setCssClass(container, "badge badge-success");
+ break;
+ case PUSH:
+ setCssClass(container, "badge badge-info");
+ break;
+ case CLONE:
+ setCssClass(container, "badge badge-inverse");
+ break;
+ default:
+ setCssClass(container, "badge");
+ break;
+ }
+ }
public static void setAlternatingBackground(Component c, int i) {
String clazz = i % 2 == 0 ? "light" : "dark";