mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-06 13:35:50 +01:00
Add helper which convert singular and plural.
This commit is contained in:
@@ -18,6 +18,13 @@ object helpers {
|
|||||||
*/
|
*/
|
||||||
def date(date: Date): String = new SimpleDateFormat("yyyy-MM-dd").format(date)
|
def date(date: Date): String = new SimpleDateFormat("yyyy-MM-dd").format(date)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns singular if count is 1, otherwise plural.
|
||||||
|
* If plural is not specified, returns singular + "s" as plural.
|
||||||
|
*/
|
||||||
|
def plural(count: Int, singular: String, plural: String = ""): String =
|
||||||
|
if(count == 1) singular else if(plural.isEmpty) singular + "s" else plural
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts Markdown of Wiki pages to HTML.
|
* Converts Markdown of Wiki pages to HTML.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -117,11 +117,7 @@
|
|||||||
<span class="label label-success issue-status">Open</span>
|
<span class="label label-success issue-status">Open</span>
|
||||||
}
|
}
|
||||||
<div class="small" style="text-align: center;">
|
<div class="small" style="text-align: center;">
|
||||||
@if(comments.size == 1){
|
<strong>@comments.size</strong> @plural(@comments.size, "comment")
|
||||||
<strong>1</strong> comment
|
|
||||||
} else {
|
|
||||||
<strong>@comments.size</strong> comments
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
<hr/>
|
<hr/>
|
||||||
<div style="margin-bottom: 8px;">
|
<div style="margin-bottom: 8px;">
|
||||||
|
|||||||
@@ -176,12 +176,7 @@
|
|||||||
<span class="pull-right muted">#@issue.issueId</span>
|
<span class="pull-right muted">#@issue.issueId</span>
|
||||||
<div class="small muted">
|
<div class="small muted">
|
||||||
Opened by <a href="@url(issue.openedUserName)" class="username">@issue.openedUserName</a> @datetime(issue.registeredDate)
|
Opened by <a href="@url(issue.openedUserName)" class="username">@issue.openedUserName</a> @datetime(issue.registeredDate)
|
||||||
@if(commentCount == 1){
|
<i class="icon-comment"></i><a href="@url(repository)/issues/@issue.issueId" class="issue-comment-count">@commentCount @plural(commentCount, "comment")</a>
|
||||||
<i class="icon-comment"></i><a href="@url(repository)/issues/@issue.issueId" class="issue-comment-count">1 comment</a>
|
|
||||||
}
|
|
||||||
@if(commentCount > 1){
|
|
||||||
<i class="icon-comment"></i><a href="@url(repository)/issues/@issue.issueId" class="issue-comment-count">@commentCount comments</a>
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user