mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-09 06:55:54 +01:00
Add the cancellation process of the issue.
This commit is contained in:
@@ -53,7 +53,9 @@ trait IssuesControllerBase extends ControllerBase {
|
||||
|
||||
// TODO requires users only and readable repository checking
|
||||
get("/:owner/:repository/issues/new")( usersOnly {
|
||||
issues.html.issueedit(getRepository(params("owner"), params("repository"), baseUrl).get)
|
||||
getRepository(params("owner"), params("repository"), baseUrl)
|
||||
.map (issues.html.issueedit(_))
|
||||
.getOrElse (NotFound)
|
||||
})
|
||||
|
||||
// TODO requires users only and readable repository checking
|
||||
@@ -74,13 +76,7 @@ trait IssuesControllerBase extends ControllerBase {
|
||||
val content = params.get("content")
|
||||
|
||||
updateIssue(owner, repository, issueId, title, content)
|
||||
|
||||
contentType = formats("json")
|
||||
|
||||
org.json4s.jackson.Serialization.write(
|
||||
Map("title" -> title,
|
||||
"content" -> view.Markdown.toHtml(content getOrElse "No description given.",
|
||||
getRepository(owner, repository, baseUrl).get, false, true, true)))
|
||||
redirect("/%s/%s/issues/_data/%d".format(owner, repository, issueId))
|
||||
}
|
||||
|
||||
// TODO requires users only and readable repository checking
|
||||
@@ -98,23 +94,39 @@ trait IssuesControllerBase extends ControllerBase {
|
||||
val content = params("content")
|
||||
|
||||
updateComment(commentId, content)
|
||||
|
||||
contentType = formats("json")
|
||||
|
||||
org.json4s.jackson.Serialization.write(
|
||||
Map("content" -> view.Markdown.toHtml(content,
|
||||
getRepository(params("owner"), params("repository"), baseUrl).get, false, true, true)))
|
||||
redirect("/%s/%s/issue_comments/_data/%d".format(params("owner"), params("repository"), commentId))
|
||||
}
|
||||
|
||||
// TODO Authenticator
|
||||
get("/:owner/:repository/issues/_data/:id"){
|
||||
getIssue(params("owner"), params("repository"), params("id")) map { x =>
|
||||
issues.html.edit(Some(x.title), x.content.getOrElse(""), x.issueId, x.userName, x.repositoryName)
|
||||
params.get("dataType") collect {
|
||||
case t if t == "html" => issues.html.edit(
|
||||
Some(x.title), x.content getOrElse "", x.issueId, x.userName, x.repositoryName)
|
||||
} getOrElse {
|
||||
contentType = formats("json")
|
||||
org.json4s.jackson.Serialization.write(
|
||||
Map("title" -> x.title,
|
||||
"content" -> view.Markdown.toHtml(x.content getOrElse "No description given.",
|
||||
getRepository(x.userName, x.repositoryName, baseUrl).get, false, true, true)
|
||||
))
|
||||
}
|
||||
} getOrElse NotFound
|
||||
}
|
||||
|
||||
// TODO Authenticator
|
||||
get("/:owner/:repository/issue_comments/_data/:id"){
|
||||
getComment(params("id")) map { x =>
|
||||
issues.html.edit(None, x.content, x.commentId, x.userName, x.repositoryName)
|
||||
params.get("dataType") collect {
|
||||
case t if t == "html" => issues.html.edit(
|
||||
None, x.content, x.commentId, x.userName, x.repositoryName)
|
||||
} getOrElse {
|
||||
contentType = formats("json")
|
||||
org.json4s.jackson.Serialization.write(
|
||||
Map("content" -> view.Markdown.toHtml(x.content,
|
||||
getRepository(x.userName, x.repositoryName, baseUrl).get, false, true, true)
|
||||
))
|
||||
}
|
||||
} getOrElse NotFound
|
||||
}
|
||||
|
||||
|
||||
@@ -9,31 +9,39 @@
|
||||
<span class="pull-right"><a class="btn btn-small btn-danger" href="#">Cancel</a></span>
|
||||
<script>
|
||||
$(function(){
|
||||
var callback = function(data){
|
||||
@if(isComment){
|
||||
$('#commentContent-@key').empty().html(data.content);
|
||||
}else{
|
||||
$('#issueTitle').empty().text(data.title);
|
||||
$('#issueContent').empty().html(data.content);
|
||||
}
|
||||
};
|
||||
|
||||
$('@{if(isComment) "#commentContent-" + key else "#issueContent"} input.btn').click(function(){
|
||||
@if(isComment){
|
||||
var url = '@path/@owner/@repository/issue_comments/@key';
|
||||
var param = {
|
||||
content : $('#edit-content-@key').val()
|
||||
};
|
||||
var func = function(data){
|
||||
$('#commentContent-@key').empty().html(data.content);
|
||||
};
|
||||
}else{
|
||||
var url = '@path/@owner/@repository/issues/@key';
|
||||
var param = {
|
||||
title : $('#edit-title').val(),
|
||||
content : $('#edit-content').val()
|
||||
};
|
||||
var func = function(data){
|
||||
$('#issueTitle').empty().text(data.title);
|
||||
$('#issueContent').empty().html(data.content);
|
||||
};
|
||||
}
|
||||
$.post(url, param, func);
|
||||
$.post(url, param, callback);
|
||||
});
|
||||
|
||||
$('#cancel').click(function(){
|
||||
|
||||
$('@{if(isComment) "#commentContent-" + key else "#issueContent"} a.btn').click(function(){
|
||||
var url = @if(isComment){
|
||||
'@path/@owner/@repository/issue_comments/_data/@key'
|
||||
}else{
|
||||
'@path/@owner/@repository/issues/_data/@key'
|
||||
};
|
||||
$.get(url, callback);
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -60,6 +60,9 @@
|
||||
$(function(){
|
||||
$('#edit').click(function(){
|
||||
$.get('@path/@repository.owner/@repository.name/issues/_data/@issue.issueId',
|
||||
{
|
||||
dataType : 'html'
|
||||
},
|
||||
function(data){
|
||||
$('#issueContent').empty().html(data);
|
||||
});
|
||||
@@ -69,6 +72,9 @@ $(function(){
|
||||
$('i.icon-pencil').click(function(){
|
||||
var id = $(this).closest('a').data('comment-id');
|
||||
$.get('@path/@repository.owner/@repository.name/issue_comments/_data/' + id,
|
||||
{
|
||||
dataType : 'html'
|
||||
},
|
||||
function(data){
|
||||
$('#commentContent-' + id).empty().html(data);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user