Newer
Older
gitbucket_jkp / src / main / twirl / issues / issue.scala.html
@shimamoto shimamoto on 26 Jun 2013 3 KB Add issue comment update in stub.
@(issue: model.Issue, comments: List[model.IssueComment], repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context)
@import context._
@import view.helpers._
@html.main("%s - Issue #%d - %s/%s".format(issue.title, issue.issueId, repository.owner, repository.name)){
  @html.header("issues", repository)
  @issuestab("issues", repository)
  <ul class="nav nav-tabs">
    <li class="pull-left"><a href="@path/@repository.owner/@repository.name/issues"><i class="icon-arrow-left"></i> Back to issue list</a></li>
    <li class="pull-right">Issue #@issue.issueId</li>
  </ul>
  <div class="row-fluid">
    <div class="span10">
      <div class="box">
        <div class="box-content">
          <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>
        <div class="box-content" style="background-color: #f5f5f5;" id="issueContent">
          @markdown(issue.content getOrElse "No description given.", repository, false, true, true)
        </div>
      </div>
      @comments.map { comment =>
      <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)
            <a href="#" data-comment-id="@comment.commentId"><i class="icon-pencil"></i></a>
          </span>
        </div>
        <div class="box-content" style="background-color: #f5f5f5;" id="commentContent-@comment.commentId">
          @markdown(comment.content, repository, false, true, true)
        </div>
      </div>
      }
      <form action="@path/@repository.owner/@repository.name/issue_comments" method="POST" validate="true">
      <div class="box">
        <div class="box-content">
          @html.preview(repository, "", false, true, true, "width: 730px; height: 100px;")
        </div>
      </div>
      <input type="hidden" name="issueId" value="@issue.issueId"/>
      <input type="submit" class="btn btn-success" value="Comment"/>
      </form>
    </div>
    <div class="span2">
      @if(issue.closed) {
        <a class="btn btn-large btn-danger disabled">Closed</a>
      } else {
        <a class="btn btn-large btn-success disabled">Open</a>
      }
      <div class="small">@comments.size comments</div>
      <hr/>
      <strong>Labels</strong>
    </div>
  </div>
}
<script>
$(function(){
  $('#edit').click(function(){
    $.get('@path/@repository.owner/@repository.name/issues/_data/@issue.issueId',
    function(data){
      $('#issueContent').empty().html(data);
    });
    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>