package com.gitblit.wicket;\r
\r
-import java.util.Date;\r
-\r
import javax.servlet.http.HttpServletRequest;\r
\r
-import org.apache.wicket.Component;\r
import org.apache.wicket.PageParameters;\r
import org.apache.wicket.markup.html.WebPage;\r
import org.apache.wicket.markup.html.basic.Label;\r
\r
import com.gitblit.Constants;\r
import com.gitblit.StoredSettings;\r
-import com.gitblit.utils.Utils;\r
import com.gitblit.wicket.pages.SummaryPage;\r
\r
-\r
public abstract class BasePage extends WebPage {\r
\r
Logger logger = LoggerFactory.getLogger(BasePage.class);\r
HttpServletRequest req = servletWebRequest.getHttpServletRequest();\r
return req.getServerName();\r
}\r
-\r
- protected Label createAuthorLabel(String wicketId, String author) {\r
- Label label = new Label(wicketId, author);\r
- WicketUtils.setHtmlTitle(label, author);\r
- return label;\r
- }\r
-\r
- protected Label createDateLabel(String wicketId, Date date) {\r
- Label label = new Label(wicketId, GitBlitWebSession.get().formatDate(date));\r
- WicketUtils.setCssClass(label, Utils.timeAgoCss(date));\r
- WicketUtils.setHtmlTitle(label, Utils.timeAgo(date));\r
- return label;\r
- }\r
-\r
- protected Label createShortlogDateLabel(String wicketId, Date date) {\r
- String dateString = GitBlitWebSession.get().formatDate(date);\r
- String title = Utils.timeAgo(date);\r
- if ((System.currentTimeMillis() - date.getTime()) < 10 * 24 * 60 * 60 * 1000l) {\r
- dateString = title;\r
- title = GitBlitWebSession.get().formatDate(date);\r
- }\r
- Label label = new Label(wicketId, dateString);\r
- WicketUtils.setCssClass(label, Utils.timeAgoCss(date));\r
- WicketUtils.setHtmlTitle(label, title);\r
- return label;\r
- }\r
-\r
- protected void setAlternatingBackground(Component c, int i) {\r
- String clazz = i % 2 == 0 ? "dark" : "light";\r
- WicketUtils.setCssClass(c, clazz);\r
- }\r
-\r
- protected String trimShortLog(String string) {\r
- return trimString(string, 60);\r
- }\r
\r
- protected String trimString(String value, int max) {\r
- if (value.length() <= max) {\r
- return value;\r
- }\r
- return value.substring(0, max - 3) + "...";\r
- }\r
-\r
public void error(String message, Throwable t) {\r
super.error(message);\r
logger.error(message, t);\r
import com.gitblit.wicket.pages.CommitPage;\r
import com.gitblit.wicket.pages.DiffPage;\r
import com.gitblit.wicket.pages.RepositoriesPage;\r
-import com.gitblit.wicket.pages.ShortLogPage;\r
+import com.gitblit.wicket.pages.LogPage;\r
import com.gitblit.wicket.pages.SummaryPage;\r
import com.gitblit.wicket.pages.TagPage;\r
import com.gitblit.wicket.pages.TagsPage;\r
\r
// setup the standard gitweb-ish urls\r
mount(new MixedParamUrlCodingStrategy("/summary", SummaryPage.class, new String[] { "p" }));\r
- mount(new MixedParamUrlCodingStrategy("/shortlog", ShortLogPage.class, new String[] { "p", "h" }));\r
+ mount(new MixedParamUrlCodingStrategy("/shortlog", LogPage.class, new String[] { "p", "h" }));\r
mount(new MixedParamUrlCodingStrategy("/tags", TagsPage.class, new String[] { "p" }));\r
mount(new MixedParamUrlCodingStrategy("/branches", BranchesPage.class, new String[] { "p" }));\r
mount(new MixedParamUrlCodingStrategy("/commit", CommitPage.class, new String[] { "p", "h" }));\r
gb.branches = branches\r
gb.patch = patch\r
gb.diff = diff\r
-gb.shortlog = shortlog\r
-gb.more = more\r
-gb.allTags = all tags\r
-gb.allBranches = all branches\r
+gb.log = log\r
+gb.moreLogs = more commits...\r
+gb.allTags = all tags...\r
+gb.allBranches = all branches...\r
gb.summary = summary\r
gb.ticket = ticket\r
gb.newRepository = new repository\r
redirectToInterceptPage(new RepositoriesPage());\r
}\r
repositoryName = params.getString("p", "");\r
- commitId = params.getString("h", "");\r
+ commitId = params.getString("h", "HEAD");\r
\r
Repository r = getRepository();\r
\r
}\r
\r
protected PageParameters newRepositoryParameter() {\r
- return new PageParameters("p=" + repositoryName);\r
+ return WicketUtils.newRepositoryParameter(repositoryName);\r
}\r
\r
protected PageParameters newCommitParameter() {\r
- return newCommitParameter(commitId);\r
+ return WicketUtils.newCommitParameter(repositoryName, commitId);\r
}\r
\r
protected PageParameters newCommitParameter(String commitId) {\r
- if (commitId == null || commitId.trim().length() == 0) {\r
- return newRepositoryParameter();\r
- }\r
- return new PageParameters("p=" + repositoryName + ",h=" + commitId);\r
+ return WicketUtils.newCommitParameter(repositoryName, commitId);\r
}\r
\r
protected PageParameters newPathParameter(String path) {\r
- if (path == null || path.trim().length() == 0) {\r
- return newCommitParameter();\r
- }\r
- return new PageParameters("p=" + repositoryName + ",h=" + commitId + ",f=" + path);\r
+ return WicketUtils.newPathParameter(repositoryName, commitId, path);\r
}\r
}\r
package com.gitblit.wicket;\r
\r
+import java.text.DateFormat;\r
+import java.text.SimpleDateFormat;\r
+import java.util.Date;\r
import java.util.List;\r
+import java.util.TimeZone;\r
\r
import org.apache.wicket.Component;\r
+import org.apache.wicket.PageParameters;\r
import org.apache.wicket.behavior.SimpleAttributeModifier;\r
+import org.apache.wicket.markup.html.basic.Label;\r
+\r
+import com.gitblit.StoredSettings;\r
+import com.gitblit.utils.Utils;\r
\r
public class WicketUtils {\r
\r
}\r
return sb.toString().trim();\r
}\r
+ \r
+ public static void setAlternatingBackground(Component c, int i) {\r
+ String clazz = i % 2 == 0 ? "dark" : "light";\r
+ setCssClass(c, clazz);\r
+ }\r
+ \r
+ public static Label createAuthorLabel(String wicketId, String author) {\r
+ Label label = new Label(wicketId, author);\r
+ WicketUtils.setHtmlTitle(label, author);\r
+ return label;\r
+ }\r
+\r
+ public static String trimShortLog(String string) {\r
+ return trimString(string, 60);\r
+ }\r
+ \r
+ public static String trimString(String value, int max) {\r
+ if (value.length() <= max) {\r
+ return value;\r
+ }\r
+ return value.substring(0, max - 3) + "...";\r
+ }\r
+ \r
+ public static PageParameters newRepositoryParameter(String repositoryName) {\r
+ return new PageParameters("p=" + repositoryName);\r
+ }\r
+\r
+ public static PageParameters newCommitParameter(String repositoryName, String commitId) {\r
+ if (commitId == null || commitId.trim().length() == 0) {\r
+ return newRepositoryParameter(repositoryName);\r
+ }\r
+ return new PageParameters("p=" + repositoryName + ",h=" + commitId);\r
+ }\r
+\r
+ public static PageParameters newPathParameter(String repositoryName, String commitId, String path) {\r
+ if (path == null || path.trim().length() == 0) {\r
+ return newCommitParameter(repositoryName, commitId);\r
+ }\r
+ return new PageParameters("p=" + repositoryName + ",h=" + commitId + ",f=" + path);\r
+ }\r
+ \r
+ public static Label createDateLabel(String wicketId, Date date, TimeZone timeZone) {\r
+ DateFormat df = new SimpleDateFormat(StoredSettings.getString("datestampShortFormat", "MM/dd/yy"));\r
+ if (timeZone != null) {\r
+ df.setTimeZone(timeZone);\r
+ }\r
+ String dateString = df.format(date);\r
+ String title = Utils.timeAgo(date);\r
+ if ((System.currentTimeMillis() - date.getTime()) < 10 * 24 * 60 * 60 * 1000l) {\r
+ String tmp = dateString;\r
+ dateString = title;\r
+ title = tmp;\r
+ }\r
+ Label label = new Label(wicketId, dateString);\r
+ WicketUtils.setCssClass(label, Utils.timeAgoCss(date));\r
+ WicketUtils.setHtmlTitle(label, title);\r
+ return label;\r
+ }\r
}\r
}\r
\r
public boolean isAnnotatedTag() {\r
- return ref.isPeeled();\r
+ // ref.isPeeled() ??\r
+ return !getCommitId().equals(getObjectId());\r
}\r
\r
@Override\r
<div wicket:id="breadcrumbs">[breadcrumbs]</div>\r
\r
<!-- blob content -->\r
- <pre wicket:id="blobText">[blob content]</pre>\r
+ <pre style="border:0px;" wicket:id="blobText">[blob content]</pre>\r
\r
</body>\r
</wicket:extend>\r
\r
<!-- page nav links --> \r
<div wicket:id="pageLinks">[page links]</div>\r
- \r
- <!-- shortlog --> \r
- <div style="margin-top:5px;" class="header" wicket:id="summary">[header]</div> \r
- <table class="pretty">\r
- <tbody>\r
- <tr wicket:id="branch">\r
- <td class="date"><span wicket:id="branchDate">[branch date]</span></td>\r
- <td><div wicket:id="branchName">[branch name]</div></td>\r
- <td><div wicket:id="branchType">[branch type]</div></td>\r
- <td class="rightAlign"><span wicket:id="branchLinks">[branch links]</span></td>\r
- </tr>\r
- </tbody>\r
- </table> \r
\r
+ <!-- branches --> \r
+ <div style="margin-top:5px;" wicket:id="branchesPanel">[branches panel]</div>\r
+ \r
</wicket:extend>\r
</body>\r
</html>
\ No newline at end of file
package com.gitblit.wicket.pages;\r
\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
import org.apache.wicket.PageParameters;\r
-import org.apache.wicket.markup.html.basic.Label;\r
-import org.apache.wicket.markup.repeater.Item;\r
-import org.apache.wicket.markup.repeater.data.DataView;\r
-import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
-import org.eclipse.jgit.lib.Constants;\r
-import org.eclipse.jgit.lib.Repository;\r
\r
-import com.gitblit.utils.JGitUtils;\r
-import com.gitblit.utils.Utils;\r
-import com.gitblit.wicket.LinkPanel;\r
import com.gitblit.wicket.RepositoryPage;\r
-import com.gitblit.wicket.WicketUtils;\r
-import com.gitblit.wicket.models.RefModel;\r
-import com.gitblit.wicket.panels.BranchLinksPanel;\r
+import com.gitblit.wicket.panels.BranchesPanel;\r
\r
\r
public class BranchesPage extends RepositoryPage {\r
public BranchesPage(PageParameters params) {\r
super(params);\r
\r
- Repository r = getRepository();\r
- List<RefModel> branches = new ArrayList<RefModel>();\r
- branches.addAll(JGitUtils.getLocalBranches(r, -1));\r
- branches.addAll(JGitUtils.getRemoteBranches(r, -1));\r
-\r
- // shortlog\r
- add(new LinkPanel("summary", "title", repositoryName, SummaryPage.class, newRepositoryParameter()));\r
-\r
- ListDataProvider<RefModel> branchesDp = new ListDataProvider<RefModel>(branches);\r
- DataView<RefModel> branchView = new DataView<RefModel>("branch", branchesDp) {\r
- private static final long serialVersionUID = 1L;\r
- int counter = 0;\r
-\r
- public void populateItem(final Item<RefModel> item) {\r
- final RefModel entry = item.getModelObject();\r
- String date;\r
- if (entry.getDate() != null) {\r
- date = Utils.timeAgo(entry.getDate());\r
- } else {\r
- date = "";\r
- }\r
- Label branchDateLabel = new Label("branchDate", date);\r
- item.add(branchDateLabel);\r
- WicketUtils.setCssClass(branchDateLabel, Utils.timeAgoCss(entry.getDate()));\r
-\r
- item.add(new LinkPanel("branchName", "list name", entry.getDisplayName(), ShortLogPage.class, newCommitParameter(entry.getName())));\r
-\r
- boolean remote = entry.getName().startsWith(Constants.R_REMOTES);\r
- item.add(new Label("branchType", remote ? getString("gb.remote"):getString("gb.local")));\r
- \r
- item.add(new BranchLinksPanel("branchLinks", repositoryName, entry));\r
- \r
- String clazz = counter % 2 == 0 ? "dark" : "light";\r
- WicketUtils.setCssClass(item, clazz);\r
- counter++;\r
- }\r
- };\r
- add(branchView);\r
+ add(new BranchesPanel("branchesPanel", repositoryName, getRepository(), -1));\r
}\r
\r
@Override\r
<table class="pretty">\r
<tr wicket:id="changedPath">\r
<td class="path"><span wicket:id="pathName">[commit path]</span></td> \r
- <td><span wicket:id="pathLinks">[path links]</span></td>\r
+ <td>\r
+ <div class="link">\r
+ <a wicket:id="diff"><wicket:message key="gb.diff"></wicket:message></a> | <a wicket:id="view"><wicket:message key="gb.view"></wicket:message></a> | <a wicket:id="history"><wicket:message key="gb.history"></wicket:message></a>\r
+ </div>\r
+ </td>\r
</tr>\r
</table>\r
\r
\r
import org.apache.wicket.PageParameters;\r
import org.apache.wicket.markup.html.basic.Label;\r
+import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
import org.apache.wicket.markup.repeater.Item;\r
import org.apache.wicket.markup.repeater.data.DataView;\r
import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
import com.gitblit.wicket.RepositoryPage;\r
import com.gitblit.wicket.WicketUtils;\r
import com.gitblit.wicket.models.PathModel;\r
-import com.gitblit.wicket.panels.PathLinksPanel;\r
\r
\r
public class CommitPage extends RepositoryPage {\r
}\r
add(new Label("patchLink", getString("gb.patch")));\r
\r
- add(new LinkPanel("shortlog", "title", c.getShortMessage(), ShortLogPage.class, newRepositoryParameter()));\r
+ add(new LinkPanel("shortlog", "title", c.getShortMessage(), LogPage.class, newRepositoryParameter()));\r
\r
addRefs(r, c);\r
\r
} else {\r
item.add(new LinkPanel("pathName", "list", entry.path, BlobPage.class, newPathParameter(entry.path)));\r
}\r
- item.add(new PathLinksPanel("pathLinks", repositoryName, entry));\r
- String clazz = counter % 2 == 0 ? "dark" : "light";\r
- WicketUtils.setCssClass(item, clazz);\r
+ \r
+ item.add(new BookmarkablePageLink<Void>("diff", DiffPage.class, newPathParameter(entry.path)));\r
+ item.add(new BookmarkablePageLink<Void>("view", BlobPage.class, newPathParameter(entry.path)));\r
+ item.add(new BookmarkablePageLink<Void>("history", BlobPage.class).setEnabled(false));\r
+\r
+ WicketUtils.setAlternatingBackground(item, counter);\r
counter++;\r
}\r
};\r
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml" \r
+ xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" \r
+ xml:lang="en" \r
+ lang="en"> \r
+\r
+<body>\r
+<wicket:extend>\r
+\r
+ <!-- page nav links --> \r
+ <div wicket:id="pageLinks">[page links]</div>\r
+\r
+ <!-- log -->\r
+ <div style="margin-top:5px;" wicket:id="logPanel">[log panel]</div>\r
+ \r
+</wicket:extend>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+package com.gitblit.wicket.pages;\r
+\r
+import org.apache.wicket.PageParameters;\r
+\r
+import com.gitblit.wicket.RepositoryPage;\r
+import com.gitblit.wicket.panels.LogPanel;\r
+\r
+\r
+public class LogPage extends RepositoryPage {\r
+\r
+ public LogPage(PageParameters params) {\r
+ super(params);\r
+\r
+ add(new LogPanel("logPanel", repositoryName, getRepository(), 100, true));\r
+ }\r
+ \r
+ @Override\r
+ protected String getPageName() {\r
+ return getString("gb.log");\r
+ }\r
+}\r
+++ /dev/null
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml" \r
- xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" \r
- xml:lang="en" \r
- lang="en"> \r
-\r
-<body>\r
-<wicket:extend>\r
-\r
- <!-- page nav links --> \r
- <div wicket:id="pageLinks">[page links]</div>\r
- \r
- <!-- shortlog --> \r
- <div style="margin-top:5px;" class="header" wicket:id="summary">[shortlog header]</div> \r
- <table style="width:100%" "class="pretty">\r
- <tbody>\r
- <tr wicket:id="commit">\r
- <td class="date"><span wicket:id="commitDate">[commit date]</span></td>\r
- <td class="author"><span wicket:id="commitAuthor">[commit author]</span></td>\r
- <td><div wicket:id="commitShortMessage">[commit short message]</div></td>\r
- <td class="rightAlign"><div wicket:id="commitRefs">[commit refs]</div></td> \r
- <td class="rightAlign"><span wicket:id="commitLinks">[commit links]</span></td>\r
- </tr>\r
- </tbody>\r
- </table> \r
- <div class="pager" wicket:id="navigator">[pager]</div>\r
- \r
-</wicket:extend>\r
-</body>\r
-</html>
\ No newline at end of file
+++ /dev/null
-package com.gitblit.wicket.pages;\r
-\r
-import java.util.Date;\r
-import java.util.List;\r
-import java.util.Map;\r
-\r
-import org.apache.wicket.PageParameters;\r
-import org.apache.wicket.markup.html.navigation.paging.PagingNavigator;\r
-import org.apache.wicket.markup.repeater.Item;\r
-import org.apache.wicket.markup.repeater.data.DataView;\r
-import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
-import org.eclipse.jgit.lib.ObjectId;\r
-import org.eclipse.jgit.lib.Repository;\r
-import org.eclipse.jgit.revwalk.RevCommit;\r
-\r
-import com.gitblit.utils.JGitUtils;\r
-import com.gitblit.wicket.GitBlitWebApp;\r
-import com.gitblit.wicket.LinkPanel;\r
-import com.gitblit.wicket.RepositoryPage;\r
-import com.gitblit.wicket.WicketUtils;\r
-import com.gitblit.wicket.panels.RefsPanel;\r
-import com.gitblit.wicket.panels.ShortLogLinksPanel;\r
-\r
-\r
-public class ShortLogPage extends RepositoryPage {\r
-\r
- public ShortLogPage(PageParameters params) {\r
- super(params);\r
-\r
- Repository r = getRepository();\r
- final Map<ObjectId, List<String>> allRefs = JGitUtils.getAllRefs(r);\r
- List<RevCommit> commits = JGitUtils.getRevLog(r, 100);\r
-\r
- // shortlog\r
- add(new LinkPanel("summary", "title", repositoryName, SummaryPage.class, newRepositoryParameter()));\r
-\r
- ListDataProvider<RevCommit> dp = new ListDataProvider<RevCommit>(commits);\r
- DataView<RevCommit> shortlogView = new DataView<RevCommit>("commit", dp) {\r
- private static final long serialVersionUID = 1L;\r
- int counter = 0;\r
-\r
- public void populateItem(final Item<RevCommit> item) {\r
- final RevCommit entry = item.getModelObject();\r
- final Date date = JGitUtils.getCommitDate(entry);\r
-\r
- item.add(createShortlogDateLabel("commitDate", date));\r
-\r
- String author = entry.getAuthorIdent().getName();\r
- item.add(createAuthorLabel("commitAuthor", author));\r
-\r
- String shortMessage = entry.getShortMessage();\r
- String trimmedMessage = trimShortLog(shortMessage);\r
- LinkPanel shortlog = new LinkPanel("commitShortMessage", "list subject", trimmedMessage, CommitPage.class, newCommitParameter(entry.getName()));\r
- if (!shortMessage.equals(trimmedMessage)) {\r
- WicketUtils.setHtmlTitle(shortlog, shortMessage);\r
- }\r
- item.add(shortlog);\r
- \r
- item.add(new RefsPanel("commitRefs", entry, allRefs));\r
- \r
- item.add(new ShortLogLinksPanel("commitLinks", repositoryName, entry.getName()));\r
-\r
- String clazz = counter % 2 == 0 ? "dark" : "light";\r
- WicketUtils.setCssClass(item, clazz);\r
- counter++;\r
- }\r
- };\r
- shortlogView.setItemsPerPage(GitBlitWebApp.PAGING_ITEM_COUNT);\r
- add(shortlogView);\r
- add(new PagingNavigator("navigator", shortlogView));\r
- }\r
- \r
- @Override\r
- protected String getPageName() {\r
- return getString("gb.shortlog");\r
- }\r
-}\r
</div>\r
</div>\r
\r
- <!-- shortlog -->\r
- <div class="header" wicket:id="shortlog">[shortlog header]</div> \r
- <table style="width:100%" class="pretty">\r
- <tbody>\r
- <tr wicket:id="commit">\r
- <td class="date"><span wicket:id="commitDate">[commit date]</span></td>\r
- <td class="author"><span wicket:id="commitAuthor">[commit author]</span></td>\r
- <td><div wicket:id="commitShortMessage">[commit short message]</div></td>\r
- <td class="rightAlign"><div wicket:id="commitRefs">[commit refs]</div></td>\r
- <td class="rightAlign"><span wicket:id="commitLinks">[commit links]</span></td>\r
- </tr>\r
- </tbody>\r
- </table> \r
- <div class="pager" wicket:id="shortlogMore">[more shortlogs]</div>\r
+ <!-- commits -->\r
+ <div wicket:id="commitsPanel">[commits panel]</div> \r
\r
- <!-- Open Branches Body -->\r
+ <!-- branches -->\r
<div style="width:400px; float:left;">\r
- <!-- heads -->\r
- <div class="header" wicket:id="branches">[branches header]</div> \r
- <table style="width:100%" class="pretty">\r
- <tbody>\r
- <tr wicket:id="branch">\r
- <td class="date"><span wicket:id="branchDate">[branch date]</span></td>\r
- <td><div wicket:id="branchName">[branch name]</div></td>\r
- <td class="rightAlign"><span wicket:id="branchLinks">[branch links]</span></td>\r
- </tr>\r
- </tbody>\r
- </table>\r
- <div class="pager" wicket:id="allBranches">[all branches]</div>\r
- <!-- Close Branches Body -->\r
+ <div wicket:id="branchesPanel">[branches panel]</div>\r
</div>\r
\r
- <!-- Open Tags body -->\r
+ <!-- tags -->\r
<div style="margin-left:405px;">\r
- <!-- tags -->\r
- <div class="header" wicket:id="tags">[tags header]</div> \r
- <table style="width:100%" class="pretty">\r
- <tbody>\r
- <tr wicket:id="tag">\r
- <td class="date"><span wicket:id="tagDate">[tag date]</span></td>\r
- <td><b><div wicket:id="tagName">[tag name]</div></b></td>\r
- <td><div wicket:id="tagDescription">[tag description]</div></td>\r
- <td class="rightAlign"><span wicket:id="tagLinks">[tag links]</span></td>\r
- </tr>\r
- </tbody>\r
- </table>\r
- <div class="pager" wicket:id="allTags">[all tags]</div> \r
- <!-- Close Tags Body -->\r
+ <div wicket:id="tagsPanel">[tags panel]</div>\r
</div>\r
\r
</wicket:extend> \r
package com.gitblit.wicket.pages;\r
\r
import java.awt.Dimension;\r
-import java.util.ArrayList;\r
-import java.util.Collections;\r
-import java.util.Date;\r
import java.util.List;\r
-import java.util.Map;\r
\r
import org.apache.wicket.PageParameters;\r
import org.apache.wicket.markup.html.basic.Label;\r
import org.apache.wicket.markup.html.image.ContextImage;\r
-import org.apache.wicket.markup.repeater.Item;\r
-import org.apache.wicket.markup.repeater.data.DataView;\r
-import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
-import org.eclipse.jgit.lib.ObjectId;\r
import org.eclipse.jgit.lib.Repository;\r
-import org.eclipse.jgit.revwalk.RevCommit;\r
\r
import com.codecommit.wicket.AbstractChartData;\r
import com.codecommit.wicket.Chart;\r
import com.gitblit.utils.JGitUtils;\r
import com.gitblit.wicket.GitBlitWebApp;\r
import com.gitblit.wicket.GitBlitWebSession;\r
-import com.gitblit.wicket.LinkPanel;\r
import com.gitblit.wicket.RepositoryPage;\r
-import com.gitblit.wicket.WicketUtils;\r
import com.gitblit.wicket.models.Metric;\r
-import com.gitblit.wicket.models.RefModel;\r
-import com.gitblit.wicket.panels.AnnotatedTagLinksPanel;\r
-import com.gitblit.wicket.panels.BranchLinksPanel;\r
-import com.gitblit.wicket.panels.RefsPanel;\r
-import com.gitblit.wicket.panels.ShortLogLinksPanel;\r
-import com.gitblit.wicket.panels.TagLinksPanel;\r
+import com.gitblit.wicket.panels.BranchesPanel;\r
+import com.gitblit.wicket.panels.LogPanel;\r
+import com.gitblit.wicket.panels.TagsPanel;\r
\r
public class SummaryPage extends RepositoryPage {\r
\r
numberRefs = numRefsDef;\r
}\r
\r
- Repository r = getRepository();\r
- final Map<ObjectId, List<String>> allRefs = JGitUtils.getAllRefs(r);\r
+ Repository r = getRepository(); \r
\r
String owner = JGitUtils.getRepositoryOwner(r);\r
GitBlitWebSession session = GitBlitWebSession.get();\r
add(new Label("repositoryLastChange", lastchange));\r
add(new Label("repositoryCloneUrl", cloneurl));\r
\r
- // shortlog\r
- add(new LinkPanel("shortlog", "title", getString("gb.shortlog"), ShortLogPage.class, newRepositoryParameter()));\r
-\r
- List<RevCommit> commits = JGitUtils.getRevLog(r, numberCommits);\r
- ListDataProvider<RevCommit> dp = new ListDataProvider<RevCommit>(commits);\r
- DataView<RevCommit> shortlogView = new DataView<RevCommit>("commit", dp) {\r
- private static final long serialVersionUID = 1L;\r
- int counter = 0;\r
-\r
- public void populateItem(final Item<RevCommit> item) {\r
- RevCommit entry = item.getModelObject();\r
- Date date = JGitUtils.getCommitDate(entry);\r
-\r
- item.add(createShortlogDateLabel("commitDate", date));\r
-\r
- String author = entry.getAuthorIdent().getName();\r
- item.add(createAuthorLabel("commitAuthor", author));\r
-\r
- String shortMessage = entry.getShortMessage();\r
- String trimmedMessage = trimShortLog(shortMessage);\r
- LinkPanel shortlog = new LinkPanel("commitShortMessage", "list subject", trimmedMessage, CommitPage.class, newCommitParameter(entry.getName()));\r
- if (!shortMessage.equals(trimmedMessage)) {\r
- WicketUtils.setHtmlTitle(shortlog, shortMessage);\r
- }\r
- item.add(shortlog);\r
-\r
- item.add(new RefsPanel("commitRefs", entry, allRefs));\r
-\r
- item.add(new ShortLogLinksPanel("commitLinks", repositoryName, entry.getName()));\r
-\r
- setAlternatingBackground(item, counter);\r
- counter++;\r
- }\r
- };\r
- add(shortlogView);\r
- if (commits.size() < numberCommits) {\r
- add(new Label("shortlogMore", "").setVisible(false));\r
- } else {\r
- add(new LinkPanel("shortlogMore", "link", getString("gb.more") + "...", ShortLogPage.class, newRepositoryParameter()));\r
- }\r
-\r
- // tags\r
- List<RefModel> tags = JGitUtils.getTags(r, numberRefs);\r
- add(new LinkPanel("tags", "title", getString("gb.tags"), TagsPage.class, newRepositoryParameter()));\r
-\r
- ListDataProvider<RefModel> tagsDp = new ListDataProvider<RefModel>(tags);\r
- DataView<RefModel> tagView = new DataView<RefModel>("tag", tagsDp) {\r
- private static final long serialVersionUID = 1L;\r
- int counter = 0;\r
-\r
- public void populateItem(final Item<RefModel> item) {\r
- final RefModel entry = item.getModelObject();\r
-\r
- item.add(createDateLabel("tagDate", entry.getDate()));\r
-\r
- item.add(new LinkPanel("tagName", "list name", entry.getDisplayName(), CommitPage.class, newCommitParameter(entry.getCommitId().getName())));\r
-\r
- if (entry.isAnnotatedTag()) {\r
- // annotated tag\r
- item.add(new LinkPanel("tagDescription", "list subject", entry.getShortLog(), TagPage.class, newCommitParameter(entry.getObjectId().getName())));\r
- item.add(new AnnotatedTagLinksPanel("tagLinks", repositoryName, entry));\r
- } else {\r
- // simple tag on commit object\r
- item.add(new Label("tagDescription", ""));\r
- item.add(new TagLinksPanel("tagLinks", repositoryName, entry));\r
- }\r
-\r
- setAlternatingBackground(item, counter);\r
- counter++;\r
- }\r
- };\r
- add(tagView);\r
- if (tags.size() < numberRefs) {\r
- add(new Label("allTags", "").setVisible(false));\r
- } else {\r
- add(new LinkPanel("allTags", "link", getString("gb.allTags") + "...", TagsPage.class, newRepositoryParameter()));\r
- }\r
-\r
- // branches\r
- List<RefModel> branches = new ArrayList<RefModel>();\r
- branches.addAll(JGitUtils.getLocalBranches(r, numberRefs));\r
- branches.addAll(JGitUtils.getRemoteBranches(r, numberRefs));\r
- Collections.sort(branches);\r
- Collections.reverse(branches);\r
- if (numberRefs > 0 && branches.size() > numberRefs) {\r
- branches = new ArrayList<RefModel>(branches.subList(0, numberRefs));\r
- }\r
-\r
- add(new LinkPanel("branches", "title", getString("gb.branches"), BranchesPage.class, newRepositoryParameter()));\r
-\r
- ListDataProvider<RefModel> branchesDp = new ListDataProvider<RefModel>(branches);\r
- DataView<RefModel> branchesView = new DataView<RefModel>("branch", branchesDp) {\r
- private static final long serialVersionUID = 1L;\r
- int counter = 0;\r
-\r
- public void populateItem(final Item<RefModel> item) {\r
- final RefModel entry = item.getModelObject();\r
-\r
- item.add(createDateLabel("branchDate", entry.getDate()));\r
-\r
- item.add(new LinkPanel("branchName", "list name", trimString(entry.getDisplayName(), 28), ShortLogPage.class, newCommitParameter(entry.getName())));\r
-\r
- item.add(new BranchLinksPanel("branchLinks", repositoryName, entry));\r
-\r
- setAlternatingBackground(item, counter);\r
- counter++;\r
- }\r
- };\r
- add(branchesView);\r
- if (branches.size() < numberRefs) {\r
- add(new Label("allBranches", "").setVisible(false));\r
- } else {\r
- add(new LinkPanel("allBranches", "link", getString("gb.allBranches") + "...", BranchesPage.class, newRepositoryParameter()));\r
- }\r
+ add(new LogPanel("commitsPanel", repositoryName, r, numberCommits, false));\r
+ add(new TagsPanel("tagsPanel", repositoryName, r, numberRefs));\r
+ add(new BranchesPanel("branchesPanel", repositoryName, r, numberRefs));\r
\r
// Display an activity line graph\r
insertActivityGraph(r);\r
<!-- page nav links --> \r
<div wicket:id="pageLinks">[page links]</div>\r
\r
- <!-- shortlog --> \r
- <div style="margin-top:5px;" class="header" wicket:id="summary">[header]</div> \r
- <table class="pretty">\r
- <tbody>\r
- <tr wicket:id="tag">\r
- <td class="date"><span wicket:id="tagDate">[tag date]</span></td>\r
- <td><b><div wicket:id="tagName">[tag name]</div></b></td>\r
- <td><div wicket:id="tagDescription">[tag description]</div></td>\r
- <td class="rightAlign"><span wicket:id="tagLinks">[tag links]</span></td>\r
- </tr>\r
- </tbody>\r
- </table> \r
+ <!-- tags panel -->\r
+ <div style="margin-top:5px;" wicket:id="tagsPanel">[tags panel]</div>\r
\r
</wicket:extend> \r
</body>\r
package com.gitblit.wicket.pages;\r
\r
-import java.util.List;\r
-\r
import org.apache.wicket.PageParameters;\r
-import org.apache.wicket.markup.html.basic.Label;\r
-import org.apache.wicket.markup.repeater.Item;\r
-import org.apache.wicket.markup.repeater.data.DataView;\r
-import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
-import org.eclipse.jgit.lib.Repository;\r
\r
-import com.gitblit.utils.JGitUtils;\r
-import com.gitblit.wicket.LinkPanel;\r
import com.gitblit.wicket.RepositoryPage;\r
-import com.gitblit.wicket.models.RefModel;\r
-import com.gitblit.wicket.panels.AnnotatedTagLinksPanel;\r
-import com.gitblit.wicket.panels.TagLinksPanel;\r
+import com.gitblit.wicket.panels.TagsPanel;\r
\r
\r
public class TagsPage extends RepositoryPage {\r
\r
public TagsPage(PageParameters params) {\r
super(params);\r
- Repository r = getRepository();\r
- List<RefModel> tags = JGitUtils.getTags(r, -1);\r
-\r
- // shortlog\r
- add(new LinkPanel("summary", "title", repositoryName, SummaryPage.class, newRepositoryParameter()));\r
-\r
- ListDataProvider<RefModel> tagsDp = new ListDataProvider<RefModel>(tags);\r
- DataView<RefModel> tagView = new DataView<RefModel>("tag", tagsDp) {\r
- private static final long serialVersionUID = 1L;\r
- int counter = 0;\r
-\r
- public void populateItem(final Item<RefModel> item) {\r
- final RefModel entry = item.getModelObject();\r
- item.add(createDateLabel("tagDate", entry.getDate()));\r
-\r
- item.add(new LinkPanel("tagName", "list name", entry.getDisplayName(), CommitPage.class, newCommitParameter(entry.getObjectId().getName())));\r
-\r
- if (entry.isAnnotatedTag()) {\r
- // annotated tag\r
- item.add(new LinkPanel("tagDescription", "list subject", entry.getShortLog(), TagPage.class, newCommitParameter(entry.getObjectId().getName())));\r
- item.add(new AnnotatedTagLinksPanel("tagLinks", repositoryName, entry));\r
- } else {\r
- // simple tag on commit object\r
- item.add(new Label("tagDescription", ""));\r
- item.add(new TagLinksPanel("tagLinks", repositoryName, entry));\r
- }\r
-\r
- setAlternatingBackground(item, counter);\r
- counter++;\r
- }\r
- };\r
- add(tagView);\r
+ \r
+ add(new TagsPanel("tagsPanel", repositoryName, getRepository(), -1));\r
+ \r
}\r
\r
@Override\r
<div wicket:id="pageLinks">[page links]</div>\r
\r
<!-- header --> \r
- <div style="margin-top:5px;" class="header" wicket:id="summary">[header]</div>\r
+ <div style="margin-top:5px;" class="header" wicket:id="header">[header]</div>\r
\r
<!-- tickets --> \r
<table style="width:100%" class="pretty">\r
import org.apache.wicket.markup.repeater.Item;\r
import org.apache.wicket.markup.repeater.data.DataView;\r
import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
-import org.eclipse.jgit.lib.Repository;\r
\r
import com.gitblit.utils.JGitUtils;\r
import com.gitblit.utils.TicGitTicket;\r
+import com.gitblit.wicket.GitBlitWebSession;\r
import com.gitblit.wicket.LinkPanel;\r
import com.gitblit.wicket.RepositoryPage;\r
import com.gitblit.wicket.WicketUtils;\r
public TicGitPage(PageParameters params) {\r
super(params);\r
\r
- Repository r = getRepository();\r
- List<TicGitTicket> tickets = JGitUtils.getTicGitTickets(r);\r
+ List<TicGitTicket> tickets = JGitUtils.getTicGitTickets(getRepository());\r
\r
- // shortlog\r
- add(new LinkPanel("summary", "title", repositoryName, SummaryPage.class, newRepositoryParameter()));\r
+ // header\r
+ add(new LinkPanel("header", "title", repositoryName, SummaryPage.class, newRepositoryParameter()));\r
\r
ListDataProvider<TicGitTicket> ticketsDp = new ListDataProvider<TicGitTicket>(tickets);\r
DataView<TicGitTicket> ticketsView = new DataView<TicGitTicket>("ticket", ticketsDp) {\r
Label stateLabel = new Label("ticketState", entry.state);\r
WicketUtils.setTicketCssClass(stateLabel, entry.state);\r
item.add(stateLabel);\r
- item.add(createDateLabel("ticketDate", entry.date));\r
- item.add(new Label("ticketHandler", trimString(entry.handler, 30)));\r
- item.add(new LinkPanel("ticketTitle", null, trimString(entry.title, 80), TicGitTicketPage.class, newPathParameter(entry.name)));\r
+ item.add(WicketUtils.createDateLabel("ticketDate", entry.date, GitBlitWebSession.get().getTimezone()));\r
+ item.add(new Label("ticketHandler", WicketUtils.trimString(entry.handler, 30)));\r
+ item.add(new LinkPanel("ticketTitle", null, WicketUtils.trimString(entry.title, 80), TicGitTicketPage.class, newPathParameter(entry.name)));\r
\r
- setAlternatingBackground(item, counter);\r
+ WicketUtils.setAlternatingBackground(item, counter);\r
counter++;\r
}\r
};\r
<tbody>\r
<tr wicket:id="comment">\r
<td class="date"><span wicket:id="commentDate">[comment date]</span></td>\r
- <td><b><div wicket:id="commentAuthor">[comment author]</div></b></td>\r
+ <td class="author"><span wicket:id="commentAuthor">[comment author]</span></td>\r
<td><div wicket:id="commentText">[comment text]</div></td>\r
</tr>\r
</tbody>\r
\r
public void populateItem(final Item<Comment> item) {\r
final Comment entry = item.getModelObject();\r
- item.add(createDateLabel("commentDate", entry.date));\r
+ item.add(WicketUtils.createDateLabel("commentDate", entry.date, GitBlitWebSession.get().getTimezone()));\r
item.add(new Label("commentAuthor", entry.author));\r
item.add(new Label("commentText", prepareComment(entry.text)).setEscapeModelStrings(false));\r
- setAlternatingBackground(item, counter);\r
+ WicketUtils.setAlternatingBackground(item, counter);\r
counter++;\r
}\r
};\r
package com.gitblit.wicket.panels;\r
\r
import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
+import org.apache.wicket.markup.html.panel.Panel;\r
\r
import com.gitblit.wicket.pages.RepositoriesPage;\r
\r
-public class AdminLinksPanel extends BasePanel {\r
+public class AdminLinksPanel extends Panel {\r
\r
private static final long serialVersionUID = 1L;\r
\r
+++ /dev/null
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml" \r
- xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" \r
- xml:lang="en" \r
- lang="en"> \r
-\r
-<wicket:panel>\r
- <div class="link">\r
- <a wicket:id="tag"><wicket:message key="gb.tag"></wicket:message></a> | <a wicket:id="commit"><wicket:message key="gb.commit"></wicket:message></a> | <a wicket:id="shortlog"><wicket:message key="gb.shortlog"></wicket:message></a>\r
- </div> \r
-</wicket:panel>\r
-</html>
\ No newline at end of file
+++ /dev/null
-package com.gitblit.wicket.panels;\r
-\r
-import org.apache.wicket.PageParameters;\r
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
-\r
-import com.gitblit.wicket.models.RefModel;\r
-import com.gitblit.wicket.pages.CommitPage;\r
-import com.gitblit.wicket.pages.ShortLogPage;\r
-import com.gitblit.wicket.pages.TagPage;\r
-\r
-\r
-public class AnnotatedTagLinksPanel extends BasePanel {\r
-\r
- private static final long serialVersionUID = 1L;\r
-\r
- public AnnotatedTagLinksPanel(String id, String repositoryName, RefModel tag) {\r
- super(id);\r
- add(new BookmarkablePageLink<Void>("tag", TagPage.class, new PageParameters("p=" + repositoryName + ",h=" + tag.getObjectId().getName())));\r
- add(new BookmarkablePageLink<Void>("commit", CommitPage.class, new PageParameters("p=" + repositoryName + ",h=" + tag.getCommitId().getName())));\r
- add(new BookmarkablePageLink<Void>("shortlog", ShortLogPage.class, new PageParameters("p=" + repositoryName + ",h=" + tag.getName())));\r
- }\r
-}
\ No newline at end of file
+++ /dev/null
-package com.gitblit.wicket.panels;\r
-\r
-import org.apache.wicket.markup.html.panel.Panel;\r
-import org.apache.wicket.model.StringResourceModel;\r
-\r
-public abstract class BasePanel extends Panel {\r
-\r
- private static final long serialVersionUID = 1L;\r
-\r
- public BasePanel(String id) {\r
- super(id);\r
- }\r
- \r
- public StringResourceModel stringModel(String key) {\r
- return new StringResourceModel(key, this, null);\r
- }\r
-}\r
+++ /dev/null
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml" \r
- xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" \r
- xml:lang="en" \r
- lang="en"> \r
-\r
-<wicket:panel>\r
- <div class="link">\r
- <a wicket:id="shortlog"><wicket:message key="gb.shortlog"></wicket:message></a> | <a wicket:id="tree"><wicket:message key="gb.tree"></wicket:message></a>\r
- </div> \r
-</wicket:panel>\r
-</html>
\ No newline at end of file
+++ /dev/null
-package com.gitblit.wicket.panels;\r
-\r
-import org.apache.wicket.PageParameters;\r
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
-\r
-import com.gitblit.wicket.models.RefModel;\r
-import com.gitblit.wicket.pages.ShortLogPage;\r
-import com.gitblit.wicket.pages.TreePage;\r
-\r
-public class BranchLinksPanel extends BasePanel {\r
-\r
- private static final long serialVersionUID = 1L;\r
-\r
- public BranchLinksPanel(String id, String repositoryName, RefModel tag) {\r
- super(id);\r
- add(new BookmarkablePageLink<Void>("shortlog", ShortLogPage.class, new PageParameters("p=" + repositoryName + ",h=" + tag.getName())));\r
- add(new BookmarkablePageLink<Void>("tree", TreePage.class, new PageParameters("p=" + repositoryName + ",h=" + tag.getName())));\r
- }\r
-}
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml" \r
+ xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" \r
+ xml:lang="en" \r
+ lang="en"> \r
+\r
+<body>\r
+<wicket:panel>\r
+\r
+ <!-- header -->\r
+ <div class="header" wicket:id="branches">[branches header]</div> \r
+ \r
+ <table style="width:100%;" class="pretty">\r
+ <tbody>\r
+ <tr wicket:id="branch">\r
+ <td class="date"><span wicket:id="branchDate">[branch date]</span></td>\r
+ <td><span wicket:id="branchName">[branch name]</span></td>\r
+ <td><span wicket:id="branchType">[branch type]</span></td>\r
+ <td class="rightAlign">\r
+ <div class="link">\r
+ <a wicket:id="log"><wicket:message key="gb.log"></wicket:message></a> | <a wicket:id="tree"><wicket:message key="gb.tree"></wicket:message></a>\r
+ </div> \r
+ </td>\r
+ </tr>\r
+ </tbody>\r
+ </table> \r
+\r
+ <div wicket:id="allBranches">[all branches]</div> \r
+ \r
+ <!-- spacer -->\r
+ <div style="padding:5px;"></div>\r
+</wicket:panel>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+package com.gitblit.wicket.panels;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Collections;\r
+import java.util.List;\r
+\r
+import org.apache.wicket.markup.html.basic.Label;\r
+import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
+import org.apache.wicket.markup.html.panel.Panel;\r
+import org.apache.wicket.markup.repeater.Item;\r
+import org.apache.wicket.markup.repeater.data.DataView;\r
+import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
+import org.apache.wicket.model.StringResourceModel;\r
+import org.eclipse.jgit.lib.Constants;\r
+import org.eclipse.jgit.lib.Repository;\r
+\r
+import com.gitblit.utils.JGitUtils;\r
+import com.gitblit.wicket.GitBlitWebSession;\r
+import com.gitblit.wicket.LinkPanel;\r
+import com.gitblit.wicket.WicketUtils;\r
+import com.gitblit.wicket.models.RefModel;\r
+import com.gitblit.wicket.pages.BranchesPage;\r
+import com.gitblit.wicket.pages.LogPage;\r
+import com.gitblit.wicket.pages.SummaryPage;\r
+import com.gitblit.wicket.pages.TreePage;\r
+\r
+public class BranchesPanel extends Panel {\r
+\r
+ private static final long serialVersionUID = 1L;\r
+\r
+ public BranchesPanel(String wicketId, final String repositoryName, Repository r, final int maxCount) {\r
+ super(wicketId);\r
+\r
+ // branches\r
+ List<RefModel> branches = new ArrayList<RefModel>();\r
+ branches.addAll(JGitUtils.getLocalBranches(r, maxCount));\r
+ branches.addAll(JGitUtils.getRemoteBranches(r, maxCount));\r
+ Collections.sort(branches);\r
+ Collections.reverse(branches);\r
+ if (maxCount > 0 && branches.size() > maxCount) {\r
+ branches = new ArrayList<RefModel>(branches.subList(0, maxCount));\r
+ }\r
+\r
+ if (maxCount > 0) {\r
+ // summary page\r
+ // show branches page link\r
+ add(new LinkPanel("branches", "title", new StringResourceModel("gb.branches", this, null), BranchesPage.class, WicketUtils.newRepositoryParameter(repositoryName)));\r
+ } else {\r
+ // branches page\r
+ // show repository summary page link\r
+ add(new LinkPanel("branches", "title", repositoryName, SummaryPage.class, WicketUtils.newRepositoryParameter(repositoryName)));\r
+ }\r
+ \r
+ ListDataProvider<RefModel> branchesDp = new ListDataProvider<RefModel>(branches);\r
+ DataView<RefModel> branchesView = new DataView<RefModel>("branch", branchesDp) {\r
+ private static final long serialVersionUID = 1L;\r
+ int counter = 0;\r
+\r
+ public void populateItem(final Item<RefModel> item) {\r
+ final RefModel entry = item.getModelObject();\r
+\r
+ item.add(WicketUtils.createDateLabel("branchDate", entry.getDate(), GitBlitWebSession.get().getTimezone()));\r
+\r
+ item.add(new LinkPanel("branchName", "list name", WicketUtils.trimString(entry.getDisplayName(), 28), LogPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getName())));\r
+ \r
+ // only show branch type on the branches page\r
+ boolean remote = entry.getName().startsWith(Constants.R_REMOTES);\r
+ item.add(new Label("branchType", remote ? getString("gb.remote"):getString("gb.local")).setVisible(maxCount <= 0));\r
+ \r
+ item.add(new BookmarkablePageLink<Void>("log", LogPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getName())));\r
+ item.add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils.newCommitParameter(repositoryName, entry.getName())));\r
+\r
+ WicketUtils.setAlternatingBackground(item, counter);\r
+ counter++;\r
+ }\r
+ };\r
+ add(branchesView);\r
+ if (branches.size() < maxCount || maxCount <= 0) {\r
+ add(new Label("allBranches", "").setVisible(false));\r
+ } else {\r
+ add(new LinkPanel("allBranches", "link", new StringResourceModel("gb.allBranches", this, null), BranchesPage.class, WicketUtils.newRepositoryParameter(repositoryName)));\r
+ }\r
+ }\r
+}\r
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml" \r
+ xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" \r
+ xml:lang="en" \r
+ lang="en"> \r
+\r
+<body>\r
+<wicket:panel>\r
+\r
+ <!-- header --> \r
+ <div class="header" wicket:id="header">[log header]</div>\r
+ \r
+ <table style="width:100%" class="pretty">\r
+ <tbody>\r
+ <tr wicket:id="commit">\r
+ <td class="date"><span wicket:id="commitDate">[commit date]</span></td>\r
+ <td class="author"><span wicket:id="commitAuthor">[commit author]</span></td>\r
+ <td><div wicket:id="commitShortMessage">[commit short message]</div></td>\r
+ <td class="rightAlign"><div wicket:id="commitRefs">[commit refs]</div></td> \r
+ <td class="rightAlign"><div class="link">\r
+ <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>\r
+ </div>\r
+ </td>\r
+ </tr>\r
+ </tbody>\r
+ </table> \r
+ <div class="pager" wicket:id="pageLogs">[pager]</div>\r
+ <div wicket:id="moreLogs">[more...]</div>\r
+ \r
+ <!-- spacer -->\r
+ <div style="padding:5px;"></div>\r
+</wicket:panel>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+package com.gitblit.wicket.panels;\r
+\r
+import java.util.Date;\r
+import java.util.List;\r
+import java.util.Map;\r
+\r
+import org.apache.wicket.markup.html.basic.Label;\r
+import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
+import org.apache.wicket.markup.html.navigation.paging.PagingNavigator;\r
+import org.apache.wicket.markup.html.panel.Panel;\r
+import org.apache.wicket.markup.repeater.Item;\r
+import org.apache.wicket.markup.repeater.data.DataView;\r
+import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
+import org.apache.wicket.model.StringResourceModel;\r
+import org.eclipse.jgit.lib.ObjectId;\r
+import org.eclipse.jgit.lib.Repository;\r
+import org.eclipse.jgit.revwalk.RevCommit;\r
+\r
+import com.gitblit.utils.JGitUtils;\r
+import com.gitblit.wicket.GitBlitWebApp;\r
+import com.gitblit.wicket.GitBlitWebSession;\r
+import com.gitblit.wicket.LinkPanel;\r
+import com.gitblit.wicket.WicketUtils;\r
+import com.gitblit.wicket.pages.CommitPage;\r
+import com.gitblit.wicket.pages.DiffPage;\r
+import com.gitblit.wicket.pages.LogPage;\r
+import com.gitblit.wicket.pages.SummaryPage;\r
+import com.gitblit.wicket.pages.TreePage;\r
+\r
+public class LogPanel extends Panel {\r
+\r
+ private static final long serialVersionUID = 1L;\r
+\r
+ public LogPanel(String wicketId, final String repositoryName, Repository r, int maxCount, boolean showPager) {\r
+ super(wicketId);\r
+\r
+ final Map<ObjectId, List<String>> allRefs = JGitUtils.getAllRefs(r);\r
+ List<RevCommit> commits = JGitUtils.getRevLog(r, maxCount);\r
+\r
+ // header\r
+ if (showPager) {\r
+ // shortlog page\r
+ // show repository summary page link\r
+ add(new LinkPanel("header", "title", repositoryName, SummaryPage.class, WicketUtils.newRepositoryParameter(repositoryName))); \r
+ } else {\r
+ // summary page\r
+ // show shortlog page link\r
+ add(new LinkPanel("header", "title", new StringResourceModel("gb.log", this, null), LogPage.class, WicketUtils.newRepositoryParameter(repositoryName)));\r
+ }\r
+\r
+ ListDataProvider<RevCommit> dp = new ListDataProvider<RevCommit>(commits);\r
+ DataView<RevCommit> logView = new DataView<RevCommit>("commit", dp) {\r
+ private static final long serialVersionUID = 1L;\r
+ int counter = 0;\r
+\r
+ public void populateItem(final Item<RevCommit> item) {\r
+ final RevCommit entry = item.getModelObject();\r
+ final Date date = JGitUtils.getCommitDate(entry);\r
+\r
+ item.add(WicketUtils.createDateLabel("commitDate", date, GitBlitWebSession.get().getTimezone()));\r
+\r
+ String author = entry.getAuthorIdent().getName();\r
+ item.add(WicketUtils.createAuthorLabel("commitAuthor", author));\r
+\r
+ String shortMessage = entry.getShortMessage();\r
+ String trimmedMessage = WicketUtils.trimShortLog(shortMessage);\r
+ LinkPanel shortlog = new LinkPanel("commitShortMessage", "list subject", trimmedMessage, CommitPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getName()));\r
+ if (!shortMessage.equals(trimmedMessage)) {\r
+ WicketUtils.setHtmlTitle(shortlog, shortMessage);\r
+ }\r
+ item.add(shortlog);\r
+\r
+ item.add(new RefsPanel("commitRefs", entry, allRefs));\r
+\r
+ item.add(new BookmarkablePageLink<Void>("view", CommitPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getName())));\r
+ item.add(new BookmarkablePageLink<Void>("diff", DiffPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getName())));\r
+ item.add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils.newCommitParameter(repositoryName, entry.getName())));\r
+\r
+ WicketUtils.setAlternatingBackground(item, counter);\r
+ counter++;\r
+ }\r
+ };\r
+ add(logView);\r
+\r
+ // determine to show pager, more, or neither\r
+ if (maxCount <= 0) {\r
+ // no display limit\r
+ add(new Label("moreLogs", "").setVisible(false));\r
+ add(new Label("pageLogs", "").setVisible(false));\r
+ } else {\r
+ if (commits.size() == maxCount) {\r
+\r
+ }\r
+ if (showPager) {\r
+ // paging\r
+ add(new Label("moreLogs", "").setVisible(false));\r
+ if (commits.size() == maxCount) {\r
+ // show pager\r
+ logView.setItemsPerPage(GitBlitWebApp.PAGING_ITEM_COUNT);\r
+ add(new PagingNavigator("pageLogs", logView));\r
+ } else {\r
+ // nothing to page\r
+ add(new Label("pageLogs", "").setVisible(false));\r
+ }\r
+ } else {\r
+ // more\r
+ add(new Label("pageLogs", "").setVisible(false));\r
+ if (commits.size() == maxCount) {\r
+ // show more\r
+ add(new LinkPanel("moreLogs", "link", new StringResourceModel("gb.moreLogs", this, null), LogPage.class, WicketUtils.newRepositoryParameter(repositoryName)));\r
+ } else {\r
+ // no more\r
+ add(new Label("moreLogs", "").setVisible(false));\r
+ }\r
+ }\r
+ }\r
+ }\r
+}\r
<wicket:panel>\r
<!-- page nav links --> \r
<div class="page_nav">\r
- <a wicket:id="summary"><wicket:message key="gb.summary"></wicket:message></a> | <a wicket:id="shortlog"><wicket:message key="gb.shortlog"></wicket:message></a> | <a wicket:id="branches"><wicket:message key="gb.branches"></wicket:message></a> | <a wicket:id="tags"><wicket:message key="gb.tags"></wicket:message></a> | <a wicket:id="tree"><wicket:message key="gb.tree"></wicket:message></a> <span wicket:id="extra"><span wicket:id="extraSeparator"></span><span wicket:id="extraLink"></span></span>\r
+ <a wicket:id="summary"><wicket:message key="gb.summary"></wicket:message></a> | <a wicket:id="log"><wicket:message key="gb.log"></wicket:message></a> | <a wicket:id="branches"><wicket:message key="gb.branches"></wicket:message></a> | <a wicket:id="tags"><wicket:message key="gb.tags"></wicket:message></a> | <a wicket:id="tree"><wicket:message key="gb.tree"></wicket:message></a> <span wicket:id="extra"><span wicket:id="extraSeparator"></span><span wicket:id="extraLink"></span></span>\r
</div> \r
</wicket:panel>\r
</html>
\ No newline at end of file
import java.util.Map;\r
\r
import org.apache.wicket.Component;\r
-import org.apache.wicket.PageParameters;\r
import org.apache.wicket.markup.html.basic.Label;\r
import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
+import org.apache.wicket.markup.html.panel.Panel;\r
import org.apache.wicket.markup.repeater.Item;\r
import org.apache.wicket.markup.repeater.data.DataView;\r
import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
\r
import com.gitblit.utils.JGitUtils;\r
import com.gitblit.wicket.LinkPanel;\r
+import com.gitblit.wicket.WicketUtils;\r
import com.gitblit.wicket.pages.BranchesPage;\r
-import com.gitblit.wicket.pages.ShortLogPage;\r
+import com.gitblit.wicket.pages.LogPage;\r
import com.gitblit.wicket.pages.SummaryPage;\r
import com.gitblit.wicket.pages.TagsPage;\r
import com.gitblit.wicket.pages.TicGitPage;\r
import com.gitblit.wicket.pages.TreePage;\r
\r
-public class PageLinksPanel extends BasePanel {\r
+public class PageLinksPanel extends Panel {\r
\r
private static final long serialVersionUID = 1L;\r
\r
\r
{\r
put("summary", "gb.summary");\r
- put("shortlog", "gb.shortlog");\r
+ put("log", "gb.log");\r
put("branches", "gb.branches");\r
put("tags", "gb.tags");\r
put("tree", "gb.tree");\r
super(id);\r
\r
// summary\r
- add(new BookmarkablePageLink<Void>("summary", SummaryPage.class, new PageParameters("p=" + repositoryName)));\r
- add(new BookmarkablePageLink<Void>("shortlog", ShortLogPage.class, new PageParameters("p=" + repositoryName)));\r
- add(new BookmarkablePageLink<Void>("branches", BranchesPage.class, new PageParameters("p=" + repositoryName)));\r
- add(new BookmarkablePageLink<Void>("tags", TagsPage.class, new PageParameters("p=" + repositoryName)));\r
- add(new BookmarkablePageLink<Void>("tree", TreePage.class, new PageParameters("p=" + repositoryName + ",h=HEAD")));\r
+ add(new BookmarkablePageLink<Void>("summary", SummaryPage.class, WicketUtils.newRepositoryParameter(repositoryName)));\r
+ add(new BookmarkablePageLink<Void>("log", LogPage.class, WicketUtils.newRepositoryParameter(repositoryName)));\r
+ add(new BookmarkablePageLink<Void>("branches", BranchesPage.class, WicketUtils.newRepositoryParameter(repositoryName)));\r
+ add(new BookmarkablePageLink<Void>("tags", TagsPage.class, WicketUtils.newRepositoryParameter(repositoryName)));\r
+ add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils.newRepositoryParameter(repositoryName)));\r
\r
// Add dynamic repository extras\r
List<String> extras = new ArrayList<String>();\r
String extra = item.getModelObject();\r
if (extra.equals("ticgit")) {\r
item.add(new Label("extraSeparator", " | "));\r
- item.add(new LinkPanel("extraLink", null, "ticgit", TicGitPage.class, new PageParameters("p=" + repositoryName)));\r
+ item.add(new LinkPanel("extraLink", null, "ticgit", TicGitPage.class, WicketUtils.newRepositoryParameter(repositoryName)));\r
}\r
}\r
};\r
String key = knownPages.get(wicketId);\r
String linkName = getString(key);\r
if (linkName.equals(pageName)) {\r
- Component c = get(wicketId);\r
- c.setEnabled(false);\r
+ Component c = get(wicketId); \r
+ if (c != null) {\r
+ c.setEnabled(false);\r
+ }\r
break;\r
}\r
}\r
import java.util.ArrayList;\r
import java.util.List;\r
\r
-import org.apache.wicket.PageParameters;\r
import org.apache.wicket.markup.html.basic.Label;\r
import org.apache.wicket.markup.html.panel.Panel;\r
import org.apache.wicket.markup.repeater.Item;\r
import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
\r
import com.gitblit.wicket.LinkPanel;\r
+import com.gitblit.wicket.WicketUtils;\r
import com.gitblit.wicket.pages.TreePage;\r
\r
public class PathBreadcrumbsPanel extends Panel {\r
parameters += ",f=" + path;\r
}\r
\r
- item.add(new LinkPanel("pathLink", null, entry.name, TreePage.class, new PageParameters(parameters)));\r
+ item.add(new LinkPanel("pathLink", null, entry.name, TreePage.class, WicketUtils.newPathParameter(repositoryName, commitId, path)));\r
item.add(new Label("pathSeparator", entry.isLeaf ? "" : "/"));\r
}\r
};\r
+++ /dev/null
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml" \r
- xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" \r
- xml:lang="en" \r
- lang="en"> \r
-\r
-<wicket:panel>\r
- <div class="link">\r
- <a wicket:id="diff"><wicket:message key="gb.diff"></wicket:message></a> | <a wicket:id="view"><wicket:message key="gb.view"></wicket:message></a> | <a wicket:id="history"><wicket:message key="gb.history"></wicket:message></a>\r
- </div> \r
-</wicket:panel>\r
-</html>
\ No newline at end of file
+++ /dev/null
-package com.gitblit.wicket.panels;\r
-\r
-import org.apache.wicket.PageParameters;\r
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
-\r
-import com.gitblit.wicket.models.PathModel;\r
-import com.gitblit.wicket.pages.BlobPage;\r
-import com.gitblit.wicket.pages.DiffPage;\r
-\r
-\r
-public class PathLinksPanel extends BasePanel {\r
-\r
- private static final long serialVersionUID = 1L;\r
-\r
- public PathLinksPanel(String id, String repositoryName, PathModel path) {\r
- super(id);\r
- add(new BookmarkablePageLink<Void>("diff", DiffPage.class, new PageParameters("p=" + repositoryName + ",h=" + path.commitId + ",f=" + path.path)));\r
- add(new BookmarkablePageLink<Void>("view", BlobPage.class, new PageParameters("p=" + repositoryName + ",h=" + path.commitId + ",f=" + path.path)));\r
- add(new BookmarkablePageLink<Void>("history", BlobPage.class, new PageParameters()).setEnabled(false));\r
- }\r
-}
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml" \r
- xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" \r
- xml:lang="en" \r
- lang="en"> \r
-\r
-<wicket:panel>\r
- <div class="link">\r
- <a wicket:id="commit"><wicket:message key="gb.commit"></wicket:message></a> | <a wicket:id="commitdiff"><wicket:message key="gb.commitdiff"></wicket:message></a> | <a wicket:id="tree"><wicket:message key="gb.tree"></wicket:message></a>\r
- </div> \r
-</wicket:panel>\r
-</html>
\ No newline at end of file
+++ /dev/null
-package com.gitblit.wicket.panels;\r
-\r
-import org.apache.wicket.PageParameters;\r
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
-\r
-import com.gitblit.wicket.pages.CommitPage;\r
-import com.gitblit.wicket.pages.DiffPage;\r
-import com.gitblit.wicket.pages.TreePage;\r
-\r
-\r
-public class ShortLogLinksPanel extends BasePanel {\r
-\r
- private static final long serialVersionUID = 1L;\r
-\r
- public ShortLogLinksPanel(String id, String repositoryName, String commitId) {\r
- super(id);\r
-\r
- add(new BookmarkablePageLink<Void>("commit", CommitPage.class, new PageParameters("p=" + repositoryName + ",h=" + commitId)));\r
- add(new BookmarkablePageLink<Void>("commitdiff", DiffPage.class, new PageParameters("p=" + repositoryName + ",h=" + commitId)));\r
- add(new BookmarkablePageLink<Void>("tree", TreePage.class, new PageParameters("p=" + repositoryName + ",h=" + commitId)));\r
- }\r
-}
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml" \r
- xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" \r
- xml:lang="en" \r
- lang="en"> \r
-\r
-<wicket:panel>\r
- <div class="link">\r
- <a wicket:id="commit"><wicket:message key="gb.commit"></wicket:message></a> | <a wicket:id="shortlog"><wicket:message key="gb.shortlog"></wicket:message></a>\r
- </div> \r
-</wicket:panel>\r
-</html>
\ No newline at end of file
+++ /dev/null
-package com.gitblit.wicket.panels;\r
-\r
-import org.apache.wicket.PageParameters;\r
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
-\r
-import com.gitblit.wicket.models.RefModel;\r
-import com.gitblit.wicket.pages.CommitPage;\r
-import com.gitblit.wicket.pages.ShortLogPage;\r
-\r
-\r
-public class TagLinksPanel extends BasePanel {\r
-\r
- private static final long serialVersionUID = 1L;\r
-\r
- public TagLinksPanel(String id, String repositoryName, RefModel tag) {\r
- super(id);\r
- add(new BookmarkablePageLink<Void>("commit", CommitPage.class, new PageParameters("p=" + repositoryName + ",h=" + tag.getCommitId().getName())));\r
- add(new BookmarkablePageLink<Void>("shortlog", ShortLogPage.class, new PageParameters("p=" + repositoryName + ",h=" + tag.getName())));\r
- }\r
-}
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml" \r
+ xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" \r
+ xml:lang="en" \r
+ lang="en"> \r
+\r
+<body>\r
+<wicket:panel>\r
+\r
+ <!-- tags -->\r
+ <div class="header" wicket:id="header">[tags header]</div> \r
+ <table style="width:100%" class="pretty">\r
+ <tbody>\r
+ <tr wicket:id="tag">\r
+ <td class="date"><span wicket:id="tagDate">[tag date]</span></td>\r
+ <td><b><span wicket:id="tagName">[tag name]</span></b></td>\r
+ <td><span wicket:id="tagDescription">[tag description]</span></td>\r
+ <td class="rightAlign">\r
+ <div class="link">\r
+ <a wicket:id="view"><wicket:message key="gb.view"></wicket:message></a> | <a wicket:id="commit"><wicket:message key="gb.commit"></wicket:message></a> | <a wicket:id="log"><wicket:message key="gb.log"></wicket:message></a>\r
+ </div>\r
+ </td>\r
+ </tr>\r
+ </tbody>\r
+ </table>\r
+ \r
+ <div wicket:id="allTags">[all tags]</div> \r
+ \r
+ <!-- spacer -->\r
+ <div style="padding:5px;"></div>\r
+</wicket:panel>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+package com.gitblit.wicket.panels;\r
+\r
+import java.util.List;\r
+\r
+import org.apache.wicket.markup.html.basic.Label;\r
+import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
+import org.apache.wicket.markup.html.panel.Panel;\r
+import org.apache.wicket.markup.repeater.Item;\r
+import org.apache.wicket.markup.repeater.data.DataView;\r
+import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
+import org.apache.wicket.model.StringResourceModel;\r
+import org.eclipse.jgit.lib.Repository;\r
+\r
+import com.gitblit.utils.JGitUtils;\r
+import com.gitblit.wicket.GitBlitWebSession;\r
+import com.gitblit.wicket.LinkPanel;\r
+import com.gitblit.wicket.WicketUtils;\r
+import com.gitblit.wicket.models.RefModel;\r
+import com.gitblit.wicket.pages.CommitPage;\r
+import com.gitblit.wicket.pages.LogPage;\r
+import com.gitblit.wicket.pages.SummaryPage;\r
+import com.gitblit.wicket.pages.TagPage;\r
+import com.gitblit.wicket.pages.TagsPage;\r
+\r
+public class TagsPanel extends Panel {\r
+\r
+ private static final long serialVersionUID = 1L;\r
+\r
+ public TagsPanel(String wicketId, final String repositoryName, Repository r, final int maxCount) {\r
+ super(wicketId);\r
+\r
+ // header\r
+ List<RefModel> tags = JGitUtils.getTags(r, maxCount);\r
+ if (maxCount > 0) {\r
+ // summary page\r
+ // show tags page link\r
+ add(new LinkPanel("header", "title", new StringResourceModel("gb.tags", this, null), TagsPage.class, WicketUtils.newRepositoryParameter(repositoryName)));\r
+ } else {\r
+ // tags page\r
+ // show repository summary page link\r
+ add(new LinkPanel("header", "title", repositoryName, SummaryPage.class, WicketUtils.newRepositoryParameter(repositoryName)));\r
+ }\r
+\r
+ ListDataProvider<RefModel> tagsDp = new ListDataProvider<RefModel>(tags);\r
+ DataView<RefModel> tagView = new DataView<RefModel>("tag", tagsDp) {\r
+ private static final long serialVersionUID = 1L;\r
+ int counter = 0;\r
+\r
+ public void populateItem(final Item<RefModel> item) {\r
+ RefModel entry = item.getModelObject();\r
+\r
+ item.add(WicketUtils.createDateLabel("tagDate", entry.getDate(), GitBlitWebSession.get().getTimezone()));\r
+\r
+ item.add(new LinkPanel("tagName", "list name", entry.getDisplayName(), CommitPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getCommitId().getName())));\r
+ String message;\r
+ if (maxCount > 0) {\r
+ message = WicketUtils.trimString(entry.getShortLog(), 40);\r
+ } else {\r
+ message = entry.getShortLog();\r
+ }\r
+ if (entry.isAnnotatedTag()) {\r
+ item.add(new LinkPanel("tagDescription", "list subject", message, TagPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getObjectId().getName())));\r
+ } else {\r
+ item.add(new LinkPanel("tagDescription", "list subject", message, CommitPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getObjectId().getName())));\r
+ }\r
+ item.add(new BookmarkablePageLink<Void>("view", TagPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getObjectId().getName())).setEnabled(entry.isAnnotatedTag()));\r
+ item.add(new BookmarkablePageLink<Void>("commit", CommitPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getCommitId().getName())));\r
+ item.add(new BookmarkablePageLink<Void>("log", LogPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getName())));\r
+\r
+ WicketUtils.setAlternatingBackground(item, counter);\r
+ counter++;\r
+ }\r
+ };\r
+ add(tagView);\r
+ if (tags.size() < maxCount || maxCount <= 0) {\r
+ add(new Label("allTags", "").setVisible(false));\r
+ } else {\r
+ add(new LinkPanel("allTags", "link", new StringResourceModel("gb.allTags", this, null), TagsPage.class, WicketUtils.newRepositoryParameter(repositoryName)));\r
+ }\r
+ }\r
+}\r
package com.gitblit.wicket.panels;\r
\r
-import org.apache.wicket.PageParameters;\r
import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
+import org.apache.wicket.markup.html.panel.Panel;\r
\r
+import com.gitblit.wicket.WicketUtils;\r
import com.gitblit.wicket.models.PathModel;\r
import com.gitblit.wicket.pages.BlobPage;\r
\r
\r
-public class TreeBlobLinksPanel extends BasePanel {\r
+public class TreeBlobLinksPanel extends Panel {\r
\r
private static final long serialVersionUID = 1L;\r
\r
public TreeBlobLinksPanel(String id, String repositoryName, PathModel path) {\r
super(id);\r
- add(new BookmarkablePageLink<Void>("view", BlobPage.class, new PageParameters("p=" + repositoryName + ",h=" + path.commitId + ",f=" + path.path)));\r
- add(new BookmarkablePageLink<Void>("raw", BlobPage.class, new PageParameters()).setEnabled(false));\r
- add(new BookmarkablePageLink<Void>("history", BlobPage.class, new PageParameters()).setEnabled(false));\r
+ add(new BookmarkablePageLink<Void>("view", BlobPage.class, WicketUtils.newPathParameter(repositoryName, path.commitId, path.path)));\r
+ add(new BookmarkablePageLink<Void>("raw", BlobPage.class).setEnabled(false));\r
+ add(new BookmarkablePageLink<Void>("history", BlobPage.class).setEnabled(false));\r
}\r
}
\ No newline at end of file
package com.gitblit.wicket.panels;\r
\r
-import org.apache.wicket.PageParameters;\r
import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
+import org.apache.wicket.markup.html.panel.Panel;\r
\r
+import com.gitblit.wicket.WicketUtils;\r
import com.gitblit.wicket.models.PathModel;\r
import com.gitblit.wicket.pages.TreePage;\r
\r
\r
-public class TreeLinksPanel extends BasePanel {\r
+public class TreeLinksPanel extends Panel {\r
\r
private static final long serialVersionUID = 1L;\r
\r
public TreeLinksPanel(String id, String repositoryName, PathModel path) {\r
super(id);\r
- add(new BookmarkablePageLink<Void>("tree", TreePage.class, new PageParameters("p=" + repositoryName + ",h=" + path.commitId + ",f=" + path.path)));\r
- add(new BookmarkablePageLink<Void>("history", TreePage.class, new PageParameters()).setEnabled(false));\r
+ add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils.newPathParameter(repositoryName, path.commitId, path.path)));\r
+ add(new BookmarkablePageLink<Void>("history", TreePage.class).setEnabled(false));\r
}\r
}
\ No newline at end of file
font-size: inherit;\r
}\r
\r
+div.link em, div.link span em {\r
+ font-style: normal;\r
+ font-family: inherit;\r
+ font-size: inherit;\r
+}\r
+\r
div.page_header {\r
height: 25px;\r
padding: 5px;\r
text-decoration: underline;\r
}\r
\r
+div.page_nav em {\r
+ font-style: normal;\r
+}\r
+\r
div.page_nav2 {\r
padding: 2px 5px 7px 5px; \r
}\r