mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-02 11:36:05 +01:00
Fix commit log presentation.
This commit is contained in:
@@ -15,27 +15,6 @@ object helpers {
|
||||
*/
|
||||
def date(date: Date): String = new SimpleDateFormat("yyyy/MM/dd").format(date)
|
||||
|
||||
def format(value: String): Html =
|
||||
Html(value.replaceAll(" ", " ").replaceAll("\t", " ").replaceAll("\n", "<br>"))
|
||||
|
||||
// TODO escape html tags using HtmlEscapeUtils (Commons Lang)
|
||||
def formatCommitLog(message: String): Html = {
|
||||
val i = message.trim.indexOf("\n")
|
||||
val (firstLine, description) = if(i >= 0){
|
||||
(message.trim.substring(0, i).trim, Some(message.trim.substring(i).trim))
|
||||
} else {
|
||||
(message.trim, None)
|
||||
}
|
||||
|
||||
val sb = new StringBuilder()
|
||||
sb.append("<div class=\"summary\">").append(format(firstLine).text).append("</div>")
|
||||
if(description.isDefined){
|
||||
sb.append("<div class=\"description\">").append(format(description.get).text).append("</div>")
|
||||
}
|
||||
|
||||
Html(sb.toString)
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts Markdown of Wiki pages to HTML.
|
||||
*/
|
||||
@@ -43,16 +22,5 @@ object helpers {
|
||||
enableWikiLink: Boolean, enableCommitLink: Boolean, enableIssueLink: Boolean)(implicit context: app.Context): Html = {
|
||||
Html(Markdown.toHtml(value, repository, enableWikiLink, enableCommitLink, enableIssueLink))
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Cut the given string by specified length.
|
||||
// */
|
||||
// def cut(message: String, length: Int): String = {
|
||||
// if(message.length > length){
|
||||
// message.substring(0, length) + "..."
|
||||
// } else {
|
||||
// message
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
@@ -8,7 +8,10 @@
|
||||
<table class="table table-bordered">
|
||||
<tr>
|
||||
<th>
|
||||
<div class="commit-log">@helpers.formatCommitLog(commit.fullMessage)</div>
|
||||
<div class="commit-log">@commit.shortMessage</div>
|
||||
@if(commit.description.isDefined){
|
||||
<pre class="commit-description">@commit.description.get</pre>
|
||||
}
|
||||
<div class="small" style="font-weight: normal;"><span class="description">@branch</span></div>
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
@@ -36,9 +36,7 @@
|
||||
}
|
||||
<br>
|
||||
@if(commit.description.isDefined){
|
||||
<div class="small" id="description-@commit.id" style="display: none;">
|
||||
@helpers.format(commit.description.get)
|
||||
</div>
|
||||
<pre id="description-@commit.id" style="display: none;" class="commit-description">@commit.description.get</pre>
|
||||
}
|
||||
<div class="small">
|
||||
<a href="@path/@commit.committer">@commit.committer</a>
|
||||
|
||||
@@ -14,15 +14,25 @@
|
||||
<table class="table table-file-list" style="border: 1px solid silver;">
|
||||
<tr>
|
||||
<th colspan="4" style="font-weight: normal;">
|
||||
<a href="@path/@repository.owner/@repository.name/commit/@latestCommit.id" class="commit-message">@latestCommit.shortMessage</a>
|
||||
@if(latestCommit.description.isDefined){
|
||||
<a href="javascript:void(0)" onclick="$('#description-@latestCommit.id').toggle();">...</a>
|
||||
}
|
||||
@if(latestCommit.description.isDefined){
|
||||
<pre id="description-@latestCommit.id" class="commit-description" style="display: none;">@latestCommit.description.get</pre>
|
||||
}
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div>
|
||||
<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">@latestCommit.shortMessage</a>
|
||||
<strong><a href="@path/@repository.owner/@repository.name/@latestCommit.committer">@latestCommit.committer</a></strong>
|
||||
<div class="pull-right align-right">
|
||||
@helpers.datetime(latestCommit.time)
|
||||
<a href="@path/@repository.owner/@repository.name/commit/@latestCommit.id">@latestCommit.id.substring(0, 10)</a>
|
||||
</div>
|
||||
</div>
|
||||
</th>
|
||||
</td>
|
||||
</tr>
|
||||
@if(pathList.size > 0){
|
||||
<tr>
|
||||
|
||||
@@ -97,8 +97,12 @@ div.block {
|
||||
border-bottom: 1px solid silver;
|
||||
}
|
||||
|
||||
div.commit-log div.description {
|
||||
pre.commit-description {
|
||||
font-weight: normal;
|
||||
border: none;
|
||||
background-color: transparent;
|
||||
padding: 2px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
h1.wiki-title {
|
||||
|
||||
Reference in New Issue
Block a user