Move readableSize to view helpers

This commit is contained in:
Mitsuhiro Koga
2017-02-12 01:53:25 +09:00
parent 422eda927e
commit ab1adc48f8
3 changed files with 8 additions and 5 deletions

View File

@@ -129,10 +129,6 @@ object JGitUtil {
* the line separator of this content ("LF" or "CRLF")
*/
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))
}
/**

View File

@@ -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))
}

View File

@@ -54,7 +54,7 @@
@helpers.avatar(latestCommit, 28)
@helpers.user(latestCommit.authorName, latestCommit.authorEmailAddress, "username strong")
<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>
<div class="btn-group pull-right">
@if(hasWritePermission && content.viewType == "text" && repository.branchList.contains(branch)){