(refs #488)Show number of issues for each labels

This commit is contained in:
Naoki Takezoe
2014-09-28 11:43:58 +09:00
parent 0124f7cc3c
commit b516be242d
2 changed files with 5 additions and 3 deletions

View File

@@ -7,11 +7,11 @@ import util.Implicits._
import org.scalatra.i18n.Messages
class LabelsController extends LabelsControllerBase
with LabelsService with RepositoryService with AccountService
with LabelsService with IssuesService with RepositoryService with AccountService
with ReferrerAuthenticator with CollaboratorsAuthenticator
trait LabelsControllerBase extends ControllerBase {
self: LabelsService with RepositoryService
self: LabelsService with IssuesService with RepositoryService
with ReferrerAuthenticator with CollaboratorsAuthenticator =>
case class LabelForm(labelName: String, color: String)
@@ -29,6 +29,7 @@ trait LabelsControllerBase extends ControllerBase {
get("/:owner/:repository/issues/labels")(referrersOnly { repository =>
issues.labels.html.list(
getLabels(repository.owner, repository.name),
countIssueGroupByLabels(repository.owner, repository.name, IssuesService.IssueSearchCondition()),
repository,
hasWritePermission(repository.owner, repository.name, context.loginAccount))
})

View File

@@ -1,4 +1,5 @@
@(labels: List[model.Label],
counts: Map[String, Int],
repository: service.RepositoryService.RepositoryInfo,
hasWritePermission: Boolean)(implicit context: app.Context)
@import context._
@@ -28,7 +29,7 @@
</div>
<div class="@if(hasWritePermission){span2} else {span4}">
<div class="pull-right">
<span class="muted">x open issues</span>
<span class="muted">@counts.get(label.labelName).getOrElse(0) open issues</span>
</div>
</div>
@if(hasWritePermission){