Newer
Older
GitBucket / src / main / twirl / gitbucket / core / pulls / conversation.scala.html
@nazoking nazoking on 2 Jan 2016 3 KB update button
@(issue: gitbucket.core.model.Issue,
  pullreq: gitbucket.core.model.PullRequest,
  comments: List[gitbucket.core.model.Comment],
  issueLabels: List[gitbucket.core.model.Label],
  collaborators: List[String],
  milestones: List[(gitbucket.core.model.Milestone, Int, Int)],
  labels: List[gitbucket.core.model.Label],
  hasWritePermission: Boolean,
  repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@import gitbucket.core.model._

<div class="row">
  <div class="col-md-10">
    <div id="comment-list">
      @issues.html.commentlist(Some(issue), comments, hasWritePermission, repository, Some(pullreq))
    </div>
    @defining(comments.flatMap {
      case comment: gitbucket.core.model.IssueComment => Some(comment)
      case other => None
    }.exists(_.action == "merge")){ merged =>
      @if(!issue.closed){
        <div class="check-conflict" style="display: none;">
          <div class="box issue-comment-box" style="background-color: #fbeed5">
            <div class="box-content"class="issue-content" style="border: 1px solid #c09853; padding: 10px;">
              <img src="@assets/common/images/indicator.gif"/> Checking...
            </div>
          </div>
        </div>
      }
      @if(hasWritePermission && issue.closed && pullreq.userName == pullreq.requestUserName && merged &&
        pullreq.repositoryName == pullreq.requestRepositoryName && repository.branchList.contains(pullreq.requestBranch)){
        <div class="box issue-comment-box" style="background-color: #d0eeff;">
          <div class="box-content"class="issue-content" style="border: 1px solid #87a8c9; padding: 10px;">
            <a href="@url(repository)/pull/@issue.issueId/delete/@encodeRefName(pullreq.requestBranch)" class="btn btn-info pull-right delete-branch" data-name="@pullreq.requestBranch">Delete branch</a>
            <div>
              <span class="strong">Pull request successfully merged and closed</span>
            </div>
            <span class="small muted">You're all set-the <span class="label label-info monospace">@pullreq.requestBranch</span> branch can be safely deleted.</span>
          </div>
        </div>
      }
      @issues.html.commentform(issue, !merged, hasWritePermission, repository)
    }
  </div>
  <div class="col-md-2">
    @issues.html.issueinfo(Some(issue), comments, issueLabels, collaborators, milestones, labels, hasWritePermission, repository)
  </div>
</div>
<script>
$(function(){
  $('#cancel-merge-pull-request').click(function(){
    $('#confirm-merge-form').hide();
    $('#merge-pull-request').show();
  });

  var checkConflict = $('.check-conflict').show();
  if(checkConflict.length){
    $.get('@url(repository)/pull/@issue.issueId/mergeguide', function(data){ $('.check-conflict').html(data); });
  }

  @if(hasWritePermission){
    $('.delete-branch').click(function(e){
      var branchName = $(e.target).data('name');
      return confirm('Are you sure you want to remove the ' + branchName + ' branch?');
    });
  }
});
</script>