gitprep / templates / main / branches.html.ep /
Yuki Kimoto cleanup
0c22bac 12 years ago
1 contributor
87 lines | 2.506kb
<%
  use Gitprep::API;
  
  # API
  my $api = Gitprep::API->new($self);

  # Parameters
  my $user = param('user');
  my $project = param('project');
  my $root_ns = $api->root_ns(config->{root});
  my $rep_ns = "$root_ns/$user/$project.git";
  my $rep = "/$rep_ns";
  
  # Git
  my $git = $self->app->git;
  
  # Default branch
  my $default_branch = {};
  $default_branch->{name} = 'master';
  $default_branch->{commit} = $git->parse_commit($rep, $default_branch->{name});
  
  # No merged branches
  my $branches  = $git->no_merged_branches($rep);
%>

% layout 'common';
  
  %= include '/include/header';
  
  <div class="container">
    %= include '/include/project_header';
    %= include '/include/code_menu', display => 'branches', branches_count => scalar @$branches;
    
    <h3>Branches</h3>
    
    <div class="muted">
      Showing <%= @$branches %> branches not merged into master
    </div>
    <div class="row">
      <div class="span12 bk-black padding-default">
        <div class="row">
          <div class="span8">
            <div class="font-white"><b><%= $default_branch->{name} %></b></div>
            <div class="muted">
              Last updated
              <%= $default_branch->{commit}{age_string} %>
              by
              <%= $default_branch->{commit}{author_name} %>
            </div>
          </div>
          <div class="span4 text-right font-white" style="padding-top:10px">
            Base branch
          </div>
        </div>
      </div>
    </div>
    % for (my $i = 0; $i < @$branches; $i++) {
      % my $branch = $branches->[$i];
      % my $name = $branch->{name};
      <div class="row">
        <div class="span12 padding-default border-bottom-gray">
          <div class="row">
            <div class="span8">
              <div>
                <a href="<%= url_for("/$user/$project/tree/$name") %>">
                  <%= $name %>
                </a>
              </div>
              <div class="muted">
                Last updated
                <%= $branch->{commit}{age_string} %>
                by
                <%= $branch->{commit}{author_name} %>
              </div>
            </div>
            <div class="span4 text-right" style="padding-top:5px">
              <a class="btn" href="<%= url_for("/$user/$project/compare/$default_branch->{name}...$name") %>">
                Compare
              </a>
            </div>
          </div>
        </div>
      </div>
    % }
  </div>
  
  %= include '/include/footer';