Improve repository presentation.

This commit is contained in:
takezoe
2013-06-18 19:59:03 +09:00
parent 3fc468bd33
commit b72bbb6dcd
4 changed files with 52 additions and 35 deletions

View File

@@ -39,9 +39,10 @@ object JGitUtil {
* @param name the file (or directory) name * @param name the file (or directory) name
* @param time the last modified time * @param time the last modified time
* @param message the last commit message * @param message the last commit message
* @param commitId the last commit id
* @param committer the last committer name * @param committer the last committer name
*/ */
case class FileInfo(id: ObjectId, isDirectory: Boolean, name: String, time: Date, message: String, committer: String) case class FileInfo(id: ObjectId, isDirectory: Boolean, name: String, time: Date, message: String, commitId: String, committer: String)
/** /**
* The commit data. * The commit data.
@@ -184,6 +185,7 @@ object JGitUtil {
name, name,
commits(path).getCommitterIdent.getWhen, commits(path).getCommitterIdent.getWhen,
commits(path).getShortMessage, commits(path).getShortMessage,
commits(path).getName,
commits(path).getCommitterIdent.getName) commits(path).getCommitterIdent.getName)
}.sortWith { (file1, file2) => }.sortWith { (file1, file2) =>
(file1.isDirectory, file2.isDirectory) match { (file1.isDirectory, file2.isDirectory) match {

View File

@@ -21,7 +21,7 @@
<div class="pull-left"> <div class="pull-left">
<a href="@path/@latestCommit.committer">@latestCommit.committer</a> <a href="@path/@latestCommit.committer">@latestCommit.committer</a>
<span class="description">@helpers.datetime(latestCommit.time)</span> <span class="description">@helpers.datetime(latestCommit.time)</span>
@helpers.cut(latestCommit.message, 100)<br> <a href="@path/@repository.owner/@repository.name/commit/@latestCommit.id" class="commit-message">@helpers.cut(latestCommit.message, 100)</a>
</div> </div>
<div class="btn-group pull-right"> <div class="btn-group pull-right">
<a class="btn btn-mini" href="?raw=true">Raw</a> <a class="btn btn-mini" href="?raw=true">Raw</a>

View File

@@ -10,53 +10,55 @@
<a href="@path/@repository.owner/@repository.name/tree/@branch/@pathList.take(i + 1).mkString("/")">@section</a> / <a href="@path/@repository.owner/@repository.name/tree/@branch/@pathList.take(i + 1).mkString("/")">@section</a> /
} }
</div> </div>
<table class="table table-file-list"> <div class="box">
<tr> <table class="table table-file-list" style="border: 1px solid silver;">
<th colspan="4" style="font-weight: normal;"> <tr>
<div> <th colspan="4" style="font-weight: normal;">
<strong><a href="">@latestCommit.committer</a></strong> <div>
@helpers.cut(latestCommit.message, 100) <strong><a href="@path/@repository.owner/@repository.name/@latestCommit.committer">@latestCommit.committer</a></strong>
<a href="@path/@repository.owner/@repository.name/commit/@latestCommit.id" class="commit-message">@helpers.cut(latestCommit.message, 100)</a>
<div class="pull-right align-right"> <div class="pull-right align-right">
@helpers.datetime(latestCommit.time) @helpers.datetime(latestCommit.time)
<a href="@path/@repository.owner/@repository.name/commit/@latestCommit.id">@latestCommit.id.substring(0, 10)</a> <a href="@path/@repository.owner/@repository.name/commit/@latestCommit.id">@latestCommit.id.substring(0, 10)</a>
</div> </div>
</div> </div>
</th> </th>
</tr> </tr>
@if(pathList.size > 0){ @if(pathList.size > 0){
<tr> <tr>
<td width="16"></td> <td width="16"></td>
<td><a href="@path/@repository.owner/@repository.name@if(pathList.size > 1){/tree/@branch/@pathList.init.mkString("/")}">..</a></td> <td><a href="@path/@repository.owner/@repository.name@if(pathList.size > 1){/tree/@branch/@pathList.init.mkString("/")}">..</a></td>
<td></td> <td></td>
<td></td> <td></td>
</tr> </tr>
} }
@files.map { file => @files.map { file =>
<tr> <tr>
<td width="16"> <td width="16">
@if(file.isDirectory){ @if(file.isDirectory){
<img src="@path/assets/common/images/folder.png"/> <img src="@path/assets/common/images/folder.png"/>
} else { } else {
<img src="@path/assets/common/images/file.png"/> <img src="@path/assets/common/images/file.png"/>
} }
</td> </td>
<td> <td>
@if(file.isDirectory){ @if(file.isDirectory){
<a href="@path/@repository.owner/@repository.name/tree@{(branch :: pathList).mkString("/", "/", "/")}@file.name">@file.name</a> <a href="@path/@repository.owner/@repository.name/tree@{(branch :: pathList).mkString("/", "/", "/")}@file.name">@file.name</a>
} else { } else {
<a href="@path/@repository.owner/@repository.name/blob@{(branch :: pathList).mkString("/", "/", "/")}@file.name">@file.name</a> <a href="@path/@repository.owner/@repository.name/blob@{(branch :: pathList).mkString("/", "/", "/")}@file.name">@file.name</a>
} }
</td> </td>
<td>@helpers.datetime(file.time)</td> <td>@helpers.datetime(file.time)</td>
<td>@helpers.cut(file.message, 60) [<a href="@path/@file.committer">@file.committer</a>]</td> <td><a href="@path/@repository.owner/@repository.name/commit/@file.commitId" class="commit-message">@helpers.cut(file.message, 60)</a> [<a href="@path/@file.committer">@file.committer</a>]</td>
</tr> </tr>
} }
</table> </table>
</div>
@readme.map { content => @readme.map { content =>
<table class="table table-bordered"> <div class="box">
<tr> <div class="box-header">README.md</div>
<td>@helpers.markdown(content, repository, false, true, true)</td> <div class="box-content">@helpers.markdown(content, repository, false, true, true)</div>
</tr> </div>
</table>
} }
} }

View File

@@ -45,6 +45,15 @@ span.error {
font-size: small; font-size: small;
} }
a.commit-message {
color: #333333;
}
a.commit-message:hover {
color: #333333;
}
.monospace { .monospace {
font-family: monospace; font-family: monospace;
} }
@@ -59,6 +68,10 @@ span.description {
color: gray; color: gray;
} }
table.table-file-list {
margin-bottom: 0px;
}
table.table th { table.table th {
background-color: #d9edf7; background-color: #d9edf7;
} }