mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-10 15:35:59 +01:00
(refs #1152)Fix label and milestone editing
This commit is contained in:
@@ -23,6 +23,7 @@ trait LabelsControllerBase extends ControllerBase {
|
||||
"labelColor" -> trim(label("Color", text(required, color)))
|
||||
)(LabelForm.apply)
|
||||
|
||||
|
||||
get("/:owner/:repository/issues/labels")(referrersOnly { repository =>
|
||||
html.list(
|
||||
getLabels(repository.owner, repository.name),
|
||||
@@ -84,8 +85,12 @@ trait LabelsControllerBase extends ControllerBase {
|
||||
override def validate(name: String, value: String, params: Map[String, String], messages: Messages): Option[String] = {
|
||||
val owner = params("owner")
|
||||
val repository = params("repository")
|
||||
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.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,11 @@
|
||||
@import gitbucket.core.view.helpers._
|
||||
@html.main(s"Labels - ${repository.owner}/${repository.name}"){
|
||||
@html.menu("labels", repository){
|
||||
@if(loginAccount.isDefined){
|
||||
<div class="pull-right" style="margin-bottom: 10px;">
|
||||
<a class="btn btn-success" href="javascript:void(0);" id="new-label-button">New label</a>
|
||||
</div>
|
||||
}
|
||||
<table class="table table-bordered table-hover table-issues" id="new-label-table" style="display: none;">
|
||||
<tr><td></td></tr>
|
||||
</table>
|
||||
|
||||
@@ -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)
|
||||
<ul class="nav nav-pills pull-left" style="line-height: 14px; margin-bottom: 10px;">
|
||||
<li class="@if(condition.state == "open"){active}">
|
||||
<a href="@condition.copy(state = "open").toURL">Open <span class="badge">@openCount</span></a>
|
||||
</li>
|
||||
<li class="@if(condition.state == "closed"){active}">
|
||||
<a href="@condition.copy(state = "closed").toURL">Closed <span class="badge">@closedCount</span></a>
|
||||
</li>
|
||||
</ul>
|
||||
<form method="GET" id="search-filter-form" class="form-inline pull-right">
|
||||
@if(loginAccount.isDefined){
|
||||
@if(target == "issues"){
|
||||
<a class="btn btn-success" href="@url(repository)/issues/new">New issue</a>
|
||||
}
|
||||
@if(target == "pulls"){
|
||||
<a class="btn btn-success" href="@url(repository)/compare">New pull request</a>
|
||||
}
|
||||
}
|
||||
</form>
|
||||
@listparts(target, issues, page, openCount, closedCount, condition, collaborators, milestones, labels, Some(repository), hasWritePermission)
|
||||
@if(hasWritePermission){
|
||||
<form id="batcheditForm" method="POST">
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<hr>
|
||||
<div class="pull-right">
|
||||
@if(milestone.isEmpty){
|
||||
<input type="submit" class="btn btn-default" value="Create milestone"/>
|
||||
<input type="submit" class="btn btn-success" value="Create milestone"/>
|
||||
} else {
|
||||
@if(milestone.get.closedDate.isDefined){
|
||||
<input type="button" class="btn btn-default" value="Open" id="open"
|
||||
@@ -36,7 +36,7 @@
|
||||
<input type="button" class="btn btn-default" value="Close" id="close"
|
||||
onclick="location.href='@url(repository)/issues/milestones/@milestone.get.milestoneId/open';"/>
|
||||
}
|
||||
<input type="submit" class="btn btn-default" value="Update milestone"/>
|
||||
<input type="submit" class="btn btn-success" value="Update milestone"/>
|
||||
}
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -6,6 +6,11 @@
|
||||
@import gitbucket.core.view.helpers._
|
||||
@html.main(s"Milestones - ${repository.owner}/${repository.name}"){
|
||||
@html.menu("milestones", repository){
|
||||
@if(loginAccount.isDefined){
|
||||
<div class="pull-right" style="margin-bottom: 10px;">
|
||||
<a class="btn btn-success" href="@url(repository)/issues/milestones/new">New milestone</a>
|
||||
</div>
|
||||
}
|
||||
<table class="table table-bordered table-hover table-issues">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -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._
|
||||
|
||||
<ul class="nav nav-pills pull-left" style="line-height: 14px; margin-bottom: 10px;">
|
||||
<li class="@if(condition.state == "open"){active}">
|
||||
<a href="@condition.copy(state = "open").toURL">Open <span class="badge">@openCount</span></a>
|
||||
</li>
|
||||
<li class="@if(condition.state == "closed"){active}">
|
||||
<a href="@condition.copy(state = "closed").toURL">Closed <span class="badge">@closedCount</span></a>
|
||||
</li>
|
||||
</ul>
|
||||
<form method="GET" id="search-filter-form" class="form-inline pull-right">
|
||||
@if(loginAccount.isDefined){
|
||||
@if(newButton){
|
||||
@if(active == "issues"){
|
||||
<a class="btn btn-success" href="@url(repository)/issues/new">New issue</a>
|
||||
}
|
||||
@if(active == "pulls"){
|
||||
<a class="btn btn-success" href="@url(repository)/compare">New pull request</a>
|
||||
}
|
||||
@if(active == "labels"){
|
||||
<a class="btn btn-success" href="javascript:void(0);" id="new-label-button">New label</a>
|
||||
}
|
||||
@if(active == "milestones"){
|
||||
<a class="btn btn-success" href="@url(repository)/issues/milestones/new">New milestone</a>
|
||||
}
|
||||
}
|
||||
}
|
||||
</form>
|
||||
Reference in New Issue
Block a user