From ccab3a2abf1f4c3b61e6955afa50b03efdcc707c Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Sat, 04 Feb 2012 00:28:37 -0500
Subject: [PATCH] Indicate WORKING COPY on repository pages (issue 49)

---
 src/com/gitblit/wicket/GitBlitWebApp.properties      |    4 +++-
 docs/04_releases.mkd                                 |    1 +
 src/com/gitblit/wicket/pages/RepositoryPage.html     |    3 +++
 src/com/gitblit/wicket/panels/RepositoriesPanel.java |    2 +-
 src/com/gitblit/wicket/pages/RepositoryPage.java     |    7 +++++++
 5 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/docs/04_releases.mkd b/docs/04_releases.mkd
index 3276976..e1dcb40 100644
--- a/docs/04_releases.mkd
+++ b/docs/04_releases.mkd
@@ -13,6 +13,7 @@
 
 - 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.
+- On all non-bare Repository pages show *WORKING COPY* in the upper right corner (issue 49)
 - 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/src/com/gitblit/wicket/GitBlitWebApp.properties b/src/com/gitblit/wicket/GitBlitWebApp.properties
index 1a8513a..b5cd515 100644
--- a/src/com/gitblit/wicket/GitBlitWebApp.properties
+++ b/src/com/gitblit/wicket/GitBlitWebApp.properties
@@ -210,4 +210,6 @@
 gb.federationRepositoryDescription = share this repository with other Gitblit servers
 gb.hookScriptsDescription = run Groovy scripts on pushes to this Gitblit server
 gb.reset = reset
-gb.pages = pages
\ No newline at end of file
+gb.pages = pages
+gb.workingCopy = WORKING COPY
+gb.workingCopyWarning = this repository has a working copy and can not receive pushes
\ No newline at end of file
diff --git a/src/com/gitblit/wicket/pages/RepositoryPage.html b/src/com/gitblit/wicket/pages/RepositoryPage.html
index c60275a..d69c7f9 100644
--- a/src/com/gitblit/wicket/pages/RepositoryPage.html
+++ b/src/com/gitblit/wicket/pages/RepositoryPage.html
@@ -37,6 +37,9 @@
 	
 		<!-- page header -->
 		<div class="page-header">
+			<div style="float:right;padding-top:5px;">
+				<span class="label important" wicket:id="workingCopy">[working copy]</span>
+			</div>
 			<h2><span wicket:id="repositoryName">[repository name]</span> <small><span wicket:id="pageName">[page name]</span></small></h2>
 		</div>
 	
diff --git a/src/com/gitblit/wicket/pages/RepositoryPage.java b/src/com/gitblit/wicket/pages/RepositoryPage.java
index 5f54401..77918ea 100644
--- a/src/com/gitblit/wicket/pages/RepositoryPage.java
+++ b/src/com/gitblit/wicket/pages/RepositoryPage.java
@@ -153,6 +153,13 @@
 		add(new LinkPanel("repositoryName", null, StringUtils.stripDotGit(repositoryName),
 				SummaryPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
 		add(new Label("pageName", pageName));
+		if (getRepositoryModel().isBare) {
+			add(new Label("workingCopy").setVisible(false));
+		} else {
+			Label lbl = new Label("workingCopy", getString("gb.workingCopy"));
+			WicketUtils.setHtmlTooltip(lbl,  getString("gb.workingCopyWarning"));
+			add(lbl);
+		}
 
 		super.setupPage(repositoryName, pageName);
 	}
diff --git a/src/com/gitblit/wicket/panels/RepositoriesPanel.java b/src/com/gitblit/wicket/panels/RepositoriesPanel.java
index 4dcdab4..ee6e119 100644
--- a/src/com/gitblit/wicket/panels/RepositoriesPanel.java
+++ b/src/com/gitblit/wicket/panels/RepositoriesPanel.java
@@ -155,7 +155,7 @@
 					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.setHtmlTooltip(swatch, getString("gb.workingCopyWarning"));
 				}
 				WicketUtils.setCssBackground(swatch, entry.toString());
 				row.add(swatch);

--
Gitblit v1.9.1