mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-02 03:26:06 +01:00
Implemented the label edit process.
This commit is contained in:
@@ -61,7 +61,7 @@ trait IssuesControllerBase extends ControllerBase {
|
||||
issues.html.issue(
|
||||
_,
|
||||
getComments(owner, repository, issueId.toInt),
|
||||
getIssueLabel(owner, repository, issueId.toInt),
|
||||
getIssueLabels(owner, repository, issueId.toInt),
|
||||
(getCollaborators(owner, repository) :+ owner).sorted,
|
||||
getMilestones(owner, repository),
|
||||
getLabels(owner, repository),
|
||||
@@ -115,16 +115,6 @@ trait IssuesControllerBase extends ControllerBase {
|
||||
redirect("/%s/%s/issues/_data/%d".format(owner, repository, issueId))
|
||||
}
|
||||
|
||||
// TODO Authenticator
|
||||
ajaxPost("/:owner/:repository/issues/:id/label/:labelId/new"){
|
||||
"TODO Insert!"
|
||||
}
|
||||
|
||||
// TODO Authenticator
|
||||
ajaxPost("/:owner/:repository/issues/:id/label/:labelId/delete"){
|
||||
"TODO Delete!"
|
||||
}
|
||||
|
||||
// TODO requires users only and readable repository checking
|
||||
post("/:owner/:repository/issue_comments/new", commentForm)( usersOnly { form =>
|
||||
val owner = params("owner")
|
||||
@@ -178,6 +168,28 @@ trait IssuesControllerBase extends ControllerBase {
|
||||
} getOrElse NotFound
|
||||
}
|
||||
|
||||
// TODO Authenticator
|
||||
ajaxPost("/:owner/:repository/issues/:id/label/new"){
|
||||
val owner = params("owner")
|
||||
val repository = params("repository")
|
||||
val issueId = params("id").toInt
|
||||
|
||||
registerIssueLabel(owner, repository, issueId, params("labelId").toInt)
|
||||
|
||||
issues.html.labellist(getIssueLabels(owner, repository, issueId))
|
||||
}
|
||||
|
||||
// TODO Authenticator
|
||||
ajaxPost("/:owner/:repository/issues/:id/label/delete"){
|
||||
val owner = params("owner")
|
||||
val repository = params("repository")
|
||||
val issueId = params("id").toInt
|
||||
|
||||
deleteIssueLabel(owner, repository, issueId, params("labelId").toInt)
|
||||
|
||||
issues.html.labellist(getIssueLabels(owner, repository, issueId))
|
||||
}
|
||||
|
||||
ajaxPost("/:owner/:repository/issues/assign/:id"){
|
||||
val owner = params("owner")
|
||||
val repository = params("repository")
|
||||
|
||||
@@ -25,7 +25,7 @@ trait IssuesService {
|
||||
Query(IssueComments) filter (_.byPrimaryKey(commentId.toInt)) firstOption
|
||||
else None
|
||||
|
||||
def getIssueLabel(owner: String, repository: String, issueId: Int) =
|
||||
def getIssueLabels(owner: String, repository: String, issueId: Int) =
|
||||
IssueLabels
|
||||
.innerJoin(Labels).on { (t1, t2) =>
|
||||
t1.byLabel(t2.userName, t2.repositoryName, t2.labelId)
|
||||
|
||||
@@ -189,21 +189,22 @@ $(function(){
|
||||
});
|
||||
|
||||
$('a.toggle-label').click(function(){
|
||||
var url = '@url(repository)/issues/@issue.issueId/label/' + $(this).data('label-id');
|
||||
var icon;
|
||||
var path, icon;
|
||||
var i = $(this).children('i');
|
||||
if(i.hasClass('icon-ok')){
|
||||
url += '/delete';
|
||||
path = 'delete';
|
||||
icon = 'icon-white';
|
||||
} else {
|
||||
url += '/new';
|
||||
path = 'new';
|
||||
icon = 'icon-ok';
|
||||
}
|
||||
$.post(url,
|
||||
$.post('@url(repository)/issues/@issue.issueId/label/' + path,
|
||||
{
|
||||
labelId : $(this).data('label-id')
|
||||
},
|
||||
function(data){
|
||||
i.removeClass().addClass(icon);
|
||||
// TODO label sort
|
||||
alert(data);
|
||||
$('ul.label-list').empty().html(data);
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user