From fabe060d3a435f116128851f828e35c2af5fde67 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Mon, 10 Sep 2012 16:26:27 -0400
Subject: [PATCH] Strip folder name and .git from repo links in the project view

---
 src/com/gitblit/wicket/pages/BranchesPage.java |   74 +++++++++----------------------------
 1 files changed, 18 insertions(+), 56 deletions(-)

diff --git a/src/com/gitblit/wicket/pages/BranchesPage.java b/src/com/gitblit/wicket/pages/BranchesPage.java
index 30fac1a..2b7d518 100644
--- a/src/com/gitblit/wicket/pages/BranchesPage.java
+++ b/src/com/gitblit/wicket/pages/BranchesPage.java
@@ -1,70 +1,32 @@
+/*
+ * Copyright 2011 gitblit.com.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package com.gitblit.wicket.pages;
 
-import java.util.ArrayList;
-import java.util.List;
-
 import org.apache.wicket.PageParameters;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.repeater.Item;
-import org.apache.wicket.markup.repeater.data.DataView;
-import org.apache.wicket.markup.repeater.data.ListDataProvider;
-import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.lib.Repository;
 
-import com.gitblit.utils.JGitUtils;
-import com.gitblit.utils.Utils;
-import com.gitblit.wicket.LinkPanel;
-import com.gitblit.wicket.RepositoryPage;
-import com.gitblit.wicket.WicketUtils;
-import com.gitblit.wicket.models.RefModel;
-import com.gitblit.wicket.panels.BranchLinksPanel;
-
+import com.gitblit.wicket.panels.BranchesPanel;
 
 public class BranchesPage extends RepositoryPage {
 
 	public BranchesPage(PageParameters params) {
 		super(params);
 
-		Repository r = getRepository();
-		List<RefModel> branches = new ArrayList<RefModel>();
-		branches.addAll(JGitUtils.getLocalBranches(r, -1));
-		branches.addAll(JGitUtils.getRemoteBranches(r, -1));
-
-		// shortlog
-		add(new LinkPanel("summary", "title", repositoryName, SummaryPage.class, newRepositoryParameter()));
-
-		ListDataProvider<RefModel> branchesDp = new ListDataProvider<RefModel>(branches);
-		DataView<RefModel> branchView = new DataView<RefModel>("branch", branchesDp) {
-			private static final long serialVersionUID = 1L;
-			int counter = 0;
-
-			public void populateItem(final Item<RefModel> item) {
-				final RefModel entry = item.getModelObject();
-				String date;
-				if (entry.getDate() != null) {
-					date = Utils.timeAgo(entry.getDate());
-				} else {
-					date = "";
-				}
-				Label branchDateLabel = new Label("branchDate", date);
-				item.add(branchDateLabel);
-				WicketUtils.setCssClass(branchDateLabel, Utils.timeAgoCss(entry.getDate()));
-
-				item.add(new LinkPanel("branchName", "list name", entry.getDisplayName(), ShortLogPage.class, newCommitParameter(entry.getName())));
-
-				boolean remote = entry.getName().startsWith(Constants.R_REMOTES);
-				item.add(new Label("branchType", remote ? getString("gb.remote"):getString("gb.local")));
-				
-				item.add(new BranchLinksPanel("branchLinks", repositoryName, entry));
-				
-				String clazz = counter % 2 == 0 ? "dark" : "light";
-				WicketUtils.setCssClass(item, clazz);
-				counter++;
-			}
-		};
-		add(branchView);
+		add(new BranchesPanel("branchesPanel", getRepositoryModel(), getRepository(), -1));
 	}
-	
+
 	@Override
 	protected String getPageName() {
 		return getString("gb.branches");

--
Gitblit v1.9.1