diff --git a/src/main/scala/app/IssuesController.scala b/src/main/scala/app/IssuesController.scala index 8c0c0f9..ad02bee 100644 --- a/src/main/scala/app/IssuesController.scala +++ b/src/main/scala/app/IssuesController.scala @@ -6,11 +6,11 @@ import util.{WritableRepositoryAuthenticator, ReadableRepositoryAuthenticator, UsersOnlyAuthenticator} class IssuesController extends IssuesControllerBase - with IssuesService with RepositoryService with AccountService with LabelsService + with IssuesService with RepositoryService with AccountService with LabelsService with MilestonesService with UsersOnlyAuthenticator with ReadableRepositoryAuthenticator with WritableRepositoryAuthenticator trait IssuesControllerBase extends ControllerBase { - self: IssuesService with RepositoryService with LabelsService + self: IssuesService with RepositoryService with LabelsService with MilestonesService with UsersOnlyAuthenticator with ReadableRepositoryAuthenticator with WritableRepositoryAuthenticator => case class IssueForm(title: String, content: Option[String]) @@ -32,13 +32,20 @@ val owner = params("owner") val repository = params("repository") - // search condition - val closed = params.get("state") collect { - case "closed" => true - } getOrElse false + getRepository(owner, repository, baseUrl) match { + case None => NotFound() + case Some(r) => { + // search condition + val closed = params.get("state") collect { + case "closed" => true + } getOrElse false - issues.html.issues(searchIssue(owner, repository, closed), getLabels(owner, repository), - getRepository(owner, repository, baseUrl).get) + issues.html.issues(searchIssue(owner, repository, closed), + getLabels(owner, repository), + getMilestones(owner, repository).filter(_.closedDate.isEmpty), + r, isWritable(owner, repository, context.loginAccount)) + } + } } get("/:owner/:repository/issues/:id"){ diff --git a/src/main/scala/app/LabelsController.scala b/src/main/scala/app/LabelsController.scala index a4bd836..55b4942 100644 --- a/src/main/scala/app/LabelsController.scala +++ b/src/main/scala/app/LabelsController.scala @@ -38,7 +38,7 @@ getRepository(owner, repository, baseUrl) match { case None => NotFound() - case Some(r) => issues.html.labellist(getLabels(owner, repository), r) + case Some(r) => issues.html.labeleditlist(getLabels(owner, repository), r) } }) @@ -65,7 +65,7 @@ case None => NotFound() case Some(r) => { updateLabel(owner, repository, labelId, form.labelName, form.color.substring(1)) - issues.html.labellist(getLabels(owner, repository), r) + issues.html.labeleditlist(getLabels(owner, repository), r) } } }) @@ -79,7 +79,7 @@ case None => NotFound() case Some(r) => { deleteLabel(owner, repository, labelId) - issues.html.labellist(getLabels(owner, repository), r) + issues.html.labeleditlist(getLabels(owner, repository), r) } } }) diff --git a/src/main/twirl/issues/issues.scala.html b/src/main/twirl/issues/issues.scala.html index e6ae319..73e2826 100644 --- a/src/main/twirl/issues/issues.scala.html +++ b/src/main/twirl/issues/issues.scala.html @@ -1,4 +1,4 @@ -@(issues: List[model.Issue], labels: List[model.Label], repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context) +@(issues: List[model.Issue], labels: List[model.Label], milestones: List[model.Milestone], repository: service.RepositoryService.RepositoryInfo, isWrite: Boolean)(implicit context: app.Context) @import context._ @import view.helpers._ @html.main("Issues - " + repository.owner + "/" + repository.name){ @@ -7,12 +7,40 @@

No milestone selected +
+ + +

Labels
@@ -30,11 +58,13 @@
-
- -
- New label - @labeledit(None, repository) + @if(isWrite){ +
+ +
+ New label + @labeledit(None, repository) + }
} +@if(isWrite){ +}