mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-09 23:15:49 +01:00
Move readableSize to view helpers
This commit is contained in:
@@ -129,10 +129,6 @@ object JGitUtil {
|
|||||||
* the line separator of this content ("LF" or "CRLF")
|
* the line separator of this content ("LF" or "CRLF")
|
||||||
*/
|
*/
|
||||||
val lineSeparator: String = if(content.exists(_.indexOf("\r\n") >= 0)) "CRLF" else "LF"
|
val lineSeparator: String = if(content.exists(_.indexOf("\r\n") >= 0)) "CRLF" else "LF"
|
||||||
/**
|
|
||||||
* a human-readable display value (includes units - EB, PB, TB, GB, MB, KB or bytes)
|
|
||||||
*/
|
|
||||||
val readableSize = FileUtil.readableSize(size.getOrElse(0))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -380,4 +380,11 @@ object helpers extends AvatarImageProvider with LinkConverter with RequestCache
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a human-readable display value (includes units - EB, PB, TB, GB, MB, KB or bytes)
|
||||||
|
*
|
||||||
|
* @param size total size of object in bytes
|
||||||
|
*/
|
||||||
|
def readableSize(size: Option[Long]): String = FileUtil.readableSize(size.getOrElse(0))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
@helpers.avatar(latestCommit, 28)
|
@helpers.avatar(latestCommit, 28)
|
||||||
@helpers.user(latestCommit.authorName, latestCommit.authorEmailAddress, "username strong")
|
@helpers.user(latestCommit.authorName, latestCommit.authorEmailAddress, "username strong")
|
||||||
<span class="muted">@gitbucket.core.helper.html.datetimeago(latestCommit.commitTime)</span>
|
<span class="muted">@gitbucket.core.helper.html.datetimeago(latestCommit.commitTime)</span>
|
||||||
@content.readableSize
|
@helpers.readableSize(content.size)
|
||||||
<a href="@helpers.url(repository)/commit/@latestCommit.id" class="commit-message">@helpers.link(latestCommit.summary, repository)</a>
|
<a href="@helpers.url(repository)/commit/@latestCommit.id" class="commit-message">@helpers.link(latestCommit.summary, repository)</a>
|
||||||
<div class="btn-group pull-right">
|
<div class="btn-group pull-right">
|
||||||
@if(hasWritePermission && content.viewType == "text" && repository.branchList.contains(branch)){
|
@if(hasWritePermission && content.viewType == "text" && repository.branchList.contains(branch)){
|
||||||
|
|||||||
Reference in New Issue
Block a user