gitprep / templates / include / code_menu.html.ep /
5934d45 11 years ago
1 contributor
48 lines | 1.564kb
<%
  my $display = stash('display') || '';
  my $rev = stash('rev');
  $rev = app->manager->default_branch($user, $project)
    unless defined $rev;
  my $branches_count = @{app->git->no_merged_branches($user, $project)};
  my $tags_count = app->git->tags_count($user, $project);
%>

<ul class="nav nav-tabs" style="margin-bottom:20px">
  % if (defined $rev) {
    <%
      my $title;
      my $rev_short;
      if (length $rev == 40) {
        $title = 'tree';
        $rev_short = substr($rev, 0, 10);
      }
      else {
        $title = 'branch';
        $rev_short = $rev;
      }
    %>
    <li style="padding-right:10px">
      <button class="btn" style="font-size:13px;padding:2px 10px;margin-top:5px;margin-right:6px">
        <i class="icon-share-alt"></i><span class="muted"><%= $title %>:</span> <b><%= $rev_short %></b>
      </button>
    </li>
  % }
  <li class="<%= $display eq 'files' ? 'active' : '' %>">
    <a href="<%= url_for("/$user/$project") %>">Files</a>
  </li>
  <li class="<%= $display eq 'commits' ? 'active' : '' %>">
    <a href="<%= url_for("/$user/$project/commits/$rev") %>">Commits</a>
  </li>
  <li class="<%= $display eq 'branches' ? 'active' : '' %>">
    <a href="<%= url_for("/$user/$project/branches") %>">
      Branches
      <span class="badge"><%= $branches_count %></span>
    </a>
  </li>
  <li class="<%= $display eq 'tags' ? 'active' : '' %>">
    <a href="<%= url_for("/$user/$project/tags") %>">
      Tags
      <span class="badge"><%= $tags_count > 999 ? '999+' : $tags_count %></span>
    </a>
  </li>
</ul>