Add comments to issue.

This commit is contained in:
shimamoto
2013-06-25 13:18:53 +09:00
parent 34b71c10cb
commit 1a4510201f
3 changed files with 26 additions and 4 deletions

View File

@@ -46,7 +46,10 @@ trait IssuesControllerBase extends ControllerBase {
val issueId = params("id") val issueId = params("id")
getIssue(owner, repository, issueId) map { getIssue(owner, repository, issueId) map {
issues.html.issue(_, getRepository(owner, repository, baseUrl).get) issues.html.issue(
_,
getComment(owner, repository, issueId.toInt),
getRepository(owner, repository, baseUrl).get)
} getOrElse NotFound } getOrElse NotFound
} }

View File

@@ -18,6 +18,13 @@ trait IssuesService {
} firstOption } firstOption
else None else None
def getComment(owner: String, repository: String, issueId: Int) =
Query(IssueComments) filter { t =>
(t.userName is owner.bind) &&
(t.repositoryName is repository.bind) &&
(t.issueId is issueId.bind)
} list
def searchIssue(owner: String, repository: String, def searchIssue(owner: String, repository: String,
// TODO It is better to have a DTO // TODO It is better to have a DTO
closed: Boolean) = closed: Boolean) =

View File

@@ -1,4 +1,4 @@
@(issue: model.Issue, repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context) @(issue: model.Issue, comments: List[model.IssueComment], repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context)
@import context._ @import context._
@import view.helpers._ @import view.helpers._
@html.main("%s - Issue #%d - %s/%s".format(issue.title, issue.issueId, repository.owner, repository.name)){ @html.main("%s - Issue #%d - %s/%s".format(issue.title, issue.issueId, repository.owner, repository.name)){
@@ -19,7 +19,19 @@
@markdown(issue.content getOrElse "No description given.", repository, false, true, true) @markdown(issue.content getOrElse "No description given.", repository, false, true, true)
</div> </div>
</div> </div>
<span id="comment-area"></span> <span id="comment-area">
@comments.map { comment =>
<div class="box">
<div class="box-header-small">
<a href="@path/@comment.commentedUserName">@comment.commentedUserName</a> commented
<span class="pull-right">@datetime(comment.registeredDate)</span>
</div>
<div class="box-content" style="background-color: #f5f5f5;">
@markdown(comment.content, repository, false, true, true)
</div>
</div>
}
</span>
<div class="box"> <div class="box">
<div class="box-content"> <div class="box-content">
@html.preview(repository, "", false, true, true, "width: 730px; height: 100px;") @html.preview(repository, "", false, true, true, "width: 730px; height: 100px;")
@@ -33,7 +45,7 @@
} else { } else {
<a class="btn btn-large btn-success disabled">Open</a> <a class="btn btn-large btn-success disabled">Open</a>
} }
<div class="small">3 comments</div> <div class="small">@comments.size comments</div>
<hr/> <hr/>
<strong>Labels</strong> <strong>Labels</strong>
</div> </div>