Newer
Older
gitbucket_jkp / src / main / twirl / gitbucket / core / menu.scala.html
@Naoki Takezoe Naoki Takezoe on 27 Mar 2016 3 KB Move the repository menu to the sidebar
@(active: String,
  repository: gitbucket.core.service.RepositoryService.RepositoryInfo,
  id: Option[String] = None,
  info: Option[Any] = None,
  error: Option[Any] = None)(body: Html)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._

@menuitem(path: String, name: String, label: String, count: Int = 0) = {
  <li @if(active == name){class="active"}>
    <a href="@url(repository)@path">
      @label
      @if(count > 0){
        <span class="badge">@count</span>
      }
    </a>
  </li>
}

<div class="headbar">
  <div class="container">
    @helper.html.information(info)
    @helper.html.error(error)
    @*
    <div class="pull-right">
      <a href="@url(repository)/commits/@encodeRefName(id.getOrElse(repository.repository.defaultBranch))" class="header-link">
        <i class="octicon octicon-history"></i>
        @if(repository.commitCount > 10000){
          <strong>10000+</strong> commits
        } else {
          <strong>@repository.commitCount</strong> commits
        }
      </a>
      <a href="@url(repository)/branches" class="header-link" class="header-link">
        <i class="octicon octicon-git-branch"></i>
        <strong>@repository.branchList.length</strong> branches
      </a>
      <a href="@url(repository)/tags" class="header-link" class="header-link">
        <i class="octicon octicon-tag"></i>
        <strong>@repository.tags.length</strong> releases
      </a>
    </div>
    *@
    <div class="head">
      @helper.html.repositoryicon(repository, true)
      <a href="@url(repository.owner)">@repository.owner</a> / <a href="@url(repository)" class="strong">@repository.name</a>

      @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>
        }
        @x.description.map { description =>
          <div class="normal muted" style="margin-left: 36px; font-size: 80%;">@detectAndRenderLinks(description)</div>
        }
      }
    </div>
  </div>
</div>
<div class="container body">
  <ul class="nav nav-pills nav-stacked" style="width: 250px; float: left;">
    @menuitem(""                   ,"files"      ,"Files")
    @if(repository.commitCount != 0) {
      @menuitem("/branches"        ,"branches"   ,"Branches", repository.branchList.length)
      @menuitem("/tags"            ,"tags"       ,"Tags", repository.tags.length)
    }
    @menuitem("/issues"            ,"issues"     ,"Issues", repository.issueCount)
    @menuitem("/pulls"             ,"pulls"      ,"Pull Requests", repository.pullCount)
    @menuitem("/issues/labels"     ,"labels"     ,"Labels")
    @menuitem("/issues/milestones" ,"milestones" ,"Milestones")
    @menuitem("/wiki"              ,"wiki"       ,"Wiki")
    @menuitem("/network/members", "fork", "Forks", repository.forkedCount)
    @if(loginAccount.isDefined && (loginAccount.get.isAdmin || repository.managers.contains(loginAccount.get.userName))){
      @menuitem("/settings" , "settings" , "Settings")
    }
  </ul>
  <div style="margin-left: 260px;">
    @body
  </div>
</div>