@@ -8,6 +8,7 @@ import java.text.DateFormat; | |||
import java.text.ParseException; | |||
import java.text.SimpleDateFormat; | |||
import java.util.ArrayList; | |||
import java.util.Collection; | |||
import java.util.Collections; | |||
import java.util.Date; | |||
import java.util.HashMap; | |||
@@ -43,8 +44,10 @@ import org.eclipse.jgit.revwalk.RevWalk; | |||
import org.eclipse.jgit.revwalk.filter.RevFilter; | |||
import org.eclipse.jgit.treewalk.TreeWalk; | |||
import org.eclipse.jgit.treewalk.filter.AndTreeFilter; | |||
import org.eclipse.jgit.treewalk.filter.OrTreeFilter; | |||
import org.eclipse.jgit.treewalk.filter.PathFilter; | |||
import org.eclipse.jgit.treewalk.filter.PathFilterGroup; | |||
import org.eclipse.jgit.treewalk.filter.PathSuffixFilter; | |||
import org.eclipse.jgit.treewalk.filter.TreeFilter; | |||
import org.eclipse.jgit.util.io.DisabledOutputStream; | |||
import org.slf4j.Logger; | |||
@@ -352,6 +355,42 @@ public class JGitUtils { | |||
} | |||
return list; | |||
} | |||
public static List<PathModel> getDocuments(Repository r, List<String> extensions) { | |||
List<PathModel> list = new ArrayList<PathModel>(); | |||
RevCommit commit = getCommit(r, Constants.HEAD); | |||
final TreeWalk walk = new TreeWalk(r); | |||
try { | |||
walk.addTree(commit.getTree()); | |||
if (extensions != null && extensions.size() > 0) { | |||
Collection<TreeFilter> suffixFilters = new ArrayList<TreeFilter>(); | |||
for (String extension:extensions) { | |||
if (extension.charAt(0) == '.') { | |||
suffixFilters.add(PathSuffixFilter.create(extension)); | |||
} else { | |||
// escape the . since this is a regexp filter | |||
suffixFilters.add(PathSuffixFilter.create("\\." + extension)); | |||
} | |||
} | |||
TreeFilter filter = OrTreeFilter.create(suffixFilters); | |||
walk.setFilter(filter); | |||
walk.setRecursive(true); | |||
while (walk.next()) { | |||
list.add(getPathModel(walk, null, commit)); | |||
} | |||
} else { | |||
while (walk.next()) { | |||
list.add(getPathModel(walk, null, commit)); | |||
} | |||
} | |||
} catch (IOException e) { | |||
LOGGER.error("Failed to get files for commit " + commit.getName(), e); | |||
} finally { | |||
walk.release(); | |||
} | |||
Collections.sort(list); | |||
return list; | |||
} | |||
public static Map<ChangeType, AtomicInteger> getChangedPathsStats(List<PathChangeModel> paths) { | |||
Map<ChangeType, AtomicInteger> stats = new HashMap<ChangeType, AtomicInteger>(); | |||
@@ -895,10 +934,6 @@ public class JGitUtils { | |||
return metrics; | |||
} | |||
public static RefModel getDocumentsBranch(Repository r) { | |||
return getTicketsBranch(r); | |||
} | |||
public static RefModel getTicketsBranch(Repository r) { | |||
RefModel ticgitBranch = null; | |||
try { |
@@ -21,7 +21,8 @@ | |||
<img src="resources/gitblt_25.png" width="79" height="25" alt="gitblit" class="logo"/> | |||
</wicket:link> | |||
</a> | |||
<a href="/"><span wicket:id="siteName">[site name]</span></a> / <span wicket:id="repositoryName">[repository name]</span> <span wicket:id="pageName">[page name]</span> | |||
<a href="/"><span wicket:id="siteName">[site name]</span></a> / <span wicket:id="repositoryName">[repository name]</span> <span wicket:id="pageName">[page name]</span> | |||
<div style="float:none;" wicket:id="feedback">[Feedback Panel]</div> | |||
</div> | |||
<!-- page content --> |
@@ -7,6 +7,7 @@ import javax.servlet.http.HttpServletRequest; | |||
import org.apache.wicket.PageParameters; | |||
import org.apache.wicket.markup.html.WebPage; | |||
import org.apache.wicket.markup.html.basic.Label; | |||
import org.apache.wicket.markup.html.panel.FeedbackPanel; | |||
import org.apache.wicket.protocol.http.servlet.ServletWebRequest; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
@@ -45,6 +46,9 @@ public abstract class BasePage extends WebPage { | |||
add(new LinkPanel("repositoryName", null, repositoryName, SummaryPage.class, WicketUtils.newRepositoryParameter(repositoryName))); | |||
add(new Label("pageName", pageName)); | |||
// Feedback panel for info, warning, and non-fatal error messages | |||
add(new FeedbackPanel("feedback")); | |||
// footer | |||
if (GitBlit.self().settings().getBoolean(Keys.web.authenticateViewPages, true) | |||
|| GitBlit.self().settings().getBoolean(Keys.web.authenticateAdminPages, true)) { |
@@ -15,6 +15,7 @@ import com.gitblit.wicket.pages.BlobPage; | |||
import com.gitblit.wicket.pages.BranchesPage; | |||
import com.gitblit.wicket.pages.CommitDiffPage; | |||
import com.gitblit.wicket.pages.CommitPage; | |||
import com.gitblit.wicket.pages.DocsPage; | |||
import com.gitblit.wicket.pages.HistoryPage; | |||
import com.gitblit.wicket.pages.LogPage; | |||
import com.gitblit.wicket.pages.MarkdownPage; | |||
@@ -69,6 +70,7 @@ public class GitBlitWebApp extends WebApplication { | |||
mount(new MixedParamUrlCodingStrategy("/ticket", TicketPage.class, new String[] { "r", "h", "f" })); | |||
// setup the markdown urls | |||
mount(new MixedParamUrlCodingStrategy("/docs", DocsPage.class, new String[] { "r" })); | |||
mount(new MixedParamUrlCodingStrategy("/markdown", MarkdownPage.class, new String[] { "r", "h", "f" })); | |||
// setup login/logout urls, if we are using authentication |
@@ -70,4 +70,9 @@ gb.searchTooltip = Search Git:Blit | |||
gb.rename = rename | |||
gb.delete = delete | |||
gb.docs = docs | |||
gb.restrictedAccess = restricted access | |||
gb.restrictedAccess = restricted access | |||
gb.name = name | |||
gb.group = group | |||
gb.description = description | |||
gb.enableTickets = enable tickets | |||
gb.enableDocs = enable docs |
@@ -3,6 +3,7 @@ package com.gitblit.wicket; | |||
import java.text.DateFormat; | |||
import java.text.SimpleDateFormat; | |||
import java.util.Date; | |||
import java.util.List; | |||
import java.util.TimeZone; | |||
import org.apache.wicket.Component; | |||
@@ -83,10 +84,55 @@ public class WicketUtils { | |||
return label; | |||
} | |||
public static ContextImage getFileImage(String wicketId, String filename) { | |||
filename = filename.toLowerCase(); | |||
if (filename.endsWith(".java")) { | |||
return newImage(wicketId, "file_java_16x16.png"); | |||
} else if (filename.endsWith(".rb")) { | |||
return newImage(wicketId, "file_ruby_16x16.png"); | |||
} else if (filename.endsWith(".php")) { | |||
return newImage(wicketId, "file_php_16x16.png"); | |||
} else if (filename.endsWith(".cs")) { | |||
return newImage(wicketId, "file_cs_16x16.png"); | |||
} else if (filename.endsWith(".cpp")) { | |||
return newImage(wicketId, "file_cpp_16x16.png"); | |||
} else if (filename.endsWith(".c")) { | |||
return newImage(wicketId, "file_c_16x16.png"); | |||
} else if (filename.endsWith(".h")) { | |||
return newImage(wicketId, "file_h_16x16.png"); | |||
} else if (filename.endsWith(".sln")) { | |||
return newImage(wicketId, "file_vs_16x16.png"); | |||
} else if (filename.endsWith(".csv") || filename.endsWith(".xls") || filename.endsWith(".xlsx")) { | |||
return newImage(wicketId, "file_excel_16x16.png"); | |||
} else if (filename.endsWith(".doc") || filename.endsWith(".docx")) { | |||
return newImage(wicketId, "file_word_16x16.png"); | |||
} else if (filename.endsWith(".ppt")) { | |||
return newImage(wicketId, "file_ppt_16x16.png"); | |||
} else if (filename.endsWith(".zip")) { | |||
return newImage(wicketId, "file_zip_16x16.png"); | |||
} else if (filename.endsWith(".pdf")) { | |||
return newImage(wicketId, "file_acrobat_16x16.png"); | |||
} else if (filename.endsWith(".htm") || filename.endsWith(".html")) { | |||
return newImage(wicketId, "file_world_16x16.png"); | |||
} else if (filename.endsWith(".xml")) { | |||
return newImage(wicketId, "file_code_16x16.png"); | |||
} else if (filename.endsWith(".properties")) { | |||
return newImage(wicketId, "file_settings_16x16.png"); | |||
} | |||
List<String> mdExtensions = GitBlit.self().settings().getStrings(Keys.web.markdownExtensions); | |||
for (String ext : mdExtensions) { | |||
if (filename.endsWith('.' + ext.toLowerCase())) { | |||
return newImage(wicketId, "file_world_16x16.png"); | |||
} | |||
} | |||
return newImage(wicketId, "file_16x16.png"); | |||
} | |||
public static ContextImage newClearPixel(String wicketId) { | |||
return newImage(wicketId, "pixel.png"); | |||
} | |||
public static ContextImage newBlankImage(String wicketId) { | |||
return newImage(wicketId, "blank.png"); | |||
} | |||
@@ -102,7 +148,7 @@ public class WicketUtils { | |||
} | |||
return img; | |||
} | |||
public static ContextRelativeResource getResource(String file) { | |||
return new ContextRelativeResource("/com/gitblit/wicket/resources/" + file); | |||
} |
@@ -15,8 +15,8 @@ | |||
<span wicket:id="blameLink">[blame link]</span> | <a wicket:id="historyLink"><wicket:message key="gb.history"></wicket:message></a> | <a wicket:id="patchLink"><wicket:message key="gb.patch"></wicket:message></a> | <a wicket:id="commitLink"><wicket:message key="gb.commit"></wicket:message></a> | <a wicket:id="commitDiffLink"><wicket:message key="gb.commitdiff"></wicket:message></a> | |||
</div> | |||
<!-- shortlog header --> | |||
<div class="header" wicket:id="shortlog">[shortlog header]</div> | |||
<!-- commit header --> | |||
<div wicket:id="commitHeader">[commit header]</div> | |||
<!-- breadcrumbs --> | |||
<div wicket:id="breadcrumbs">[breadcrumbs]</div> |
@@ -11,9 +11,9 @@ import com.gitblit.Keys; | |||
import com.gitblit.utils.JGitUtils; | |||
import com.gitblit.utils.JGitUtils.DiffOutputType; | |||
import com.gitblit.utils.StringUtils; | |||
import com.gitblit.wicket.LinkPanel; | |||
import com.gitblit.wicket.RepositoryPage; | |||
import com.gitblit.wicket.WicketUtils; | |||
import com.gitblit.wicket.panels.CommitHeaderPanel; | |||
import com.gitblit.wicket.panels.PathBreadcrumbsPanel; | |||
public class BlobDiffPage extends RepositoryPage { | |||
@@ -48,7 +48,7 @@ public class BlobDiffPage extends RepositoryPage { | |||
add(new Label("blameLink", getString("gb.blame"))); | |||
add(new BookmarkablePageLink<Void>("historyLink", HistoryPage.class, WicketUtils.newPathParameter(repositoryName, objectId, blobPath))); | |||
add(new LinkPanel("shortlog", "title", commit.getShortMessage(), CommitPage.class, newCommitParameter())); | |||
add(new CommitHeaderPanel("commitHeader", repositoryName, commit)); | |||
add(new PathBreadcrumbsPanel("breadcrumbs", repositoryName, blobPath, objectId)); | |||
@@ -24,8 +24,8 @@ | |||
<span wicket:id="blameLink">[blame link]</span> | <a wicket:id="historyLink"><wicket:message key="gb.history"></wicket:message></a> | <a wicket:id="rawLink"><wicket:message key="gb.raw"></wicket:message></a> | <a wicket:id="headLink"><wicket:message key="gb.head"></wicket:message></a> | |||
</div> | |||
<!-- shortlog header --> | |||
<div class="header" wicket:id="shortlog">[shortlog header]</div> | |||
<!-- commit header --> | |||
<div wicket:id="commitHeader">[commit header]</div> | |||
<!-- breadcrumbs --> | |||
<div wicket:id="breadcrumbs">[breadcrumbs]</div> |
@@ -14,9 +14,9 @@ import org.eclipse.jgit.revwalk.RevCommit; | |||
import com.gitblit.GitBlit; | |||
import com.gitblit.Keys; | |||
import com.gitblit.utils.JGitUtils; | |||
import com.gitblit.wicket.LinkPanel; | |||
import com.gitblit.wicket.RepositoryPage; | |||
import com.gitblit.wicket.WicketUtils; | |||
import com.gitblit.wicket.panels.CommitHeaderPanel; | |||
import com.gitblit.wicket.panels.PathBreadcrumbsPanel; | |||
public class BlobPage extends RepositoryPage { | |||
@@ -49,7 +49,7 @@ public class BlobPage extends RepositoryPage { | |||
add(new BookmarkablePageLink<Void>("rawLink", RawPage.class, WicketUtils.newPathParameter(repositoryName, objectId, blobPath))); | |||
add(new BookmarkablePageLink<Void>("headLink", BlobPage.class, WicketUtils.newPathParameter(repositoryName, Constants.HEAD, blobPath))); | |||
add(new LinkPanel("shortlog", "title", commit.getShortMessage(), CommitPage.class, newCommitParameter())); | |||
add(new CommitHeaderPanel("commitHeader", repositoryName, commit)); | |||
add(new PathBreadcrumbsPanel("breadcrumbs", repositoryName, blobPath, objectId)); | |||
@@ -14,14 +14,17 @@ | |||
<div class="page_nav2"> | |||
<wicket:message key="gb.parent"></wicket:message>: <span wicket:id="parentLink">[parent link]</span> | <a wicket:id="patchLink"><wicket:message key="gb.patch"></wicket:message></a> | <a wicket:id="commitLink"><wicket:message key="gb.commit"></wicket:message></a> | |||
</div> | |||
<!-- commit legend --> | |||
<div style="text-align:right;" wicket:id="commitLegend"></div> | |||
<!-- shortlog header --> | |||
<div class="header" wicket:id="shortlog">[shortlog header]</div> | |||
<!-- commit header --> | |||
<div wicket:id="commitHeader">[commit header]</div> | |||
<!-- changed paths --> | |||
<div style="padding-top:15px;"> | |||
<!-- commit legend --> | |||
<div style="text-align:right;" wicket:id="commitLegend"></div> | |||
<div class="header"><wicket:message key="gb.changedFiles">[changed files]</wicket:message></div> | |||
</div> | |||
<table class="pretty"> | |||
<tr wicket:id="changedPath"> | |||
<td class="changeType"><span wicket:id="changeType">[change type]</span></td> |
@@ -20,6 +20,7 @@ import com.gitblit.wicket.LinkPanel; | |||
import com.gitblit.wicket.RepositoryPage; | |||
import com.gitblit.wicket.WicketUtils; | |||
import com.gitblit.wicket.models.PathModel.PathChangeModel; | |||
import com.gitblit.wicket.panels.CommitHeaderPanel; | |||
import com.gitblit.wicket.panels.CommitLegendPanel; | |||
public class CommitDiffPage extends RepositoryPage { | |||
@@ -48,7 +49,7 @@ public class CommitDiffPage extends RepositoryPage { | |||
add(new BookmarkablePageLink<Void>("patchLink", PatchPage.class, WicketUtils.newObjectParameter(repositoryName, objectId))); | |||
add(new BookmarkablePageLink<Void>("commitLink", CommitPage.class, WicketUtils.newObjectParameter(repositoryName, objectId))); | |||
add(new LinkPanel("shortlog", "title", commit.getShortMessage(), CommitPage.class, newCommitParameter())); | |||
add(new CommitHeaderPanel("commitHeader", repositoryName, commit)); | |||
// changed paths list | |||
List<PathChangeModel> paths = JGitUtils.getFilesInCommit(r, commit); |
@@ -15,8 +15,8 @@ | |||
<wicket:message key="gb.parent"></wicket:message>: <span wicket:id="parentLink">[parent link]</span> | <a wicket:id="patchLink"><wicket:message key="gb.patch"></wicket:message></a> | <span wicket:id="commitdiffLink">[commitdiff link]</span> | |||
</div> | |||
<!-- shortlog header --> | |||
<div class="header" wicket:id="shortlog">[shortlog header]</div> | |||
<!-- commit header --> | |||
<div wicket:id="commitHeader">[commit header]</div> | |||
<!-- commit info --> | |||
<table class="plain"> |
@@ -19,6 +19,7 @@ import com.gitblit.wicket.LinkPanel; | |||
import com.gitblit.wicket.RepositoryPage; | |||
import com.gitblit.wicket.WicketUtils; | |||
import com.gitblit.wicket.models.PathModel.PathChangeModel; | |||
import com.gitblit.wicket.panels.CommitHeaderPanel; | |||
import com.gitblit.wicket.panels.CommitLegendPanel; | |||
public class CommitPage extends RepositoryPage { | |||
@@ -46,7 +47,7 @@ public class CommitPage extends RepositoryPage { | |||
} | |||
add(new BookmarkablePageLink<Void>("patchLink", PatchPage.class, WicketUtils.newObjectParameter(repositoryName, objectId))); | |||
add(new LinkPanel("shortlog", "title", c.getShortMessage(), CommitDiffPage.class, WicketUtils.newObjectParameter(repositoryName, objectId))); | |||
add(new CommitHeaderPanel("commitHeader", repositoryName, c)); | |||
addRefs(r, c); | |||
@@ -0,0 +1,31 @@ | |||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |||
<html xmlns="http://www.w3.org/1999/xhtml" | |||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" | |||
xml:lang="en" | |||
lang="en"> | |||
<body> | |||
<wicket:extend> | |||
<!-- page nav links --> | |||
<div wicket:id="pageLinks">[page links]</div> | |||
<!-- header --> | |||
<div style="margin-top:5px;" class="header"><span wicket:id="header">[header]</span></div> | |||
<!-- documents --> | |||
<table style="width:100%" class="pretty"> | |||
<tr wicket:id="document"> | |||
<td class="icon"><img wicket:id="docIcon" /></td> | |||
<td><span wicket:id="docName"></span></td> | |||
<td class="size"><span wicket:id="docSize">[doc size]</span></td> | |||
<td class="treeLinks"> | |||
<span class="link"> | |||
<a wicket:id="view"><wicket:message key="gb.view"></wicket:message></a> | <a wicket:id="raw"><wicket:message key="gb.raw"></wicket:message></a> | <a wicket:id="blame"><wicket:message key="gb.blame"></wicket:message></a> | <a wicket:id="history"><wicket:message key="gb.history"></wicket:message></a> | |||
</span> | |||
</td> | |||
</tr> | |||
</table> | |||
</wicket:extend> | |||
</body> | |||
</html> |
@@ -0,0 +1,63 @@ | |||
package com.gitblit.wicket.pages; | |||
import java.util.List; | |||
import org.apache.wicket.PageParameters; | |||
import org.apache.wicket.markup.html.basic.Label; | |||
import org.apache.wicket.markup.html.link.BookmarkablePageLink; | |||
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.Repository; | |||
import com.gitblit.GitBlit; | |||
import com.gitblit.Keys; | |||
import com.gitblit.utils.ByteFormat; | |||
import com.gitblit.utils.JGitUtils; | |||
import com.gitblit.wicket.LinkPanel; | |||
import com.gitblit.wicket.RepositoryPage; | |||
import com.gitblit.wicket.WicketUtils; | |||
import com.gitblit.wicket.models.PathModel; | |||
public class DocsPage extends RepositoryPage { | |||
public DocsPage(PageParameters params) { | |||
super(params); | |||
Repository r = getRepository(); | |||
List<String> extensions = GitBlit.self().settings().getStrings(Keys.web.markdownExtensions); | |||
List<PathModel> paths = JGitUtils.getDocuments(r, extensions); | |||
final ByteFormat byteFormat = new ByteFormat(); | |||
add(new Label("header", getString("gb.docs"))); | |||
// documents list | |||
ListDataProvider<PathModel> pathsDp = new ListDataProvider<PathModel>(paths); | |||
DataView<PathModel> pathsView = new DataView<PathModel>("document", pathsDp) { | |||
private static final long serialVersionUID = 1L; | |||
int counter = 0; | |||
public void populateItem(final Item<PathModel> item) { | |||
PathModel entry = item.getModelObject(); | |||
item.add(WicketUtils.newImage("docIcon", "file_world_16x16.png")); | |||
item.add(new Label("docSize", byteFormat.format(entry.size))); | |||
item.add(new LinkPanel("docName", "list", entry.name, BlobPage.class, newPathParameter(entry.path))); | |||
// links | |||
item.add(new BookmarkablePageLink<Void>("view", BlobPage.class, WicketUtils.newPathParameter(repositoryName, entry.commitId, entry.path))); | |||
item.add(new BookmarkablePageLink<Void>("raw", RawPage.class, WicketUtils.newPathParameter(repositoryName, entry.commitId, entry.path))); | |||
item.add(new BookmarkablePageLink<Void>("blame", BlobPage.class).setEnabled(false)); | |||
item.add(new BookmarkablePageLink<Void>("history", HistoryPage.class, WicketUtils.newPathParameter(repositoryName, entry.commitId, entry.path))); | |||
WicketUtils.setAlternatingBackground(item, counter); | |||
counter++; | |||
} | |||
}; | |||
add(pathsView); | |||
} | |||
@Override | |||
protected String getPageName() { | |||
return getString("gb.docs"); | |||
} | |||
} |
@@ -13,12 +13,12 @@ | |||
<form wicket:id="editForm"> | |||
<table class="plain"> | |||
<tbody> | |||
<tr><th>Name</th><td class="edit"><input type="text" wicket:id="name" size="30" tabindex="1" /></td></tr> | |||
<tr><th>Description</th><td class="edit"><input type="text" wicket:id="description" size="80" tabindex="2" /></td></tr> | |||
<tr><th>Owner</th><td class="edit"><input type="text" wicket:id="owner" size="30" tabindex="3" /></td></tr> | |||
<tr><th>Group</th><td class="edit"><input type="text" wicket:id="group" size="30" tabindex="4" /></td></tr> | |||
<tr><th>Enable Tickets</th><td class="edit"><input type="checkbox" wicket:id="useTickets" tabindex="5" /> <i>distributed Ticgit ticketing</i></td></tr> | |||
<tr><th>Enable Docs</th><td class="edit"><input type="checkbox" wicket:id="useDocs" tabindex="6" /> <i>distributed Markdown documentation</i></td></tr> | |||
<tr><th><wicket:message key="gb.name"></wicket:message></th><td class="edit"><input type="text" wicket:id="name" size="30" tabindex="1" /></td></tr> | |||
<tr><th><wicket:message key="gb.description"></wicket:message></th><td class="edit"><input type="text" wicket:id="description" size="80" tabindex="2" /></td></tr> | |||
<tr><th><wicket:message key="gb.owner"></wicket:message></th><td class="edit"><input type="text" wicket:id="owner" size="30" tabindex="3" /></td></tr> | |||
<tr><th><wicket:message key="gb.group"></wicket:message></th><td class="edit"><input type="text" wicket:id="group" size="30" tabindex="4" /></td></tr> | |||
<tr><th><wicket:message key="gb.enableTickets"></wicket:message></th><td class="edit"><input type="checkbox" wicket:id="useTickets" tabindex="5" /> <i>distributed Ticgit issues</i></td></tr> | |||
<tr><th><wicket:message key="gb.enableDocs"></wicket:message></th><td class="edit"><input type="checkbox" wicket:id="useDocs" tabindex="6" /> <i>enumerates repository Markdown documentation</i></td></tr> | |||
<tr><td class="edit" colspan="2"><input type="submit" value="Submit" tabindex="7" /></td></tr> | |||
</tbody> | |||
</table> |
@@ -11,7 +11,7 @@ | |||
<div wicket:id="pageLinks">[page links]</div> | |||
<!-- pager links --> | |||
<div style="padding-top:5px;padding-bottom:5px;"> | |||
<div style="padding-top:5px;"> | |||
<a wicket:id="firstPageTop"><wicket:message key="gb.pageFirst"></wicket:message></a> | <a wicket:id="prevPageTop"><wicket:message key="gb.pagePrevious"></wicket:message></a> | <a wicket:id="nextPageTop"><wicket:message key="gb.pageNext"></wicket:message></a> | |||
</div> | |||
@@ -11,7 +11,7 @@ | |||
<div wicket:id="pageLinks">[page links]</div> | |||
<!-- pager links --> | |||
<div style="padding-top:5px;padding-bottom:5px;"> | |||
<div style="padding-top:5px;"> | |||
<a wicket:id="firstPageTop"><wicket:message key="gb.pageFirst"></wicket:message></a> | <a wicket:id="prevPageTop"><wicket:message key="gb.pagePrevious"></wicket:message></a> | <a wicket:id="nextPageTop"><wicket:message key="gb.pageNext"></wicket:message></a> | |||
</div> | |||
@@ -11,7 +11,7 @@ | |||
<div wicket:id="pageLinks">[page links]</div> | |||
<!-- pager links --> | |||
<div style="padding-top:5px;padding-bottom:5px;"> | |||
<div style="padding-top:5px;"> | |||
<a wicket:id="firstPageTop"><wicket:message key="gb.pageFirst"></wicket:message></a> | <a wicket:id="prevPageTop"><wicket:message key="gb.pagePrevious"></wicket:message></a> | <a wicket:id="nextPageTop"><wicket:message key="gb.pageNext"></wicket:message></a> | |||
</div> | |||
@@ -15,8 +15,8 @@ | |||
<a wicket:id="historyLink"><wicket:message key="gb.history"></wicket:message></a> | <a wicket:id="headLink"><wicket:message key="gb.head"></wicket:message></a> | |||
</div> | |||
<!-- shortlog header --> | |||
<div class="header" wicket:id="shortlog">[shortlog header]</div> | |||
<!-- commit header --> | |||
<div wicket:id="commitHeader">[commit header]</div> | |||
<!-- breadcrumbs --> | |||
<div wicket:id="breadcrumbs">[breadcrumbs]</div> | |||
@@ -28,7 +28,7 @@ | |||
<td><span wicket:id="pathName"></span></td> | |||
<td class="size"><span wicket:id="pathSize">[path size]</span></td> | |||
<td class="mode"><span wicket:id="pathPermissions">[path permissions]</span></td> | |||
<td class="rightAlign"><span wicket:id="pathLinks">[path links]</span></td> | |||
<td class="treeLinks"><span wicket:id="pathLinks">[path links]</span></td> | |||
</tr> | |||
</table> | |||
@@ -19,6 +19,7 @@ import com.gitblit.wicket.LinkPanel; | |||
import com.gitblit.wicket.RepositoryPage; | |||
import com.gitblit.wicket.WicketUtils; | |||
import com.gitblit.wicket.models.PathModel; | |||
import com.gitblit.wicket.panels.CommitHeaderPanel; | |||
import com.gitblit.wicket.panels.PathBreadcrumbsPanel; | |||
public class TreePage extends RepositoryPage { | |||
@@ -36,7 +37,7 @@ public class TreePage extends RepositoryPage { | |||
add(new BookmarkablePageLink<Void>("historyLink", HistoryPage.class, WicketUtils.newPathParameter(repositoryName, objectId, path))); | |||
add(new BookmarkablePageLink<Void>("headLink", TreePage.class, WicketUtils.newPathParameter(repositoryName, Constants.HEAD, path))); | |||
add(new LinkPanel("shortlog", "title", commit == null ? "" : commit.getShortMessage(), CommitPage.class, newCommitParameter())); | |||
add(new CommitHeaderPanel("commitHeader", repositoryName, commit)); | |||
// breadcrumbs | |||
add(new PathBreadcrumbsPanel("breadcrumbs", repositoryName, path, objectId)); | |||
@@ -66,7 +67,7 @@ public class TreePage extends RepositoryPage { | |||
// folder/tree link | |||
item.add(WicketUtils.newImage("pathIcon", "folder_16x16.png")); | |||
item.add(new Label("pathSize", "")); | |||
item.add(new LinkPanel("pathName", null, entry.name, TreePage.class, newPathParameter(entry.path))); | |||
item.add(new LinkPanel("pathName", "list", entry.name, TreePage.class, newPathParameter(entry.path))); | |||
// links | |||
Fragment links = new Fragment("pathLinks", "treeLinks", this); | |||
@@ -75,7 +76,7 @@ public class TreePage extends RepositoryPage { | |||
item.add(links); | |||
} else { | |||
// blob link | |||
item.add(WicketUtils.newImage("pathIcon", "file_16x16.png")); | |||
item.add(WicketUtils.getFileImage("pathIcon", entry.name)); | |||
item.add(new Label("pathSize", byteFormat.format(entry.size))); | |||
item.add(new LinkPanel("pathName", "list", entry.name, BlobPage.class, newPathParameter(entry.path))); | |||
@@ -0,0 +1,15 @@ | |||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |||
<html xmlns="http://www.w3.org/1999/xhtml" | |||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" | |||
xml:lang="en" | |||
lang="en"> | |||
<wicket:panel> | |||
<div class="commitHeader"> | |||
<div style="float:right;"> | |||
<span wicket:id="author">[author]</span> <span wicket:id="date">[date]</span> | |||
</div> | |||
<span wicket:id="shortmessage">[short message]</span> <span wicket:id="commitid">[commit id]</span> | |||
</div> | |||
</wicket:panel> | |||
</html> |
@@ -0,0 +1,23 @@ | |||
package com.gitblit.wicket.panels; | |||
import java.util.Date; | |||
import org.apache.wicket.markup.html.basic.Label; | |||
import org.eclipse.jgit.revwalk.RevCommit; | |||
import com.gitblit.wicket.LinkPanel; | |||
import com.gitblit.wicket.WicketUtils; | |||
import com.gitblit.wicket.pages.CommitPage; | |||
public class CommitHeaderPanel extends BasePanel { | |||
private static final long serialVersionUID = 1L; | |||
public CommitHeaderPanel(String id, String repositoryName, RevCommit c) { | |||
super(id); | |||
add(new LinkPanel("shortmessage", "title", c == null ? "" : c.getShortMessage(), CommitPage.class, WicketUtils.newObjectParameter(repositoryName, c == null ? "" : c.getName()))); | |||
add(new Label("commitid", "(" + c.getName().substring(0, 8) + ")")); | |||
add(new Label("author", c == null ? "" : c.getAuthorIdent().getName())); | |||
add(WicketUtils.createDateLabel("date", c == null ? new Date(0) : c.getAuthorIdent().getWhen(), getTimeZone())); | |||
} | |||
} |
@@ -7,8 +7,8 @@ | |||
<body> | |||
<wicket:panel> | |||
<!-- header --> | |||
<div class="header" wicket:id="header">[history header]</div> | |||
<!-- commit header --> | |||
<div wicket:id="commitHeader">[commit header]</div> | |||
<!-- breadcrumbs --> | |||
<div wicket:id="breadcrumbs">[breadcrumbs]</div> |
@@ -29,7 +29,6 @@ import com.gitblit.wicket.pages.BlobPage; | |||
import com.gitblit.wicket.pages.CommitDiffPage; | |||
import com.gitblit.wicket.pages.CommitPage; | |||
import com.gitblit.wicket.pages.HistoryPage; | |||
import com.gitblit.wicket.pages.LogPage; | |||
import com.gitblit.wicket.pages.SearchPage; | |||
import com.gitblit.wicket.pages.TreePage; | |||
@@ -73,16 +72,7 @@ public class HistoryPanel extends BasePanel { | |||
// works unless commits.size() represents the exact end. | |||
hasMore = commits.size() >= itemsPerPage; | |||
// header | |||
if (pageResults) { | |||
// history page | |||
// show commit page link | |||
add(new LinkPanel("header", "title", commit == null ? "" : commit.getShortMessage(), CommitPage.class, WicketUtils.newObjectParameter(repositoryName, objectId))); | |||
} else { | |||
// summary page | |||
// show history page link | |||
add(new LinkPanel("header", "title", new StringResourceModel("gb.history", this, null), LogPage.class, WicketUtils.newRepositoryParameter(repositoryName))); | |||
} | |||
add(new CommitHeaderPanel("commitHeader", repositoryName, commit)); | |||
// breadcrumbs | |||
add(new PathBreadcrumbsPanel("breadcrumbs", repositoryName, path, objectId)); |
@@ -27,6 +27,7 @@ import com.gitblit.utils.JGitUtils.SearchType; | |||
import com.gitblit.wicket.LinkPanel; | |||
import com.gitblit.wicket.WicketUtils; | |||
import com.gitblit.wicket.pages.BranchesPage; | |||
import com.gitblit.wicket.pages.DocsPage; | |||
import com.gitblit.wicket.pages.LogPage; | |||
import com.gitblit.wicket.pages.SearchPage; | |||
import com.gitblit.wicket.pages.SummaryPage; | |||
@@ -72,7 +73,7 @@ public class PageLinksPanel extends Panel { | |||
// Get the repository docs setting | |||
boolean checkDocs = JGitUtils.getRepositoryUseDocs(r); | |||
if (checkDocs && JGitUtils.getDocumentsBranch(r) != null) { | |||
if (checkDocs) { | |||
extras.add("docs"); | |||
} | |||
@@ -87,7 +88,7 @@ public class PageLinksPanel extends Panel { | |||
item.add(new LinkPanel("extraLink", null, getString("gb.tickets"), TicketsPage.class, WicketUtils.newRepositoryParameter(repositoryName))); | |||
} else if (extra.equals("docs")) { | |||
item.add(new Label("extraSeparator", " | ")); | |||
item.add(new LinkPanel("extraLink", null, getString("gb.docs"), TicketsPage.class, WicketUtils.newRepositoryParameter(repositoryName))); | |||
item.add(new LinkPanel("extraLink", null, getString("gb.docs"), DocsPage.class, WicketUtils.newRepositoryParameter(repositoryName))); | |||
} | |||
} | |||
}; |
@@ -72,20 +72,27 @@ div.repositories_message { | |||
line-height: inherit; | |||
} | |||
div.header { | |||
div.header, div.commitHeader { | |||
background-color: #D2C3AF; | |||
padding: 3px; | |||
border: 1px solid #808080; | |||
} | |||
div.header { | |||
border-radius: 3px 3px 0 0; | |||
} | |||
div.header a { | |||
div.commitHeader { | |||
border-radius: 3px; | |||
} | |||
div.header a, div.commitHeader a { | |||
color: black; | |||
text-decoration: none; | |||
font-weight: bold; | |||
} | |||
div.header a:hover { | |||
div.header a:hover, div.commitHeader a:hover { | |||
text-decoration: underline; | |||
} | |||
@@ -558,14 +565,15 @@ span.sha1, span.sha1 a, span.sha1 a span { | |||
} | |||
td.mode { | |||
text-align: right; | |||
font-family: monospace; | |||
width:90px; | |||
width: 8em; | |||
padding-right:15px; | |||
} | |||
td.size { | |||
text-align: right; | |||
width:100px; | |||
width: 8em; | |||
padding-right:15px; | |||
} | |||
@@ -573,6 +581,11 @@ td.rightAlign { | |||
text-align: right; | |||
} | |||
td.treeLinks { | |||
text-align: right; | |||
width: 13em; | |||
} | |||
span .tagRef, span .headRef, span .remoteRef, span .otherRef { | |||
padding: 0px 3px; | |||
margin-right:2px; |
@@ -2,4 +2,4 @@ | |||
A quick and easy way to host your own Git repositories. | |||
Built with [JGit](http://eclipse.org/jgit) [Wicket](http://wicket.apache.org) [WicketStuff GoogleCharts](https://github.com/wicketstuff/core/wiki/GoogleCharts) [MarkdownPapers](http://markdown.tautua.org) [Jetty](http://eclipse.org/jetty) [SLF4J](http://www.slf4j.org) [Log4j](http://logging.apache.org/log4j) [google-code-prettify](http://code.google.com/p/google-code-prettify) [JCommander](http://jcommander.org) | |||
Built with [JGit](http://eclipse.org/jgit), [Wicket](http://wicket.apache.org), [WicketStuff GoogleCharts](https://github.com/wicketstuff/core/wiki/GoogleCharts), [markitup](http://markitup.jaysalvat.com), [MarkdownPapers](http://markdown.tautua.org), [Jetty](http://eclipse.org/jetty), [SLF4J](http://www.slf4j.org), [Log4j](http://logging.apache.org/log4j), [google-code-prettify](http://code.google.com/p/google-code-prettify), [JCommander](http://jcommander.org), Most icons courtesy of [FatCow Hosting](http://www.fatcow.com/free-icons) |