diff --git a/src/main/scala/gitbucket/core/controller/LabelsController.scala b/src/main/scala/gitbucket/core/controller/LabelsController.scala index 9ebdf6e..9b17841 100644 --- a/src/main/scala/gitbucket/core/controller/LabelsController.scala +++ b/src/main/scala/gitbucket/core/controller/LabelsController.scala @@ -23,6 +23,7 @@ "labelColor" -> trim(label("Color", text(required, color))) )(LabelForm.apply) + get("/:owner/:repository/issues/labels")(referrersOnly { repository => html.list( getLabels(repository.owner, repository.name), @@ -84,7 +85,11 @@ override def validate(name: String, value: String, params: Map[String, String], messages: Messages): Option[String] = { val owner = params("owner") val repository = params("repository") - getLabel(owner, repository, value).map(_ => "Name has already been taken.") + params.get("labelId").map { labelId => + getLabel(owner, repository, value).filter(_.labelId != labelId.toInt).map(_ => "Name has already been taken.") + }.getOrElse { + getLabel(owner, repository, value).map(_ => "Name has already been taken.") + } } } diff --git a/src/main/twirl/gitbucket/core/issues/labels/list.scala.html b/src/main/twirl/gitbucket/core/issues/labels/list.scala.html index 9192e97..a33dfb1 100644 --- a/src/main/twirl/gitbucket/core/issues/labels/list.scala.html +++ b/src/main/twirl/gitbucket/core/issues/labels/list.scala.html @@ -6,6 +6,11 @@ @import gitbucket.core.view.helpers._ @html.main(s"Labels - ${repository.owner}/${repository.name}"){ @html.menu("labels", repository){ + @if(loginAccount.isDefined){ +
+ New label +
+ } diff --git a/src/main/twirl/gitbucket/core/issues/list.scala.html b/src/main/twirl/gitbucket/core/issues/list.scala.html index a1d7240..9743186 100644 --- a/src/main/twirl/gitbucket/core/issues/list.scala.html +++ b/src/main/twirl/gitbucket/core/issues/list.scala.html @@ -13,7 +13,24 @@ @import gitbucket.core.view.helpers._ @html.main((if(target == "issues") "Issues" else "Pull requests") + s" - ${repository.owner}/${repository.name}", Some(repository)){ @html.menu(target, repository){ - @navigation(target, true, repository, openCount, closedCount, condition) + +
+ @if(loginAccount.isDefined){ + @if(target == "issues"){ + New issue + } + @if(target == "pulls"){ + New pull request + } + } +
@listparts(target, issues, page, openCount, closedCount, condition, collaborators, milestones, labels, Some(repository), hasWritePermission) @if(hasWritePermission){
diff --git a/src/main/twirl/gitbucket/core/issues/milestones/edit.scala.html b/src/main/twirl/gitbucket/core/issues/milestones/edit.scala.html index dff0f46..1b82c28 100644 --- a/src/main/twirl/gitbucket/core/issues/milestones/edit.scala.html +++ b/src/main/twirl/gitbucket/core/issues/milestones/edit.scala.html @@ -27,7 +27,7 @@
@if(milestone.isEmpty){ - + } else { @if(milestone.get.closedDate.isDefined){ } - + }
diff --git a/src/main/twirl/gitbucket/core/issues/milestones/list.scala.html b/src/main/twirl/gitbucket/core/issues/milestones/list.scala.html index fca9107..c183cac 100644 --- a/src/main/twirl/gitbucket/core/issues/milestones/list.scala.html +++ b/src/main/twirl/gitbucket/core/issues/milestones/list.scala.html @@ -6,6 +6,11 @@ @import gitbucket.core.view.helpers._ @html.main(s"Milestones - ${repository.owner}/${repository.name}"){ @html.menu("milestones", repository){ + @if(loginAccount.isDefined){ +
+ New milestone +
+ } diff --git a/src/main/twirl/gitbucket/core/issues/navigation.scala.html b/src/main/twirl/gitbucket/core/issues/navigation.scala.html deleted file mode 100644 index fadd6d3..0000000 --- a/src/main/twirl/gitbucket/core/issues/navigation.scala.html +++ /dev/null @@ -1,35 +0,0 @@ -@(active: String, - newButton: Boolean, - repository: gitbucket.core.service.RepositoryService.RepositoryInfo, - openCount: Int, - closedCount: Int, - condition: gitbucket.core.service.IssuesService.IssueSearchCondition)(implicit context: gitbucket.core.controller.Context) -@import context._ -@import gitbucket.core.view.helpers._ - - - - @if(loginAccount.isDefined){ - @if(newButton){ - @if(active == "issues"){ - New issue - } - @if(active == "pulls"){ - New pull request - } - @if(active == "labels"){ - New label - } - @if(active == "milestones"){ - New milestone - } - } - } -