Merge remote-tracking branch 'origin/master'

This commit is contained in:
takezoe
2013-06-26 20:46:51 +09:00
3 changed files with 49 additions and 22 deletions

View File

@@ -87,6 +87,10 @@ trait IssuesControllerBase extends ControllerBase {
// TODO Authenticator
post("/:owner/:repository/issue_comments/:id"){
// TODO update issue memo
contentType = formats("json")
org.json4s.jackson.Serialization.write(Map(
"content" -> view.Markdown.toHtml("* hoge memo", getRepository("root", "test", baseUrl).get, false, true, true)))
}
// TODO Authenticator

View File

@@ -1,29 +1,41 @@
@(title: Option[String], content: String, key: Int, owner: String, repository: String)(implicit context: app.Context)
@import context._
@if(title.isDefined){
<input type="text" style="width: 730px;" id="title" value="@title.get"/>
@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="content-@key">@content</textarea>
<input type="button" class="btn btn-small" value="Update @{if(title.isDefined) "Issue" else "Comment"}" id="update-@key"/>
<span class="pull-right"><a class="btn btn-small btn-danger" href="#" id="cancel-@key">Cancel</a></span>
<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(){
$('#update-@key').click(function(){
$.post('@path/@owner/@repository/@{if(title.isDefined) "issues" else "issue_comments"}/@key',
{
@if(title.isDefined){ title : $('#title').val(), }
content : $('#content-@key').val()
},
function(data){
@if(title.isDefined){
$('#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-@key').val()
};
var func = function(data){
$('#issueTitle').empty().text(data.title);
$('#issueContent').empty().html(data.content);
};
}
$.post(url, param, func);
});
$('#cancel-@key').click(function(){
$('#cancel').click(function(){
});
});
</script>
}

View File

@@ -12,7 +12,7 @@
<div class="span10">
<div class="box">
<div class="box-content">
<span class="pull-right"><a class="btn btn-small" href="#" id="editIssue">Edit</a></span>
<span class="pull-right"><a class="btn btn-small" href="#" id="edit">Edit</a></span>
<div class="small"><a href="@path/@issue.openedUserName">@issue.openedUserName</a> opened this issue @datetime(issue.registeredDate)</div>
<h4 id="issueTitle">@issue.title</h4>
</div>
@@ -24,9 +24,12 @@
<div class="box" id="comment-@comment.commentId">
<div class="box-header-small">
<a href="@path/@comment.commentedUserName">@comment.commentedUserName</a> commented
<span class="pull-right">@datetime(comment.registeredDate)</span>
<span class="pull-right">
@datetime(comment.registeredDate)
<a href="#" data-comment-id="@comment.commentId"><i class="icon-pencil"></i></a>
</span>
</div>
<div class="box-content" style="background-color: #f5f5f5;">
<div class="box-content" style="background-color: #f5f5f5;" id="commentContent-@comment.commentId">
@markdown(comment.content, repository, false, true, true)
</div>
</div>
@@ -55,7 +58,7 @@
}
<script>
$(function(){
$('#editIssue').click(function(){
$('#edit').click(function(){
$.get('@path/@repository.owner/@repository.name/issues/_data/@issue.issueId',
function(data){
$('#issueContent').empty().html(data);
@@ -63,5 +66,13 @@ $(function(){
return false;
});
$('i.icon-pencil').click(function(){
var id = $(this).closest('a').data('comment-id');
$.get('@path/@repository.owner/@repository.name/issue_comments/_data/' + id,
function(data){
$('#commentContent-' + id).empty().html(data);
});
return false;
});
});
</script>