summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2012-02-25 10:54:22 -0500
committerJames Moger <james.moger@gitblit.com>2012-02-25 10:54:22 -0500
commita45caac4769a1cd8337c45a1279d130db8c0e539 (patch)
tree4856812cb1280efd3a244edff2178eb1c51c4fa4 /src/com
parent40538c57dd574d831d044cda50a8999941dc0a24 (diff)
downloadgitblit-a45caac4769a1cd8337c45a1279d130db8c0e539.tar.gz
gitblit-a45caac4769a1cd8337c45a1279d130db8c0e539.zip
Split refs into 2 lines if there are remotes. Use more glyphicons.
Diffstat (limited to 'src/com')
-rw-r--r--src/com/gitblit/Constants.java4
-rw-r--r--src/com/gitblit/utils/StringUtils.java10
-rw-r--r--src/com/gitblit/wicket/WicketUtils.java13
-rw-r--r--src/com/gitblit/wicket/pages/DocsPage.html2
-rw-r--r--src/com/gitblit/wicket/pages/SummaryPage.html2
-rw-r--r--src/com/gitblit/wicket/panels/ActivityPanel.html2
-rw-r--r--src/com/gitblit/wicket/panels/ActivityPanel.java7
-rw-r--r--src/com/gitblit/wicket/panels/BranchesPanel.html2
-rw-r--r--src/com/gitblit/wicket/panels/BranchesPanel.java7
-rw-r--r--src/com/gitblit/wicket/panels/HistoryPanel.java7
-rw-r--r--src/com/gitblit/wicket/panels/LogPanel.html4
-rw-r--r--src/com/gitblit/wicket/panels/LogPanel.java12
-rw-r--r--src/com/gitblit/wicket/panels/RefsPanel.html2
-rw-r--r--src/com/gitblit/wicket/panels/RefsPanel.java42
-rw-r--r--src/com/gitblit/wicket/panels/SearchPanel.java7
-rw-r--r--src/com/gitblit/wicket/panels/TagsPanel.html2
-rw-r--r--src/com/gitblit/wicket/panels/TagsPanel.java8
17 files changed, 95 insertions, 38 deletions
diff --git a/src/com/gitblit/Constants.java b/src/com/gitblit/Constants.java
index a28a871a..3f823de1 100644
--- a/src/com/gitblit/Constants.java
+++ b/src/com/gitblit/Constants.java
@@ -65,6 +65,10 @@ public class Constants {
public static final String ENCODING = "UTF-8";
+ public static final int LEN_SHORTLOG = 80;
+
+ public static final int LEN_SHORTLOG_REFS = 60;
+
public static String getGitBlitVersion() {
return NAME + " v" + VERSION;
}
diff --git a/src/com/gitblit/utils/StringUtils.java b/src/com/gitblit/utils/StringUtils.java
index fc0bf42f..a465e0d7 100644
--- a/src/com/gitblit/utils/StringUtils.java
+++ b/src/com/gitblit/utils/StringUtils.java
@@ -169,16 +169,6 @@ public class StringUtils {
}
/**
- * Returns a trimmed shortlog message.
- *
- * @param string
- * @return trimmed shortlog message
- */
- public static String trimShortLog(String string) {
- return trimString(string, 60);
- }
-
- /**
* Left pad a string with the specified character, if the string length is
* less than the specified length.
*
diff --git a/src/com/gitblit/wicket/WicketUtils.java b/src/com/gitblit/wicket/WicketUtils.java
index 7be5328e..864ebe6a 100644
--- a/src/com/gitblit/wicket/WicketUtils.java
+++ b/src/com/gitblit/wicket/WicketUtils.java
@@ -220,6 +220,19 @@ public class WicketUtils {
return img;
}
+ public static Label newIcon(String wicketId, String css) {
+ Label lbl = new Label(wicketId);
+ setCssClass(lbl, css);
+ return lbl;
+ }
+
+ public static Label newBlankIcon(String wicketId) {
+ Label lbl = new Label(wicketId);
+ setCssClass(lbl, "");
+ lbl.setRenderBodyOnly(true);
+ return lbl;
+ }
+
public static ContextRelativeResource getResource(String file) {
return new ContextRelativeResource(file);
}
diff --git a/src/com/gitblit/wicket/pages/DocsPage.html b/src/com/gitblit/wicket/pages/DocsPage.html
index 0da4bde4..98432b5e 100644
--- a/src/com/gitblit/wicket/pages/DocsPage.html
+++ b/src/com/gitblit/wicket/pages/DocsPage.html
@@ -8,7 +8,7 @@
<wicket:extend>
<!-- header -->
- <div style="margin-top:5px;" class="header"><span wicket:id="header">[header]</span></div>
+ <div style="margin-top:5px;" class="header"><i class="icon-book" style="vertical-align: middle;"></i> <b><span wicket:id="header">[header]</span></b></div>
<!-- documents -->
<table style="width:100%" class="pretty">
diff --git a/src/com/gitblit/wicket/pages/SummaryPage.html b/src/com/gitblit/wicket/pages/SummaryPage.html
index 941e777d..c2096a6f 100644
--- a/src/com/gitblit/wicket/pages/SummaryPage.html
+++ b/src/com/gitblit/wicket/pages/SummaryPage.html
@@ -38,7 +38,7 @@
<wicket:fragment wicket:id="markdownPanel">
<div class="header" style="margin-top:10px;" >
- <img style="vertical-align: middle; border: 1px solid #888;" src="book_16x16.png"/>
+ <i style="vertical-align: middle;" class="icon-book"></i>
<span style="font-weight:bold;vertical-align:middle;" wicket:id="readmeFile"></span>
</div>
<div style="border:1px solid #ddd;border-radius: 0 0 3px 3px;padding: 20px;">
diff --git a/src/com/gitblit/wicket/panels/ActivityPanel.html b/src/com/gitblit/wicket/panels/ActivityPanel.html
index 4c0566cf..3a603bfb 100644
--- a/src/com/gitblit/wicket/panels/ActivityPanel.html
+++ b/src/com/gitblit/wicket/panels/ActivityPanel.html
@@ -8,7 +8,7 @@
<wicket:panel>
<div wicket:id="activity">
- <div class="header"><span style="font-weight:bold;" wicket:id="title">[title]</span></div>
+ <div class="header"><i class="icon-refresh" style="vertical-align: middle;"></i> <span style="font-weight:bold;" wicket:id="title">[title]</span></div>
<table class="activity" wicket:id="commits">
<tr wicket:id="commit"></tr>
</table>
diff --git a/src/com/gitblit/wicket/panels/ActivityPanel.java b/src/com/gitblit/wicket/panels/ActivityPanel.java
index 34a281fb..dc94f3c1 100644
--- a/src/com/gitblit/wicket/panels/ActivityPanel.java
+++ b/src/com/gitblit/wicket/panels/ActivityPanel.java
@@ -113,7 +113,12 @@ public class ActivityPanel extends BasePanel {
// message/commit link
String shortMessage = commit.getShortMessage();
- String trimmedMessage = StringUtils.trimShortLog(shortMessage);
+ String trimmedMessage = shortMessage;
+ if (commit.getRefs() != null && commit.getRefs().size() > 0) {
+ trimmedMessage = StringUtils.trimString(shortMessage, Constants.LEN_SHORTLOG_REFS);
+ } else {
+ trimmedMessage = StringUtils.trimString(shortMessage, Constants.LEN_SHORTLOG);
+ }
LinkPanel shortlog = new LinkPanel("message", "list subject",
trimmedMessage, CommitPage.class, WicketUtils.newObjectParameter(
commit.repository, commit.getName()), true);
diff --git a/src/com/gitblit/wicket/panels/BranchesPanel.html b/src/com/gitblit/wicket/panels/BranchesPanel.html
index 01fb8bac..114541fb 100644
--- a/src/com/gitblit/wicket/panels/BranchesPanel.html
+++ b/src/com/gitblit/wicket/panels/BranchesPanel.html
@@ -8,7 +8,7 @@
<wicket:panel>
<!-- header -->
- <div class="header"><img style="vertical-align: middle;" src="commit_branch_16x16.png"></img><span wicket:id="branches">[branches header]</span></div>
+ <div class="header"><i class="icon-random" style="vertical-align: middle;"></i> <b><span wicket:id="branches">[branches header]</span></b></div>
<table class="pretty">
<tbody>
diff --git a/src/com/gitblit/wicket/panels/BranchesPanel.java b/src/com/gitblit/wicket/panels/BranchesPanel.java
index 6eb40199..0d2fe4a9 100644
--- a/src/com/gitblit/wicket/panels/BranchesPanel.java
+++ b/src/com/gitblit/wicket/panels/BranchesPanel.java
@@ -41,7 +41,6 @@ import com.gitblit.wicket.pages.CommitPage;
import com.gitblit.wicket.pages.LogPage;
import com.gitblit.wicket.pages.MetricsPage;
import com.gitblit.wicket.pages.SearchPage;
-import com.gitblit.wicket.pages.SummaryPage;
import com.gitblit.wicket.pages.TreePage;
public class BranchesPanel extends BasePanel {
@@ -73,9 +72,7 @@ public class BranchesPanel extends BasePanel {
null), BranchesPage.class, WicketUtils.newRepositoryParameter(model.name)));
} else {
// branches page
- // show repository summary page link
- add(new LinkPanel("branches", "title", model.name, SummaryPage.class,
- WicketUtils.newRepositoryParameter(model.name)));
+ add(new Label("branches", new StringResourceModel("gb.branches", this, null)));
}
ListDataProvider<RefModel> branchesDp = new ListDataProvider<RefModel>(branches);
@@ -101,7 +98,7 @@ public class BranchesPanel extends BasePanel {
// short message
String shortMessage = entry.getShortMessage();
- String trimmedMessage = StringUtils.trimShortLog(shortMessage);
+ String trimmedMessage = StringUtils.trimString(shortMessage, Constants.LEN_SHORTLOG);
LinkPanel shortlog = new LinkPanel("branchLog", "list subject", trimmedMessage,
CommitPage.class, WicketUtils.newObjectParameter(model.name,
entry.getName()));
diff --git a/src/com/gitblit/wicket/panels/HistoryPanel.java b/src/com/gitblit/wicket/panels/HistoryPanel.java
index 16f95f22..36a76806 100644
--- a/src/com/gitblit/wicket/panels/HistoryPanel.java
+++ b/src/com/gitblit/wicket/panels/HistoryPanel.java
@@ -121,7 +121,12 @@ public class HistoryPanel extends BasePanel {
}
String shortMessage = entry.getShortMessage();
- String trimmedMessage = StringUtils.trimShortLog(shortMessage);
+ String trimmedMessage = shortMessage;
+ if (allRefs.containsKey(entry.getId())) {
+ trimmedMessage = StringUtils.trimString(shortMessage, Constants.LEN_SHORTLOG_REFS);
+ } else {
+ trimmedMessage = StringUtils.trimString(shortMessage, Constants.LEN_SHORTLOG);
+ }
LinkPanel shortlog = new LinkPanel("commitShortMessage", "list subject",
trimmedMessage, CommitPage.class, WicketUtils.newObjectParameter(
repositoryName, entry.getName()));
diff --git a/src/com/gitblit/wicket/panels/LogPanel.html b/src/com/gitblit/wicket/panels/LogPanel.html
index 700f66a1..96173062 100644
--- a/src/com/gitblit/wicket/panels/LogPanel.html
+++ b/src/com/gitblit/wicket/panels/LogPanel.html
@@ -8,14 +8,14 @@
<wicket:panel>
<!-- header -->
- <div class="header"><img style="vertical-align: middle;" src="commit_changes_16x16.png"></img><span wicket:id="header">[log header]</span></div>
+ <div class="header"><i class="icon-refresh" style="vertical-align: middle;"></i> <b><span wicket:id="header">[log header]</span></b></div>
<table class="pretty">
<tbody>
<tr wicket:id="commit">
<td class="date"><span wicket:id="commitDate">[commit date]</span></td>
<td class="author"><span wicket:id="commitAuthor">[commit author]</span></td>
<td class="icon"><img wicket:id="commitIcon" /></td>
- <td><div class="references" wicket:id="commitRefs">[commit refs]</div><span wicket:id="commitShortMessage">[commit short message]</span></td>
+ <td><div class="references" wicket:id="commitRefs">[commit refs]</div><div style="vertical-align:middle;" wicket:id="commitShortMessage">[commit short message]</div></td>
<td class="rightAlign">
<span class="link">
<a wicket:id="view"><wicket:message key="gb.view"></wicket:message></a> | <a wicket:id="diff"><wicket:message key="gb.diff"></wicket:message></a> | <a wicket:id="tree"><wicket:message key="gb.tree"></wicket:message></a>
diff --git a/src/com/gitblit/wicket/panels/LogPanel.java b/src/com/gitblit/wicket/panels/LogPanel.java
index 74764d6d..a960f6e0 100644
--- a/src/com/gitblit/wicket/panels/LogPanel.java
+++ b/src/com/gitblit/wicket/panels/LogPanel.java
@@ -40,7 +40,6 @@ import com.gitblit.wicket.pages.CommitDiffPage;
import com.gitblit.wicket.pages.CommitPage;
import com.gitblit.wicket.pages.LogPage;
import com.gitblit.wicket.pages.SearchPage;
-import com.gitblit.wicket.pages.SummaryPage;
import com.gitblit.wicket.pages.TreePage;
public class LogPanel extends BasePanel {
@@ -75,9 +74,7 @@ public class LogPanel extends BasePanel {
// header
if (pageResults) {
// shortlog page
- // show repository summary page link
- add(new LinkPanel("header", "title", objectId, SummaryPage.class,
- WicketUtils.newRepositoryParameter(repositoryName)));
+ add(new Label("header", objectId));
} else {
// summary page
// show shortlog page link
@@ -113,7 +110,12 @@ public class LogPanel extends BasePanel {
// short message
String shortMessage = entry.getShortMessage();
- String trimmedMessage = StringUtils.trimShortLog(shortMessage);
+ String trimmedMessage = shortMessage;
+ if (allRefs.containsKey(entry.getId())) {
+ trimmedMessage = StringUtils.trimString(shortMessage, Constants.LEN_SHORTLOG_REFS);
+ } else {
+ trimmedMessage = StringUtils.trimString(shortMessage, Constants.LEN_SHORTLOG);
+ }
LinkPanel shortlog = new LinkPanel("commitShortMessage", "list subject",
trimmedMessage, CommitPage.class, WicketUtils.newObjectParameter(
repositoryName, entry.getName()));
diff --git a/src/com/gitblit/wicket/panels/RefsPanel.html b/src/com/gitblit/wicket/panels/RefsPanel.html
index 5d301931..a3c0ec49 100644
--- a/src/com/gitblit/wicket/panels/RefsPanel.html
+++ b/src/com/gitblit/wicket/panels/RefsPanel.html
@@ -6,7 +6,7 @@
<wicket:panel>
<span wicket:id="ref">
- <span wicket:id="refName">ref</span>
+ <span wicket:id="lineBreak">[LB]</span><span wicket:id="refName">ref</span>
</span>
</wicket:panel>
</html> \ No newline at end of file
diff --git a/src/com/gitblit/wicket/panels/RefsPanel.java b/src/com/gitblit/wicket/panels/RefsPanel.java
index f25b53b2..86e74a14 100644
--- a/src/com/gitblit/wicket/panels/RefsPanel.java
+++ b/src/com/gitblit/wicket/panels/RefsPanel.java
@@ -22,6 +22,7 @@ import java.util.List;
import java.util.Map;
import org.apache.wicket.Component;
+import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.markup.repeater.data.DataView;
@@ -54,19 +55,48 @@ public class RefsPanel extends Panel {
Collections.sort(refs, new Comparator<RefModel>() {
@Override
public int compare(RefModel o1, RefModel o2) {
+ // sort remote heads last, otherwise sort by name
+ // this is so we can insert a break on the refs panel
+ // [head][branch][branch][tag][tag]
+ // [remote][remote][remote]
+ boolean remote1 = o1.displayName.startsWith(Constants.R_REMOTES);
+ boolean remote2 = o2.displayName.startsWith(Constants.R_REMOTES);
+ if (remote1 && remote2) {
+ // both are remote heads, sort by name
+ return o1.displayName.compareTo(o2.displayName);
+ }
+ if (remote1) {
+ // o1 is remote, o2 comes first
+ return 1;
+ }
+ if (remote2) {
+ // remote is o2, o1 comes first
+ return -1;
+ }
+ // standard sort
return o1.displayName.compareTo(o2.displayName);
}
});
-
+
+ // count remote and determine if we should insert a break
+ int remoteCount = 0;
+ for (RefModel ref : refs) {
+ if (ref.displayName.startsWith(Constants.R_REMOTES)) {
+ remoteCount++;
+ }
+ }
+ final boolean shouldBreak = remoteCount < refs.size();
+
ListDataProvider<RefModel> refsDp = new ListDataProvider<RefModel>(refs);
DataView<RefModel> refsView = new DataView<RefModel>("ref", refsDp) {
private static final long serialVersionUID = 1L;
+ private boolean alreadyInsertedBreak = !shouldBreak;
public void populateItem(final Item<RefModel> item) {
RefModel entry = item.getModelObject();
String name = entry.displayName;
String objectid = entry.getReferencedObjectId().getName();
-
+ boolean breakLine = false;
Class<? extends RepositoryPage> linkClass = CommitPage.class;
String cssClass = "";
if (name.startsWith(Constants.R_HEADS)) {
@@ -83,6 +113,10 @@ public class RefsPanel extends Panel {
linkClass = LogPage.class;
name = name.substring(Constants.R_REMOTES.length());
cssClass = "remoteBranch";
+ if (!alreadyInsertedBreak) {
+ breakLine = true;
+ alreadyInsertedBreak = true;
+ }
} else if (name.startsWith(Constants.R_TAGS)) {
// tag
if (entry.isAnnotatedTag()) {
@@ -104,6 +138,10 @@ public class RefsPanel extends Panel {
WicketUtils.setCssClass(c, cssClass);
WicketUtils.setHtmlTooltip(c, name);
item.add(c);
+ Label lb = new Label("lineBreak", "<br/>");
+ lb.setVisible(breakLine);
+ lb.setRenderBodyOnly(true);
+ item.add(lb.setEscapeModelStrings(false));
}
};
add(refsView);
diff --git a/src/com/gitblit/wicket/panels/SearchPanel.java b/src/com/gitblit/wicket/panels/SearchPanel.java
index 44b499b2..b9b13a50 100644
--- a/src/com/gitblit/wicket/panels/SearchPanel.java
+++ b/src/com/gitblit/wicket/panels/SearchPanel.java
@@ -105,7 +105,12 @@ public class SearchPanel extends BasePanel {
}
String shortMessage = entry.getShortMessage();
- String trimmedMessage = StringUtils.trimShortLog(shortMessage);
+ String trimmedMessage = shortMessage;
+ if (allRefs.containsKey(entry.getId())) {
+ trimmedMessage = StringUtils.trimString(shortMessage, Constants.LEN_SHORTLOG_REFS);
+ } else {
+ trimmedMessage = StringUtils.trimString(shortMessage, Constants.LEN_SHORTLOG);
+ }
LinkPanel shortlog = new LinkPanel("commitShortMessage", "list subject",
trimmedMessage, CommitPage.class, WicketUtils.newObjectParameter(
repositoryName, entry.getName()));
diff --git a/src/com/gitblit/wicket/panels/TagsPanel.html b/src/com/gitblit/wicket/panels/TagsPanel.html
index c9c19a37..899f9cbc 100644
--- a/src/com/gitblit/wicket/panels/TagsPanel.html
+++ b/src/com/gitblit/wicket/panels/TagsPanel.html
@@ -8,7 +8,7 @@
<wicket:panel>
<!-- tags -->
- <div class="header"><img style="vertical-align: middle;" src="tag_16x16.png"></img><span wicket:id="header">[tags header]</span></div>
+ <div class="header"><i class="icon-tags" style="vertical-align: middle;"></i> <b><span wicket:id="header">[tags header]</span></b></div>
<table class="pretty">
<tbody>
<tr wicket:id="tag">
diff --git a/src/com/gitblit/wicket/panels/TagsPanel.java b/src/com/gitblit/wicket/panels/TagsPanel.java
index 39d4092b..a06c1c2e 100644
--- a/src/com/gitblit/wicket/panels/TagsPanel.java
+++ b/src/com/gitblit/wicket/panels/TagsPanel.java
@@ -36,7 +36,6 @@ import com.gitblit.wicket.pages.CommitPage;
import com.gitblit.wicket.pages.LogPage;
import com.gitblit.wicket.pages.RawPage;
import com.gitblit.wicket.pages.RepositoryPage;
-import com.gitblit.wicket.pages.SummaryPage;
import com.gitblit.wicket.pages.TagPage;
import com.gitblit.wicket.pages.TagsPage;
import com.gitblit.wicket.pages.TreePage;
@@ -59,9 +58,7 @@ public class TagsPanel extends BasePanel {
TagsPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
} else {
// tags page
- // show repository summary page link
- add(new LinkPanel("header", "title", repositoryName, SummaryPage.class,
- WicketUtils.newRepositoryParameter(repositoryName)));
+ add(new Label("header", new StringResourceModel("gb.tags", this, null)));
}
ListDataProvider<RefModel> tagsDp = new ListDataProvider<RefModel>(tags);
@@ -92,7 +89,8 @@ public class TagsPanel extends BasePanel {
.getReferencedObjectId().getName())));
// workaround for RevTag returning a lengthy shortlog. :(
- String message = StringUtils.trimShortLog(entry.getShortMessage());
+ String message = StringUtils.trimString(entry.getShortMessage(),
+ com.gitblit.Constants.LEN_SHORTLOG);
if (linkClass.equals(BlobPage.class)) {
// Blob Tag Object