Add the cancellation process of the issue.

This commit is contained in:
shimamoto
2013-06-27 17:11:49 +09:00
parent 2de816d197
commit 6d763e8097
3 changed files with 52 additions and 26 deletions

View File

@@ -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>