mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-09 15:05:50 +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
|
// TODO requires users only and readable repository checking
|
||||||
get("/:owner/:repository/issues/new")( usersOnly {
|
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
|
// TODO requires users only and readable repository checking
|
||||||
@@ -74,13 +76,7 @@ trait IssuesControllerBase extends ControllerBase {
|
|||||||
val content = params.get("content")
|
val content = params.get("content")
|
||||||
|
|
||||||
updateIssue(owner, repository, issueId, title, content)
|
updateIssue(owner, repository, issueId, title, content)
|
||||||
|
redirect("/%s/%s/issues/_data/%d".format(owner, repository, issueId))
|
||||||
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)))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO requires users only and readable repository checking
|
// TODO requires users only and readable repository checking
|
||||||
@@ -98,23 +94,39 @@ trait IssuesControllerBase extends ControllerBase {
|
|||||||
val content = params("content")
|
val content = params("content")
|
||||||
|
|
||||||
updateComment(commentId, content)
|
updateComment(commentId, content)
|
||||||
|
redirect("/%s/%s/issue_comments/_data/%d".format(params("owner"), params("repository"), commentId))
|
||||||
contentType = formats("json")
|
|
||||||
|
|
||||||
org.json4s.jackson.Serialization.write(
|
|
||||||
Map("content" -> view.Markdown.toHtml(content,
|
|
||||||
getRepository(params("owner"), params("repository"), baseUrl).get, false, true, true)))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Authenticator
|
// TODO Authenticator
|
||||||
get("/:owner/:repository/issues/_data/:id"){
|
get("/:owner/:repository/issues/_data/:id"){
|
||||||
getIssue(params("owner"), params("repository"), params("id")) map { x =>
|
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
|
} getOrElse NotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO Authenticator
|
||||||
get("/:owner/:repository/issue_comments/_data/:id"){
|
get("/:owner/:repository/issue_comments/_data/:id"){
|
||||||
getComment(params("id")) map { x =>
|
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
|
} getOrElse NotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,31 +9,39 @@
|
|||||||
<span class="pull-right"><a class="btn btn-small btn-danger" href="#">Cancel</a></span>
|
<span class="pull-right"><a class="btn btn-small btn-danger" href="#">Cancel</a></span>
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(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) "#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/@key';
|
||||||
var param = {
|
var param = {
|
||||||
content : $('#edit-content-@key').val()
|
content : $('#edit-content-@key').val()
|
||||||
};
|
};
|
||||||
var func = function(data){
|
|
||||||
$('#commentContent-@key').empty().html(data.content);
|
|
||||||
};
|
|
||||||
}else{
|
}else{
|
||||||
var url = '@path/@owner/@repository/issues/@key';
|
var url = '@path/@owner/@repository/issues/@key';
|
||||||
var param = {
|
var param = {
|
||||||
title : $('#edit-title').val(),
|
title : $('#edit-title').val(),
|
||||||
content : $('#edit-content').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>
|
</script>
|
||||||
|
|||||||
@@ -60,6 +60,9 @@
|
|||||||
$(function(){
|
$(function(){
|
||||||
$('#edit').click(function(){
|
$('#edit').click(function(){
|
||||||
$.get('@path/@repository.owner/@repository.name/issues/_data/@issue.issueId',
|
$.get('@path/@repository.owner/@repository.name/issues/_data/@issue.issueId',
|
||||||
|
{
|
||||||
|
dataType : 'html'
|
||||||
|
},
|
||||||
function(data){
|
function(data){
|
||||||
$('#issueContent').empty().html(data);
|
$('#issueContent').empty().html(data);
|
||||||
});
|
});
|
||||||
@@ -69,6 +72,9 @@ $(function(){
|
|||||||
$('i.icon-pencil').click(function(){
|
$('i.icon-pencil').click(function(){
|
||||||
var id = $(this).closest('a').data('comment-id');
|
var id = $(this).closest('a').data('comment-id');
|
||||||
$.get('@path/@repository.owner/@repository.name/issue_comments/_data/' + id,
|
$.get('@path/@repository.owner/@repository.name/issue_comments/_data/' + id,
|
||||||
|
{
|
||||||
|
dataType : 'html'
|
||||||
|
},
|
||||||
function(data){
|
function(data){
|
||||||
$('#commentContent-' + id).empty().html(data);
|
$('#commentContent-' + id).empty().html(data);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user