mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-04 20:45:58 +01:00
Fix added issue comment layout.
This commit is contained in:
@@ -69,10 +69,15 @@ trait IssuesControllerBase extends ControllerBase {
|
||||
val issueId = params("issueId").toInt
|
||||
val content = params("content") // TODO input check
|
||||
|
||||
saveComment(owner, repository, context.loginAccount.get.userName, issueId, content)
|
||||
|
||||
contentType = formats("json")
|
||||
org.json4s.jackson.Serialization.write(Map("content" -> content))
|
||||
saveComment(owner, repository, context.loginAccount.get.userName, issueId, content) map {
|
||||
model => org.json4s.jackson.Serialization.write(
|
||||
Map("commentedUserName" -> model.commentedUserName,
|
||||
"registeredDate" -> view.helpers.datetime(model.registeredDate),
|
||||
"content" -> view.Markdown.toHtml(
|
||||
model.content, getRepository(owner, repository, baseUrl).get, false, true, true)
|
||||
))
|
||||
} getOrElse ""
|
||||
})
|
||||
|
||||
}
|
||||
@@ -53,13 +53,15 @@ trait IssuesService {
|
||||
|
||||
def saveComment(owner: String, repository: String, loginUser: String,
|
||||
issueId: Int, content: String) =
|
||||
IssueComments.autoInc insert (
|
||||
owner,
|
||||
repository,
|
||||
issueId,
|
||||
loginUser,
|
||||
content,
|
||||
currentDate,
|
||||
currentDate)
|
||||
Query(IssueComments) filter {
|
||||
_.commentId is ( IssueComments.autoInc insert (
|
||||
owner,
|
||||
repository,
|
||||
issueId,
|
||||
loginUser,
|
||||
content,
|
||||
currentDate,
|
||||
currentDate) ).bind
|
||||
} firstOption
|
||||
|
||||
}
|
||||
@@ -48,7 +48,14 @@ $(function(){
|
||||
content : $('#content').val()
|
||||
},
|
||||
function(data){
|
||||
$('#comment-area').html(data.content);
|
||||
var div = $('<div>').addClass('box')
|
||||
.append($('<div>').addClass('box-header-small')
|
||||
.append($('<a>').attr('href', '@path/@repository.owner').text(data.commentedUserName))
|
||||
.append(' commented')
|
||||
.append($('<span>').addClass('pull-right').text(data.registeredDate)))
|
||||
.append($('<div>').addClass('box-content').attr('style', 'background-color: #f5f5f5;').html(data.content));
|
||||
$('#comment-area').append(div);
|
||||
$('#content').val('');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user