mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-11 16:05:49 +01:00
57 lines
1.8 KiB
HTML
57 lines
1.8 KiB
HTML
@(title: Option[String], content: String, key: Int, owner: String, repository: String)(implicit context: app.Context)
|
|
@import context._
|
|
@defining(title.isEmpty){ isComment =>
|
|
@if(!isComment){
|
|
<input type="text" style="width: 730px;" id="edit-title" value="@title.get"/>
|
|
}
|
|
<textarea style="width: 730px; height: 100px;" id="edit-content@if(isComment){-@key}">@content</textarea>
|
|
<input type="button" class="btn btn-small" value="Update @{if(isComment) "Comment" else "Issue"}"/>
|
|
<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/edit/@key';
|
|
var param = {
|
|
issueId : 0, // TODO
|
|
content : $('#edit-content-@key').val()
|
|
};
|
|
}else{
|
|
var url = '@path/@owner/@repository/issues/edit/@key';
|
|
var param = {
|
|
title : $('#edit-title').val(),
|
|
content : $('#edit-content').val()
|
|
};
|
|
}
|
|
$.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(){
|
|
var url = @if(isComment){
|
|
'@path/@owner/@repository/issue_comments/_data/@key'
|
|
}else{
|
|
'@path/@owner/@repository/issues/_data/@key'
|
|
};
|
|
$.get(url, callback);
|
|
return false;
|
|
});
|
|
});
|
|
</script>
|
|
|
|
}
|