Merge remote-tracking branch 'origin/master'

This commit is contained in:
takezoe
2013-07-02 21:26:20 +09:00
4 changed files with 40 additions and 5 deletions

View File

@@ -115,6 +115,16 @@ trait IssuesControllerBase extends ControllerBase {
redirect("/%s/%s/issues/_data/%d".format(owner, repository, issueId)) 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 // TODO requires users only and readable repository checking
post("/:owner/:repository/issue_comments/new", commentForm)( usersOnly { form => post("/:owner/:repository/issue_comments/new", commentForm)( usersOnly { form =>
val owner = params("owner") val owner = params("owner")

View File

@@ -179,9 +179,12 @@ trait IssuesService {
.update (id) > 0 .update (id) > 0
} get } get
def registerIssueLabel(owner: String, repository: String, issueId: Int, labelId: Int): Unit = def registerIssueLabel(owner: String, repository: String, issueId: Int, labelId: Int) =
IssueLabels insert (IssueLabel(owner, repository, issueId, labelId)) IssueLabels insert (IssueLabel(owner, repository, issueId, labelId))
def deleteIssueLabel(owner: String, repository: String, issueId: Int, labelId: Int) =
IssueLabels filter(_.byPrimaryKey(owner, repository, issueId, labelId)) delete
def createComment(owner: String, repository: String, loginUser: String, def createComment(owner: String, repository: String, loginUser: String,
issueId: Int, content: String, action: Option[String]) = issueId: Int, content: String, action: Option[String]) =
IssueComments.autoInc insert ( IssueComments.autoInc insert (

View File

@@ -114,7 +114,7 @@
<ul class="dropdown-menu"> <ul class="dropdown-menu">
@labels.map { label => @labels.map { label =>
<li> <li>
<a href="#"> <a href="#" class="toggle-label" data-label-id="@label.labelId">
<i class="@{if(issueLabels.exists(_.labelId == label.labelId)) "icon-ok" else "icon-white"}"></i> <i class="@{if(issueLabels.exists(_.labelId == label.labelId)) "icon-ok" else "icon-white"}"></i>
<span class="label" style="background-color: #@label.color;">&nbsp;</span> <span class="label" style="background-color: #@label.color;">&nbsp;</span>
@label.labelName @label.labelName
@@ -125,9 +125,7 @@
</div> </div>
</div> </div>
<ul class="label-list"> <ul class="label-list">
@issueLabels.map { label => @labellist(issueLabels)
<li><span class="label" style="background-color: #@label.color;">@label.labelName</span></li>
}
</ul> </ul>
</div> </div>
</div> </div>
@@ -189,5 +187,25 @@ $(function(){
$('#action').click(function(){ $('#action').click(function(){
$('<input type="hidden">').attr('name', 'action').val($(this).val().toLowerCase()).appendTo('form'); $('<input type="hidden">').attr('name', 'action').val($(this).val().toLowerCase()).appendTo('form');
}); });
$('a.toggle-label').click(function(){
var url = '@url(repository)/issues/@issue.issueId/label/' + $(this).data('label-id');
var icon;
var i = $(this).children('i');
if(i.hasClass('icon-ok')){
url += '/delete';
icon = 'icon-white';
} else {
url += '/new';
icon = 'icon-ok';
}
$.post(url,
function(data){
i.removeClass().addClass(icon);
// TODO label sort
alert(data);
});
return false;
});
}); });
</script> </script>

View File

@@ -0,0 +1,4 @@
@(issueLabels: List[model.Label])
@issueLabels.map { label =>
<li><span class="label" style="background-color: #@label.color;">@label.labelName</span></li>
}