Newer
Older
gitbucket_jkp / src / main / twirl / repo / branches.scala.html
@Shintaro Murakami Shintaro Murakami on 18 Oct 2014 1 KB (ref #519) Change datetime formats
@(branchInfo: Seq[(String, java.util.Date)],
  hasWritePermission: Boolean,
  repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context)
@import context._
@import view.helpers._
@html.main(s"${repository.owner}/${repository.name}", Some(repository)) {
  @html.menu("code", repository){
    <h1>Branches</h1>
    <table class="table table-bordered">
      <tr>
        <th width="40%">Branch</th>
        <th width="20%">Last update</th>
        <th width="20%">Compare</th>
        <th width="20%">Download</th>
      </tr>
      @branchInfo.map { case (branchName, latestUpdateDate) =>
        <tr>
          <td>
            <a href="@url(repository)/tree/@encodeRefName(branchName)">@branchName</a>
            @if(hasWritePermission && repository.repository.defaultBranch != branchName){
              <a href="@url(repository)/delete/@encodeRefName(branchName)" class="btn btn-danger btn-mini pull-right delete-branch" data-name="@branchName">Delete branch</a>
            }
          </td>
          <td>
            @helper.html.datetimeago(latestUpdateDate, false)
          </td>
          <td>
            @if(repository.repository.defaultBranch == branchName){
              Base branch
            } else {
              <a href="@url(repository)/compare/@{encodeRefName(repository.repository.defaultBranch)}...@{encodeRefName(branchName)}">to @{repository.repository.defaultBranch}</a>
            }
          </td>
          <td>
            <a href="@url(repository)/archive/@{encodeRefName(branchName)}.zip">ZIP</a>
            <a href="@url(repository)/archive/@{encodeRefName(branchName)}.tar.gz">TAR.GZ</a>
          </td>
        </tr>
      }
    </table>
  }
}
<script>
$(function(){
  $('.delete-branch').click(function(e){
    var branchName = $(e.target).data('name');
    return confirm('Are you sure you want to remove the ' + branchName + ' branch?');
  });
});
</script>