Newer
Older
gitbucket_jkp / src / main / twirl / header.scala.html
@(active: String, repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context)
@import context._
@import view.helpers._
<div class="pull-right">
  <div class="input-prepend">
    <input type="button" id="fork" class="btn" value="Fork" style="margin-bottom: 10px;"/>
    <span class="add-on"><a href="@url(repository)/network/members">@repository.forkedCount</a></span>
  </div>
</div>
<div class="head">
  <a href="@url(repository.owner)">@repository.owner</a> / <a href="@url(repository)">@repository.name</a>
  @if(repository.repository.isPrivate){
    <i class="icon-lock"></i>
  }
  @defining(repository.repository){ x =>
    @if(repository.repository.originRepositoryName.isDefined){
      <div class="forked">
        forked from <a href="@path/@x.parentUserName/@x.parentRepositoryName">@x.parentUserName/@x.parentRepositoryName</a>
      </div>
    }
  }
</div>
<table class="global-nav box-header">
  <tr>
    <th class="box-header@if(active=="code"){ active}">
      <a href="@url(repository)">Code</a>
    </th>
    <th class="box-header@if(active=="issues"){ active}">
      <a href="@url(repository)/issues">Issues</a>
    </th>
    <th class="box-header@if(active=="pulls"){ active}">
      <a href="@url(repository)/pulls">Pull Requests</a>
    </th>
    <th class="box-header@if(active=="wiki"){ active}">
      <a href="@url(repository)/wiki">Wiki</a>
    </th>
    @if(loginAccount.isDefined && (loginAccount.get.isAdmin || loginAccount.get.userName == repository.owner)){
    <th class="box-header@if(active=="settings"){ active}">
      <a href="@url(repository)/settings">Settings</a>
    </th>
    }
  </tr>  
</table>
<form method="POST" id="repository_form">
</form>
<script type="text/javascript">
$(function(){
  $('table.global-nav th.box-header').click(function(){
    location.href = $(this).find('a').attr('href');
    return false;
  });

  // TODO Execute by Ajax?
  $('#fork').click(function(){
    var form = $('form#repository_form');
    form.attr('action', '@path/@repository.owner/@repository.name/_fork');
    form.submit();
  });
});
</script>