Add issue update in stub.

This commit is contained in:
shimamoto
2013-06-26 14:55:22 +09:00
parent 31201c9453
commit 80bb24fdba
4 changed files with 80 additions and 6 deletions

View File

@@ -46,7 +46,7 @@ trait IssuesControllerBase extends ControllerBase {
getIssue(owner, repository, issueId) map {
issues.html.issue(
_,
getComment(owner, repository, issueId.toInt),
getComments(owner, repository, issueId.toInt),
getRepository(owner, repository, baseUrl).get)
} getOrElse NotFound
}
@@ -65,6 +65,16 @@ trait IssuesControllerBase extends ControllerBase {
saveIssue(owner, repository, context.loginAccount.get.userName, form.title, form.content)))
})
// TODO Authenticator
post("/:owner/:repository/issues/:id"){
// TODO update issue
contentType = formats("json")
org.json4s.jackson.Serialization.write(Map(
"title" -> "test title 2",
"content" -> view.Markdown.toHtml("* hoge", getRepository("root", "test", baseUrl).get, false, true, true)))
}
// TODO requires users only and readable repository checking
post("/:owner/:repository/issue_comments", commentForm)( usersOnly { form =>
val owner = params("owner")
@@ -74,6 +84,23 @@ trait IssuesControllerBase extends ControllerBase {
saveComment(owner, repository, context.loginAccount.get.userName, form.issueId, form.content)))
})
// TODO Authenticator
post("/:owner/:repository/issue_comments/:id"){
// TODO update issue memo
}
// TODO Authenticator
get("/:owner/:repository/issues/_data/:id"){
getIssue(params("owner"), params("repository"), params("id")) map { x =>
issues.html.edit(Some(x.title), x.content.getOrElse(""), x.issueId, x.userName, x.repositoryName)
} getOrElse NotFound
}
get("/:owner/:repository/issue_comments/_data/:id"){
getComment(params("id")) map { x =>
issues.html.edit(None, x.content, x.commentId, x.userName, x.repositoryName)
} getOrElse NotFound
}
private def searchIssues(filter: String) = {
val owner = params("owner")
val repository = params("repository")