From 1c221573789f0673995cfec03e05af936a4ff3b3 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Fri, 03 Feb 2012 23:32:41 -0500
Subject: [PATCH] Show a ! in the swatch of a repository with a working copy (issue 49)

---
 docs/04_releases.mkd                                 |    2 ++
 resources/bootstrap.gb.css                           |    6 ++++--
 src/com/gitblit/wicket/panels/RepositoriesPanel.java |   10 ++++++++--
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/docs/04_releases.mkd b/docs/04_releases.mkd
index 1cd966e..3276976 100644
--- a/docs/04_releases.mkd
+++ b/docs/04_releases.mkd
@@ -11,6 +11,8 @@
 
 #### additions
 
+- On the Repositories page show a bang *!* character in the color swatch of a repository with a working copy (issue 49)  
+Push requests to these repositories will be rejected.
 - New setting to prevent display/serving non-bare repositories  
     **New:** *git.onlyAccessBareRepositories = false*
 - Allow relinking HEAD to a branch or a tag (Github/plm)
diff --git a/resources/bootstrap.gb.css b/resources/bootstrap.gb.css
index 7df3743..7ff8fa8 100644
--- a/resources/bootstrap.gb.css
+++ b/resources/bootstrap.gb.css
@@ -219,9 +219,11 @@
 }
 
 span.repositorySwatch {
-	border-radius: 3px;
-	padding: 2px 5px;	
+	border-radius: 3px;	
+	padding: 1px 4px 2px 4px;	
 	color: #ffffff;
+	font-weight: bold;
+	vertical-align: center;
 }
 span.repositorySwatch a {
 	color: inherit;
diff --git a/src/com/gitblit/wicket/panels/RepositoriesPanel.java b/src/com/gitblit/wicket/panels/RepositoriesPanel.java
index 4007a97..4dcdab4 100644
--- a/src/com/gitblit/wicket/panels/RepositoriesPanel.java
+++ b/src/com/gitblit/wicket/panels/RepositoriesPanel.java
@@ -148,9 +148,15 @@
 				if (!StringUtils.isEmpty(currGroupName) && (repoName.indexOf('/') > -1)) {
 					repoName = repoName.substring(currGroupName.length() + 1);
 				}
-				
+								
 				// repository swatch
-				Component swatch = new Label("repositorySwatch", "&nbsp;").setEscapeModelStrings(false);
+				Component swatch;
+				if (entry.isBare){
+					swatch = new Label("repositorySwatch", "&nbsp;").setEscapeModelStrings(false);
+				} else {
+					swatch = new Label("repositorySwatch", "!");
+					WicketUtils.setHtmlTooltip(swatch, "This repository has a working copy and can not receive pushes");
+				}
 				WicketUtils.setCssBackground(swatch, entry.toString());
 				row.add(swatch);
 				swatch.setVisible(showSwatch);

--
Gitblit v1.9.1