@(activities: List[gitbucket.core.model.Activity])(implicit context: gitbucket.core.controller.Context) @import context._ @import gitbucket.core.view.helpers._ @if(activities.isEmpty){ No activity } else { @activities.map { activity =>
@(activity.activityType match { case "open_issue" => detailActivity(activity, "activity-issue.png") case "comment_issue" => detailActivity(activity, "activity-comment.png") case "comment_commit" => detailActivity(activity, "activity-comment.png") case "close_issue" => detailActivity(activity, "activity-issue-close.png") case "reopen_issue" => detailActivity(activity, "activity-issue-reopen.png") case "open_pullreq" => detailActivity(activity, "activity-merge.png") case "merge_pullreq" => detailActivity(activity, "activity-merge.png") case "create_repository" => simpleActivity(activity, "activity-create-repository.png") case "create_branch" => simpleActivity(activity, "activity-branch.png") case "delete_branch" => simpleActivity(activity, "activity-delete.png") case "create_tag" => simpleActivity(activity, "activity-tag.png") case "delete_tag" => simpleActivity(activity, "activity-delete.png") case "fork" => simpleActivity(activity, "activity-fork.png") case "push" => customActivity(activity, "activity-commit.png"){
{activity.additionalInfo.get.split("\n").reverse.take(4).zipWithIndex.map{ case (commit, i) => if(i == 3){
...
} else { if(commit.nonEmpty){
{commit.substring(0, 7)} {commit.substring(41)}
} } }}
} case "create_wiki" => customActivity(activity, "activity-wiki.png"){
Created {activity.additionalInfo.get}.
} case "edit_wiki" => customActivity(activity, "activity-wiki.png"){ activity.additionalInfo.get.split(":") match { case Array(pageName, commitId) =>
Edited {pageName}. View the diff »
case Array(pageName) =>
Edited {pageName}.
} } })
} } @detailActivity(activity: gitbucket.core.model.Activity, image: String) = {
@helper.html.datetimeago(activity.activityDate)
@avatar(activity.activityUserName, 16) @activityMessage(activity.message)
@activity.additionalInfo.map { additionalInfo =>
@additionalInfo
}
} @customActivity(activity: gitbucket.core.model.Activity, image: String)(additionalInfo: Any) = {
@helper.html.datetimeago(activity.activityDate)
@avatar(activity.activityUserName, 16) @activityMessage(activity.message)
@additionalInfo
} @simpleActivity(activity: gitbucket.core.model.Activity, image: String) = {
@avatar(activity.activityUserName, 16) @activityMessage(activity.message) @helper.html.datetimeago(activity.activityDate)
}