Newer
Older
gitbucket_jkp / src / main / twirl / pulls / discussion.scala.html
@(issue: model.Issue,
  pullreq: model.PullRequest,
  comments: List[model.IssueComment],
  issueLabels: List[model.Label],
  collaborators: List[String],
  milestones: List[(model.Milestone, Int, Int)],
  labels: List[model.Label],
  hasWritePermission: Boolean,
  repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context)
@import context._
@import view.helpers._
<div class="row-fluid">
  <div class="span10">
    @issues.html.issuedetail(issue, comments, collaborators, milestones, hasWritePermission, repository)
    @issues.html.commentlist(issue, comments, hasWritePermission, repository, Some(pullreq))
    @if(hasWritePermission && !issue.closed){
      <div class="box issue-comment-box" style="background-color: #d8f5cd;">
        <div class="box-content"class="issue-content" style="border: 1px solid #95c97e; padding: 10px;">
          <div id="merge-pull-request">
            <div class="check-conflict" style="display: none;">
              <img src="@assets/common/images/indicator.gif"/> Checking...
            </div>
          </div>
          <div id="confirm-merge-form" style="display: none;">
            <form method="POST" action="@url(repository)/pull/@issue.issueId/merge">
              <div class="strong">
                Merge pull request #@issue.issueId from @{pullreq.requestUserName}/@{pullreq.requestBranch}
              </div>
              <span id="error-message" class="error"></span>
              <textarea name="message" style="width: 680px; height: 80px;">@issue.title</textarea>
              <div>
                <input type="button" class="btn" value="Cancel" id="cancel-merge-pull-request"/>
                <input type="submit" class="btn btn-success" value="Confirm merge"/>
              </div>
            </form>
          </div>
        </div>
      </div>
    }
    @if(hasWritePermission && issue.closed && pullreq.userName == pullreq.requestUserName &&
        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/@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, hasWritePermission, repository)
  </div>
  <div class="span2">
    @if(issue.closed) {
      @if(comments.exists(_.action == "merge")){
        <span class="label label-info issue-status">Merged</span>
      } else {
        <span class="label label-important issue-status">Closed</span>
      }
    } else {
      <span class="label label-success issue-status">Open</span>
    }
    <div class="small" style="text-align: center;">
      <span class="strong">@comments.size</span> @plural(comments.size, "comment")
    </div>
    <hr/>
    @issues.html.labels(issue, issueLabels, labels, hasWritePermission, repository)
  </div>
</div>
<script>
$(function(){
  $('#cancel-merge-pull-request').click(function(){
    $('#confirm-merge-form').hide();
    $('#merge-pull-request').show();
  });

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

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