mirror of
https://github.com/gitbucket/gitbucket.git
synced 2026-01-02 21:59:56 +01:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -98,8 +98,8 @@ trait IssuesControllerBase extends ControllerBase {
|
||||
ajaxGet("/:owner/:repository/issues/_data/:id"){
|
||||
getIssue(params("owner"), params("repository"), params("id")) map { x =>
|
||||
params.get("dataType") collect {
|
||||
case t if t == "html" => issues.html.edit(
|
||||
Some(x.title), x.content getOrElse "", x.issueId, x.userName, x.repositoryName)
|
||||
case t if t == "html" => issues.html.editissue(
|
||||
x.title, x.content, x.issueId, x.userName, x.repositoryName)
|
||||
} getOrElse {
|
||||
contentType = formats("json")
|
||||
org.json4s.jackson.Serialization.write(
|
||||
@@ -115,8 +115,8 @@ trait IssuesControllerBase extends ControllerBase {
|
||||
ajaxGet("/:owner/:repository/issue_comments/_data/:id"){
|
||||
getComment(params("id")) map { x =>
|
||||
params.get("dataType") collect {
|
||||
case t if t == "html" => issues.html.edit(
|
||||
None, x.content, x.commentId, x.userName, x.repositoryName)
|
||||
case t if t == "html" => issues.html.editcomment(
|
||||
x.content, x.commentId, x.userName, x.repositoryName)
|
||||
} getOrElse {
|
||||
contentType = formats("json")
|
||||
org.json4s.jackson.Serialization.write(
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
@(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>
|
||||
|
||||
}
|
||||
33
src/main/twirl/issues/editcomment.scala.html
Normal file
33
src/main/twirl/issues/editcomment.scala.html
Normal file
@@ -0,0 +1,33 @@
|
||||
@(content: String, commentId: Int, owner: String, repository: String)(implicit context: app.Context)
|
||||
@import context._
|
||||
<span id="error-edit-content-@commentId" class="error"></span>
|
||||
<textarea style="width: 730px; height: 100px;" id="edit-content-@commentId">@content</textarea>
|
||||
<input type="button" class="btn btn-small" value="Update Comment"/>
|
||||
<span class="pull-right"><a class="btn btn-small btn-danger" href="#">Cancel</a></span>
|
||||
<script>
|
||||
$(function(){
|
||||
var callback = function(data){
|
||||
$('#commentContent-@commentId').empty().html(data.content);
|
||||
};
|
||||
|
||||
$('#commentContent-@commentId input.btn').click(function(){
|
||||
$.ajax({
|
||||
url: '@path/@owner/@repository/issue_comments/edit/@commentId',
|
||||
type: 'POST',
|
||||
data: {
|
||||
issueId : 0, // TODO
|
||||
content : $('#edit-content-@commentId').val()
|
||||
}
|
||||
}).done(
|
||||
callback
|
||||
).fail(function(req) {
|
||||
$('#error-edit-content-@commentId').text($.parseJSON(req.responseText).content);
|
||||
});
|
||||
});
|
||||
|
||||
$('#commentContent-@commentId a.btn').click(function(){
|
||||
$.get('@path/@owner/@repository/issue_comments/_data/@commentId', callback);
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
35
src/main/twirl/issues/editissue.scala.html
Normal file
35
src/main/twirl/issues/editissue.scala.html
Normal file
@@ -0,0 +1,35 @@
|
||||
@(title: String, content: Option[String], issueId: Int, owner: String, repository: String)(implicit context: app.Context)
|
||||
@import context._
|
||||
<span id="error-edit-title" class="error"></span>
|
||||
<input type="text" style="width: 730px;" id="edit-title" value="@title"/>
|
||||
<textarea style="width: 730px; height: 100px;" id="edit-content">@content.getOrElse("")</textarea>
|
||||
<input type="button" class="btn btn-small" value="Update Issue"/>
|
||||
<span class="pull-right"><a class="btn btn-small btn-danger" href="#">Cancel</a></span>
|
||||
<script>
|
||||
$(function(){
|
||||
var callback = function(data){
|
||||
$('#issueTitle').empty().text(data.title);
|
||||
$('#issueContent').empty().html(data.content);
|
||||
};
|
||||
|
||||
$('#issueContent input.btn').click(function(){
|
||||
$.ajax({
|
||||
url: '@path/@owner/@repository/issues/edit/@issueId',
|
||||
type: 'POST',
|
||||
data: {
|
||||
title : $('#edit-title').val(),
|
||||
content : $('#edit-content').val()
|
||||
}
|
||||
}).done(
|
||||
callback
|
||||
).fail(function(req) {
|
||||
$('#error-edit-title').text($.parseJSON(req.responseText).title);
|
||||
});
|
||||
});
|
||||
|
||||
$('#issueContent a.btn').click(function(){
|
||||
$.get('@path/@owner/@repository/issues/_data/@issueId', callback);
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user