mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-03 20:15:59 +01:00
Fix ajax request.
This commit is contained in:
@@ -59,7 +59,7 @@ trait IssuesControllerBase extends ControllerBase {
|
||||
})
|
||||
|
||||
// TODO requires users only and readable repository checking
|
||||
post("/:owner/:repository/issues", form)( usersOnly { form =>
|
||||
post("/:owner/:repository/issues/new", form)( usersOnly { form =>
|
||||
val owner = params("owner")
|
||||
val repository = params("repository")
|
||||
|
||||
@@ -67,20 +67,18 @@ trait IssuesControllerBase extends ControllerBase {
|
||||
createIssue(owner, repository, context.loginAccount.get.userName, form.title, form.content)))
|
||||
})
|
||||
|
||||
// TODO Authenticator, Validation
|
||||
post("/:owner/:repository/issues/:id"){
|
||||
// TODO Authenticator
|
||||
ajaxPost("/:owner/:repository/issues/edit/:id", form){ form =>
|
||||
val owner = params("owner")
|
||||
val repository = params("repository")
|
||||
val issueId = params("id").toInt
|
||||
val title = params("title")
|
||||
val content = params.get("content")
|
||||
|
||||
updateIssue(owner, repository, issueId, title, content)
|
||||
updateIssue(owner, repository, issueId, form.title, form.content)
|
||||
redirect("/%s/%s/issues/_data/%d".format(owner, repository, issueId))
|
||||
}
|
||||
|
||||
// TODO requires users only and readable repository checking
|
||||
post("/:owner/:repository/issue_comments", commentForm)( usersOnly { form =>
|
||||
post("/:owner/:repository/issue_comments/new", commentForm)( usersOnly { form =>
|
||||
val owner = params("owner")
|
||||
val repository = params("repository")
|
||||
|
||||
@@ -88,17 +86,16 @@ trait IssuesControllerBase extends ControllerBase {
|
||||
createComment(owner, repository, context.loginAccount.get.userName, form.issueId, form.content)))
|
||||
})
|
||||
|
||||
// TODO Authenticator, Validation
|
||||
post("/:owner/:repository/issue_comments/:id"){
|
||||
// TODO Authenticator, repository checking
|
||||
ajaxPost("/:owner/:repository/issue_comments/edit/:id", commentForm){ form =>
|
||||
val commentId = params("id").toInt
|
||||
val content = params("content")
|
||||
|
||||
updateComment(commentId, content)
|
||||
updateComment(commentId, form.content)
|
||||
redirect("/%s/%s/issue_comments/_data/%d".format(params("owner"), params("repository"), commentId))
|
||||
}
|
||||
|
||||
// TODO Authenticator
|
||||
get("/:owner/:repository/issues/_data/:id"){
|
||||
ajaxGet("/:owner/:repository/issues/_data/:id"){
|
||||
getIssue(params("owner"), params("repository"), params("id")) map { x =>
|
||||
params.get("dataType") collect {
|
||||
case t if t == "html" => issues.html.edit(
|
||||
@@ -115,7 +112,7 @@ trait IssuesControllerBase extends ControllerBase {
|
||||
}
|
||||
|
||||
// TODO Authenticator
|
||||
get("/:owner/:repository/issue_comments/_data/:id"){
|
||||
ajaxGet("/:owner/:repository/issue_comments/_data/:id"){
|
||||
getComment(params("id")) map { x =>
|
||||
params.get("dataType") collect {
|
||||
case t if t == "html" => issues.html.edit(
|
||||
|
||||
@@ -20,18 +20,25 @@ $(function(){
|
||||
|
||||
$('@{if(isComment) "#commentContent-" + key else "#issueContent"} input.btn').click(function(){
|
||||
@if(isComment){
|
||||
var url = '@path/@owner/@repository/issue_comments/@key';
|
||||
var url = '@path/@owner/@repository/issue_comments/edit/@key';
|
||||
var param = {
|
||||
issueId : 0, // TODO
|
||||
content : $('#edit-content-@key').val()
|
||||
};
|
||||
}else{
|
||||
var url = '@path/@owner/@repository/issues/@key';
|
||||
var url = '@path/@owner/@repository/issues/edit/@key';
|
||||
var param = {
|
||||
title : $('#edit-title').val(),
|
||||
content : $('#edit-content').val()
|
||||
};
|
||||
}
|
||||
$.post(url, param, callback);
|
||||
$.ajax({
|
||||
url: url, type: 'POST', data: param
|
||||
}).done(
|
||||
callback
|
||||
).fail(function(req) {
|
||||
displayErrors($.parseJSON(req.responseText));
|
||||
});
|
||||
});
|
||||
|
||||
$('@{if(isComment) "#commentContent-" + key else "#issueContent"} a.btn').click(function(){
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
<form action="@url(repository)/issue_comments" method="POST" validate="true">
|
||||
<form action="@url(repository)/issue_comments/new" method="POST" validate="true">
|
||||
<div class="box">
|
||||
<div class="box-content">
|
||||
@html.preview(repository, "", false, true, true, "width: 730px; height: 100px;")
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="span9">
|
||||
<form action="@url(repository)/issues" method="POST" validate="true">
|
||||
<form action="@url(repository)/issues/new" method="POST" validate="true">
|
||||
<div class="box">
|
||||
<div class="box-content">
|
||||
<span id="error-title" class="error"></span>
|
||||
|
||||
Reference in New Issue
Block a user