diff --git a/src/main/scala/app/CreateRepositoryServlet.scala b/src/main/scala/app/CreateRepositoryServlet.scala index 66e8a61..7477fe4 100644 --- a/src/main/scala/app/CreateRepositoryServlet.scala +++ b/src/main/scala/app/CreateRepositoryServlet.scala @@ -24,7 +24,7 @@ * Show the new repository form. */ get("/") { - html.newrepo.render() + html.newrepo() } /** diff --git a/src/main/scala/app/RepositoryViewerServlet.scala b/src/main/scala/app/RepositoryViewerServlet.scala index e878a30..cbe009d 100644 --- a/src/main/scala/app/RepositoryViewerServlet.scala +++ b/src/main/scala/app/RepositoryViewerServlet.scala @@ -25,7 +25,7 @@ */ get("/:owner") { val owner = params("owner") - html.user.render(owner, getRepositories(owner).map(getRepositoryInfo(owner, _))) + html.user(owner, getRepositories(owner).map(getRepositoryInfo(owner, _))) } /** @@ -85,7 +85,7 @@ } } - html.commits.render(branchName, getRepositoryInfo(owner, repository), + html.commits(branchName, getRepositoryInfo(owner, repository), listBuffer.toSeq.splitWith{ (commit1, commit2) => view.helpers.date(commit1.time) == view.helpers.date(commit2.time) }, page, i.hasNext) @@ -108,7 +108,7 @@ val git = Git.open(dir) val latestRev = git.log.addPath(path).call.iterator.next - html.blob.render(branchName, getRepositoryInfo(owner, repository), path.split("/").toList, content, + html.blob(branchName, getRepositoryInfo(owner, repository), path.split("/").toList, content, CommitInfo(latestRev.getName, latestRev.getCommitterIdent.getWhen, latestRev.getCommitterIdent.getName, latestRev.getShortMessage)) } @@ -187,7 +187,7 @@ val git = Git.open(dir) val latestRev = {if(path == ".") git.log else git.log.addPath(path)}.call.iterator.next - html.files.render( + html.files( // current branch branchName, // repository diff --git a/src/main/scala/app/ServletBase.scala b/src/main/scala/app/ServletBase.scala index c153d3b..b8a35b3 100644 --- a/src/main/scala/app/ServletBase.scala +++ b/src/main/scala/app/ServletBase.scala @@ -14,6 +14,8 @@ implicit val jsonFormats = DefaultFormats + implicit def context: Context = Context(servletContext.getContextPath) + // TODO get from session val LoginUser = System.getProperty("user.name") @@ -42,4 +44,6 @@ } } -} \ No newline at end of file +} + +case class Context(path: String) \ No newline at end of file diff --git a/src/main/twirl/blob.scala.html b/src/main/twirl/blob.scala.html index 96f1e7e..158def3 100644 --- a/src/main/twirl/blob.scala.html +++ b/src/main/twirl/blob.scala.html @@ -1,14 +1,15 @@ -@(branch: String, repository: app.RepositoryInfo, pathList: List[String], content: String, latestCommit: app.CommitInfo) +@(branch: String, repository: app.RepositoryInfo, pathList: List[String], content: String, latestCommit: app.CommitInfo)(implicit context: app.Context) +@import context._ @main(repository.owner+"/"+repository.name) { @header(branch, repository) @navtab(branch, repository, "files")
- | .. | +.. | ||
@if(file.isDirectory){
- ![]() ![]() ![]() ![]() |
@if(file.isDirectory){ - @file.name + @file.name } else { - @file.name + @file.name } | @view.helpers.datetime(file.time) | -@view.helpers.cut(file.message, 60) [@file.committer] | +@view.helpers.cut(file.message, 60) [@file.committer] |