mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-09 15:05:50 +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
|
// 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 owner = params("owner")
|
||||||
val repository = params("repository")
|
val repository = params("repository")
|
||||||
|
|
||||||
@@ -67,20 +67,18 @@ trait IssuesControllerBase extends ControllerBase {
|
|||||||
createIssue(owner, repository, context.loginAccount.get.userName, form.title, form.content)))
|
createIssue(owner, repository, context.loginAccount.get.userName, form.title, form.content)))
|
||||||
})
|
})
|
||||||
|
|
||||||
// TODO Authenticator, Validation
|
// TODO Authenticator
|
||||||
post("/:owner/:repository/issues/:id"){
|
ajaxPost("/:owner/:repository/issues/edit/:id", form){ form =>
|
||||||
val owner = params("owner")
|
val owner = params("owner")
|
||||||
val repository = params("repository")
|
val repository = params("repository")
|
||||||
val issueId = params("id").toInt
|
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))
|
redirect("/%s/%s/issues/_data/%d".format(owner, repository, issueId))
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO requires users only and readable repository checking
|
// 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 owner = params("owner")
|
||||||
val repository = params("repository")
|
val repository = params("repository")
|
||||||
|
|
||||||
@@ -88,17 +86,16 @@ trait IssuesControllerBase extends ControllerBase {
|
|||||||
createComment(owner, repository, context.loginAccount.get.userName, form.issueId, form.content)))
|
createComment(owner, repository, context.loginAccount.get.userName, form.issueId, form.content)))
|
||||||
})
|
})
|
||||||
|
|
||||||
// TODO Authenticator, Validation
|
// TODO Authenticator, repository checking
|
||||||
post("/:owner/:repository/issue_comments/:id"){
|
ajaxPost("/:owner/:repository/issue_comments/edit/:id", commentForm){ form =>
|
||||||
val commentId = params("id").toInt
|
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))
|
redirect("/%s/%s/issue_comments/_data/%d".format(params("owner"), params("repository"), commentId))
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Authenticator
|
// TODO Authenticator
|
||||||
get("/:owner/:repository/issues/_data/:id"){
|
ajaxGet("/:owner/:repository/issues/_data/:id"){
|
||||||
getIssue(params("owner"), params("repository"), params("id")) map { x =>
|
getIssue(params("owner"), params("repository"), params("id")) map { x =>
|
||||||
params.get("dataType") collect {
|
params.get("dataType") collect {
|
||||||
case t if t == "html" => issues.html.edit(
|
case t if t == "html" => issues.html.edit(
|
||||||
@@ -115,7 +112,7 @@ trait IssuesControllerBase extends ControllerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO Authenticator
|
// TODO Authenticator
|
||||||
get("/:owner/:repository/issue_comments/_data/:id"){
|
ajaxGet("/:owner/:repository/issue_comments/_data/:id"){
|
||||||
getComment(params("id")) map { x =>
|
getComment(params("id")) map { x =>
|
||||||
params.get("dataType") collect {
|
params.get("dataType") collect {
|
||||||
case t if t == "html" => issues.html.edit(
|
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) "#commentContent-" + key else "#issueContent"} input.btn').click(function(){
|
||||||
@if(isComment){
|
@if(isComment){
|
||||||
var url = '@path/@owner/@repository/issue_comments/@key';
|
var url = '@path/@owner/@repository/issue_comments/edit/@key';
|
||||||
var param = {
|
var param = {
|
||||||
|
issueId : 0, // TODO
|
||||||
content : $('#edit-content-@key').val()
|
content : $('#edit-content-@key').val()
|
||||||
};
|
};
|
||||||
}else{
|
}else{
|
||||||
var url = '@path/@owner/@repository/issues/@key';
|
var url = '@path/@owner/@repository/issues/edit/@key';
|
||||||
var param = {
|
var param = {
|
||||||
title : $('#edit-title').val(),
|
title : $('#edit-title').val(),
|
||||||
content : $('#edit-content').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(){
|
$('@{if(isComment) "#commentContent-" + key else "#issueContent"} a.btn').click(function(){
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</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">
|
||||||
<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;")
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span9">
|
<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">
|
||||||
<div class="box-content">
|
<div class="box-content">
|
||||||
<span id="error-title" class="error"></span>
|
<span id="error-title" class="error"></span>
|
||||||
|
|||||||
Reference in New Issue
Block a user