Start to implement the commit detail page.

This commit is contained in:
takezoe
2013-04-21 03:45:30 +09:00
parent 82e65fc6b7
commit 1e80f03848
5 changed files with 124 additions and 22 deletions

View File

@@ -4,14 +4,23 @@ import java.text.SimpleDateFormat
object helpers {
def datetime(date: Date): String = {
new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(date)
}
/**
* Format java.util.Date to "yyyy/MM/dd HH:mm:ss".
*/
def datetime(date: Date): String = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(date)
def date(date: Date): String = {
new SimpleDateFormat("yyyy/MM/dd").format(date)
}
/**
* Format java.util.Date to "yyyy/MM/dd".
*/
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(
value.replaceAll(" ", "&nbsp;").replaceAll("\t", "&nbsp;&nbsp;&nbsp;&nbsp;").replaceAll("\n", "<br>"))
/**
* Cut the given string by specified length.
*/
def cut(message: String, length: Int): String = {
if(message.length > length){
message.substring(0, length) + "..."