mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-09 15:05:50 +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 issueId = params("issueId").toInt
|
||||||
val content = params("content") // TODO input check
|
val content = params("content") // TODO input check
|
||||||
|
|
||||||
saveComment(owner, repository, context.loginAccount.get.userName, issueId, content)
|
|
||||||
|
|
||||||
contentType = formats("json")
|
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,
|
def saveComment(owner: String, repository: String, loginUser: String,
|
||||||
issueId: Int, content: String) =
|
issueId: Int, content: String) =
|
||||||
IssueComments.autoInc insert (
|
Query(IssueComments) filter {
|
||||||
owner,
|
_.commentId is ( IssueComments.autoInc insert (
|
||||||
repository,
|
owner,
|
||||||
issueId,
|
repository,
|
||||||
loginUser,
|
issueId,
|
||||||
content,
|
loginUser,
|
||||||
currentDate,
|
content,
|
||||||
currentDate)
|
currentDate,
|
||||||
|
currentDate) ).bind
|
||||||
|
} firstOption
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -48,7 +48,14 @@ $(function(){
|
|||||||
content : $('#content').val()
|
content : $('#content').val()
|
||||||
},
|
},
|
||||||
function(data){
|
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