mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-08 06:25:51 +01:00
(refs #265)Label editing for the pull request.
This commit is contained in:
@@ -21,12 +21,12 @@ import org.eclipse.jgit.errors.NoMergeBaseException
|
|||||||
import service.WebHookService.WebHookPayload
|
import service.WebHookService.WebHookPayload
|
||||||
|
|
||||||
class PullRequestsController extends PullRequestsControllerBase
|
class PullRequestsController extends PullRequestsControllerBase
|
||||||
with RepositoryService with AccountService with IssuesService with PullRequestService with MilestonesService with ActivityService with WebHookService
|
with RepositoryService with AccountService with IssuesService with PullRequestService with MilestonesService with LabelsService
|
||||||
with ReferrerAuthenticator with CollaboratorsAuthenticator
|
with ActivityService with WebHookService with ReferrerAuthenticator with CollaboratorsAuthenticator
|
||||||
|
|
||||||
trait PullRequestsControllerBase extends ControllerBase {
|
trait PullRequestsControllerBase extends ControllerBase {
|
||||||
self: RepositoryService with AccountService with IssuesService with MilestonesService with ActivityService with PullRequestService with WebHookService
|
self: RepositoryService with AccountService with IssuesService with MilestonesService with LabelsService
|
||||||
with ReferrerAuthenticator with CollaboratorsAuthenticator =>
|
with ActivityService with PullRequestService with WebHookService with ReferrerAuthenticator with CollaboratorsAuthenticator =>
|
||||||
|
|
||||||
private val logger = LoggerFactory.getLogger(classOf[PullRequestsControllerBase])
|
private val logger = LoggerFactory.getLogger(classOf[PullRequestsControllerBase])
|
||||||
|
|
||||||
@@ -79,8 +79,10 @@ trait PullRequestsControllerBase extends ControllerBase {
|
|||||||
pulls.html.pullreq(
|
pulls.html.pullreq(
|
||||||
issue, pullreq,
|
issue, pullreq,
|
||||||
getComments(owner, name, issueId),
|
getComments(owner, name, issueId),
|
||||||
|
getIssueLabels(owner, name, issueId.toInt),
|
||||||
(getCollaborators(owner, name) ::: (if(getAccountByUserName(owner).get.isGroupAccount) Nil else List(owner))).sorted,
|
(getCollaborators(owner, name) ::: (if(getAccountByUserName(owner).get.isGroupAccount) Nil else List(owner))).sorted,
|
||||||
getMilestonesWithIssueCount(owner, name),
|
getMilestonesWithIssueCount(owner, name),
|
||||||
|
getLabels(owner, name),
|
||||||
commits,
|
commits,
|
||||||
diffs,
|
diffs,
|
||||||
hasWritePermission(owner, name, context.loginAccount),
|
hasWritePermission(owner, name, context.loginAccount),
|
||||||
|
|||||||
@@ -33,51 +33,7 @@
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<hr/>
|
<hr/>
|
||||||
<div style="margin-bottom: 8px;">
|
@issues.html.labels(issue, issueLabels, labels, hasWritePermission, repository)
|
||||||
<span class="strong">Labels</span>
|
|
||||||
@if(hasWritePermission){
|
|
||||||
<div class="pull-right">
|
|
||||||
@helper.html.dropdown() {
|
|
||||||
@labels.map { label =>
|
|
||||||
<li>
|
|
||||||
<a href="#" class="toggle-label" data-label-id="@label.labelId">
|
|
||||||
@helper.html.checkicon(issueLabels.exists(_.labelId == label.labelId))
|
|
||||||
<span class="label" style="background-color: #@label.color;"> </span>
|
|
||||||
@label.labelName
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
<ul class="label-list nav nav-pills nav-stacked">
|
|
||||||
@labellist(issueLabels)
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
<script>
|
|
||||||
$(function(){
|
|
||||||
$('a.toggle-label').click(function(){
|
|
||||||
var path, icon;
|
|
||||||
var i = $(this).children('i');
|
|
||||||
if(i.hasClass('icon-ok')){
|
|
||||||
path = 'delete';
|
|
||||||
icon = 'icon-white';
|
|
||||||
} else {
|
|
||||||
path = 'new';
|
|
||||||
icon = 'icon-ok';
|
|
||||||
}
|
|
||||||
$.post('@url(repository)/issues/@issue.issueId/label/' + path,
|
|
||||||
{
|
|
||||||
labelId : $(this).data('label-id')
|
|
||||||
},
|
|
||||||
function(data){
|
|
||||||
i.removeClass().addClass(icon);
|
|
||||||
$('ul.label-list').empty().html(data);
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
51
src/main/twirl/issues/labels.scala.html
Normal file
51
src/main/twirl/issues/labels.scala.html
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
@(issue: model.Issue,
|
||||||
|
issueLabels: List[model.Label],
|
||||||
|
labels: List[model.Label],
|
||||||
|
hasWritePermission: Boolean,
|
||||||
|
repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context)
|
||||||
|
@import view.helpers._
|
||||||
|
<div style="margin-bottom: 8px;">
|
||||||
|
<span class="strong">Labels</span>
|
||||||
|
@if(hasWritePermission){
|
||||||
|
<div class="pull-right">
|
||||||
|
@helper.html.dropdown() {
|
||||||
|
@labels.map { label =>
|
||||||
|
<li>
|
||||||
|
<a href="#" class="toggle-label" data-label-id="@label.labelId">
|
||||||
|
@helper.html.checkicon(issueLabels.exists(_.labelId == label.labelId))
|
||||||
|
<span class="label" style="background-color: #@label.color;"> </span>
|
||||||
|
@label.labelName
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<ul class="label-list nav nav-pills nav-stacked">
|
||||||
|
@labellist(issueLabels)
|
||||||
|
</ul>
|
||||||
|
<script>
|
||||||
|
$(function(){
|
||||||
|
$('a.toggle-label').click(function(){
|
||||||
|
var path, icon;
|
||||||
|
var i = $(this).children('i');
|
||||||
|
if(i.hasClass('icon-ok')){
|
||||||
|
path = 'delete';
|
||||||
|
icon = 'icon-white';
|
||||||
|
} else {
|
||||||
|
path = 'new';
|
||||||
|
icon = 'icon-ok';
|
||||||
|
}
|
||||||
|
$.post('@url(repository)/issues/@issue.issueId/label/' + path,
|
||||||
|
{
|
||||||
|
labelId : $(this).data('label-id')
|
||||||
|
},
|
||||||
|
function(data){
|
||||||
|
i.removeClass().addClass(icon);
|
||||||
|
$('ul.label-list').empty().html(data);
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
@(issue: model.Issue,
|
@(issue: model.Issue,
|
||||||
pullreq: model.PullRequest,
|
pullreq: model.PullRequest,
|
||||||
comments: List[model.IssueComment],
|
comments: List[model.IssueComment],
|
||||||
|
issueLabels: List[model.Label],
|
||||||
collaborators: List[String],
|
collaborators: List[String],
|
||||||
milestones: List[(model.Milestone, Int, Int)],
|
milestones: List[(model.Milestone, Int, Int)],
|
||||||
|
labels: List[model.Label],
|
||||||
hasWritePermission: Boolean,
|
hasWritePermission: Boolean,
|
||||||
repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context)
|
repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context)
|
||||||
@import context._
|
@import context._
|
||||||
@@ -63,6 +65,7 @@
|
|||||||
<span class="strong">@comments.size</span> @plural(comments.size, "comment")
|
<span class="strong">@comments.size</span> @plural(comments.size, "comment")
|
||||||
</div>
|
</div>
|
||||||
<hr/>
|
<hr/>
|
||||||
|
@issues.html.labels(issue, issueLabels, labels, hasWritePermission, repository)
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
@(issue: model.Issue,
|
@(issue: model.Issue,
|
||||||
pullreq: model.PullRequest,
|
pullreq: model.PullRequest,
|
||||||
comments: List[model.IssueComment],
|
comments: List[model.IssueComment],
|
||||||
|
issueLabels: List[model.Label],
|
||||||
collaborators: List[String],
|
collaborators: List[String],
|
||||||
milestones: List[(model.Milestone, Int, Int)],
|
milestones: List[(model.Milestone, Int, Int)],
|
||||||
|
labels: List[model.Label],
|
||||||
dayByDayCommits: Seq[Seq[util.JGitUtil.CommitInfo]],
|
dayByDayCommits: Seq[Seq[util.JGitUtil.CommitInfo]],
|
||||||
diffs: Seq[util.JGitUtil.DiffInfo],
|
diffs: Seq[util.JGitUtil.DiffInfo],
|
||||||
hasWritePermission: Boolean,
|
hasWritePermission: Boolean,
|
||||||
@@ -37,7 +39,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<div class="tab-pane active" id="discussion">
|
<div class="tab-pane active" id="discussion">
|
||||||
@pulls.html.discussion(issue, pullreq, comments, collaborators, milestones, hasWritePermission, repository)
|
@pulls.html.discussion(issue, pullreq, comments, issueLabels, collaborators, milestones, labels, hasWritePermission, repository)
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane" id="commits">
|
<div class="tab-pane" id="commits">
|
||||||
@pulls.html.commits(dayByDayCommits, repository)
|
@pulls.html.commits(dayByDayCommits, repository)
|
||||||
|
|||||||
Reference in New Issue
Block a user