mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-01 19:15:59 +01:00
Implemented the issue label display.
This commit is contained in:
@@ -60,6 +60,7 @@ trait IssuesControllerBase extends ControllerBase {
|
||||
issues.html.issue(
|
||||
_,
|
||||
getComments(owner, repository, issueId.toInt),
|
||||
getIssueLabel(owner, repository, issueId.toInt),
|
||||
getRepository(owner, repository, baseUrl).get)
|
||||
} getOrElse NotFound
|
||||
}
|
||||
|
||||
@@ -25,6 +25,15 @@ trait IssuesService {
|
||||
Query(IssueComments) filter (_.byPrimaryKey(commentId.toInt)) firstOption
|
||||
else None
|
||||
|
||||
def getIssueLabel(owner: String, repository: String, issueId: Int) =
|
||||
IssueLabels
|
||||
.innerJoin(Labels).on { (t1, t2) =>
|
||||
t1.byLabel(t2.userName, t2.repositoryName, t2.labelId)
|
||||
}
|
||||
.filter ( _._1.byIssue(owner, repository, issueId) )
|
||||
.map ( _._2 )
|
||||
.list
|
||||
|
||||
/**
|
||||
* Returns the count of the search result against issues.
|
||||
*
|
||||
@@ -171,7 +180,7 @@ trait IssuesService {
|
||||
} get
|
||||
|
||||
def registerIssueLabel(owner: String, repository: String, issueId: Int, labelId: Int): Unit =
|
||||
IssueLabels.* insert (IssueLabel(owner, repository, issueId, labelId))
|
||||
IssueLabels insert (IssueLabel(owner, repository, issueId, labelId))
|
||||
|
||||
def createComment(owner: String, repository: String, loginUser: String,
|
||||
issueId: Int, content: String, action: Option[String]) =
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@(issue: model.Issue, comments: List[model.IssueComment], repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context)
|
||||
@(issue: model.Issue, comments: List[model.IssueComment], issueLabels: List[model.Label], repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context)
|
||||
@import context._
|
||||
@import view.helpers._
|
||||
@html.main("%s - Issue #%d - %s/%s".format(issue.title, issue.issueId, repository.owner, repository.name)){
|
||||
@@ -77,8 +77,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<ul class="label-list">
|
||||
<li><span class="label" style="background-color: #f89406;">improvement</span></li>
|
||||
<li><span class="label" style="background-color: #3a87ad;">not bug</span></li>
|
||||
@issueLabels.map { label =>
|
||||
<li><span class="label" style="background-color: #@label.color;">@label.labelName</span></li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user