mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-06 05:25:50 +01:00
Use view.helpers functions as helpers.xxx
This commit is contained in:
@@ -15,7 +15,7 @@ object helpers {
|
||||
def date(date: Date): String = new SimpleDateFormat("yyyy/MM/dd").format(date)
|
||||
|
||||
// TODO escape html tags using HtmlEscapeUtils (Commons Lang)
|
||||
def text(value: String): twirl.api.Html = twirl.api.Html(
|
||||
def format(value: String): twirl.api.Html = twirl.api.Html(
|
||||
value.replaceAll(" ", " ").replaceAll("\t", " ").replaceAll("\n", "<br>"))
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@(branch: String, repository: app.RepositoryInfo, pathList: List[String], content: String, latestCommit: app.CommitInfo)(implicit context: app.Context)
|
||||
@import context._
|
||||
@import view.helpers._
|
||||
@import view.helpers
|
||||
@main(repository.owner+"/"+repository.name) {
|
||||
@header(branch, repository)
|
||||
@navtab(branch, repository, "files")
|
||||
@@ -20,8 +20,8 @@
|
||||
<th style="font-weight: normal;">
|
||||
<div class="pull-left">
|
||||
<a href="@path/@latestCommit.committer">@latestCommit.committer</a>
|
||||
<span class="description">@datetime(latestCommit.time)</span>
|
||||
@cut(latestCommit.message, 100)<br>
|
||||
<span class="description">@helpers.datetime(latestCommit.time)</span>
|
||||
@helpers.cut(latestCommit.message, 100)<br>
|
||||
</div>
|
||||
<div class="btn-group pull-right">
|
||||
<button class="btn btn-mini">Edit</button>
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
@(branch: String, commit: app.CommitInfo, repository: app.RepositoryInfo, diffs: Seq[app.DiffInfo])(implicit context: app.Context)
|
||||
@import context._
|
||||
@import view.helpers._
|
||||
@main(cut(commit.message, 20)){
|
||||
@import view.helpers
|
||||
@main(helpers.cut(commit.message, 20)){
|
||||
@header(branch, repository)
|
||||
@navtab(branch, repository, "commits")
|
||||
<table class="table table-bordered">
|
||||
<tr>
|
||||
<th>
|
||||
<div>@text(commit.message)</div>
|
||||
<div>@helpers.format(commit.message)</div>
|
||||
<div class="small" style="font-weight: normal;"><span class="description">@branch</span></div>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="@path/@commit.committer">@commit.committer</a> <span class="description">@datetime(commit.time)</span>
|
||||
<a href="@path/@commit.committer">@commit.committer</a> <span class="description">@helpers.datetime(commit.time)</span>
|
||||
<div class="pull-right align-right">
|
||||
<span class="description">commit</span> @commit.id
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@(branch: String, repository: app.RepositoryInfo, commits: Seq[Seq[app.CommitInfo]], page: Int, hasNext: Boolean)(implicit context: app.Context)
|
||||
@import context._
|
||||
@import view.helpers._
|
||||
@import view.helpers
|
||||
@main(repository.owner+"/"+repository.name) {
|
||||
@header(branch, repository)
|
||||
@navtab(branch, repository, "commits")
|
||||
@@ -11,16 +11,16 @@
|
||||
@commits.map { date =>
|
||||
<table class="table table-bordered">
|
||||
<tr>
|
||||
<th>@date(date.head.time)</th>
|
||||
<th>@helpers.date(date.head.time)</th>
|
||||
</tr>
|
||||
@date.map { commit =>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="pull-left">
|
||||
<a href="#"><strong>@cut(commit.message, 100)</strong></a><br>
|
||||
<a href="#"><strong>@helpers.cut(commit.message, 100)</strong></a><br>
|
||||
<div class="small">
|
||||
<a href="@path/@commit.committer">@commit.committer</a>
|
||||
<span class="description">@datetime(commit.time)</span>
|
||||
<span class="description">@helpers.datetime(commit.time)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pull-right align-right">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@(branch: String, repository: app.RepositoryInfo, pathList: List[String], latestCommit: app.CommitInfo, files: List[app.FileInfo])(implicit context: app.Context)
|
||||
@import context._
|
||||
@import view.helpers._
|
||||
@import view.helpers
|
||||
@main(repository.owner+"/"+repository.name) {
|
||||
@header(branch, repository)
|
||||
@navtab(branch, repository, "files")
|
||||
@@ -15,9 +15,9 @@
|
||||
<th colspan="4" style="font-weight: normal;">
|
||||
<div>
|
||||
<strong><a href="">@latestCommit.committer</a></strong>
|
||||
@cut(latestCommit.message, 100)
|
||||
@helpers.cut(latestCommit.message, 100)
|
||||
<div class="pull-right align-right">
|
||||
@datetime(latestCommit.time)
|
||||
@helpers.datetime(latestCommit.time)
|
||||
<a href="@path/@repository.owner/@repository.name/commit/@latestCommit.id">@latestCommit.id.substring(0, 10)</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -47,8 +47,8 @@
|
||||
<a href="@path/@repository.owner/@repository.name/blob@{(branch :: pathList).mkString("/", "/", "/")}@file.name">@file.name</a>
|
||||
}
|
||||
</td>
|
||||
<td>@datetime(file.time)</td>
|
||||
<td>@cut(file.message, 60) [<a href="@path/@file.committer">@file.committer</a>]</td>
|
||||
<td>@helpers.datetime(file.time)</td>
|
||||
<td>@helpers.cut(file.message, 60) [<a href="@path/@file.committer">@file.committer</a>]</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user