mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-09 15:05:50 +01:00
Merge branch 'master' of https://github.com/takezoe/gitbucket
This commit is contained in:
@@ -66,11 +66,13 @@ trait IssuesControllerBase extends ControllerBase {
|
|||||||
post("/:owner/:repository/issue_comments")( usersOnly {
|
post("/:owner/:repository/issue_comments")( usersOnly {
|
||||||
val owner = params("owner")
|
val owner = params("owner")
|
||||||
val repository = params("repository")
|
val repository = params("repository")
|
||||||
val issueId = params("issueId")
|
val issueId = params("issueId").toInt
|
||||||
val content = params("content")
|
val content = params("content") // TODO input check
|
||||||
|
|
||||||
// TODO Returns JSON
|
saveComment(owner, repository, context.loginAccount.get.userName, issueId, content)
|
||||||
redirect("/%s/%s/issues/%d".format(owner, repository, 1))
|
|
||||||
|
contentType = formats("json")
|
||||||
|
org.json4s.jackson.Serialization.write(Map("content" -> content))
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -51,4 +51,15 @@ trait IssuesService {
|
|||||||
}.map(_.issueId).update(id) > 0
|
}.map(_.issueId).update(id) > 0
|
||||||
} get
|
} get
|
||||||
|
|
||||||
|
def saveComment(owner: String, repository: String, loginUser: String,
|
||||||
|
issueId: Int, content: String) =
|
||||||
|
IssueComments.autoInc insert (
|
||||||
|
owner,
|
||||||
|
repository,
|
||||||
|
issueId,
|
||||||
|
loginUser,
|
||||||
|
content,
|
||||||
|
currentDate,
|
||||||
|
currentDate)
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -19,15 +19,13 @@
|
|||||||
@markdown(issue.content getOrElse "No description given.", repository, false, true, true)
|
@markdown(issue.content getOrElse "No description given.", repository, false, true, true)
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<form action="@path/@repository.owner/@repository.name/issue_comments" method="POST">
|
<span id="comment-area"></span>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<div class="box-content">
|
<div class="box-content">
|
||||||
@html.preview(repository, "", false, true, true, "width: 730px; height: 100px;")
|
@html.preview(repository, "", false, true, true, "width: 730px; height: 100px;")
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" name="issueId" value="@issue.issueId"/>
|
<input type="button" class="btn btn-success" value="Comment" id="comment"/>
|
||||||
<input type="submit" class="btn btn-success" value="Comment"/>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="span2">
|
<div class="span2">
|
||||||
@if(issue.closed) {
|
@if(issue.closed) {
|
||||||
@@ -40,4 +38,18 @@
|
|||||||
<strong>Labels</strong>
|
<strong>Labels</strong>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
<script>
|
||||||
|
$(function(){
|
||||||
|
$('#comment').click(function(){
|
||||||
|
$.post('@path/@repository.owner/@repository.name/issue_comments',
|
||||||
|
{
|
||||||
|
issueId : @issue.issueId,
|
||||||
|
content : $('#content').val()
|
||||||
|
},
|
||||||
|
function(data){
|
||||||
|
$('#comment-area').html(data.content);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user