gitprep / templates / include / page_path.html.ep /
2b350bc 8 years ago
2 contributor
44 lines | 1.031kb
% use File::Basename 'basename';
<%
  my $operation = stash('operation') || 'tree';
  unless ($operation eq 'commits' || $operation eq 'tree') {
    $operation = 'tree';
  }
  
  my $rev = stash('id') || stash('rev');
  my $prefix = stash('prefix');
  my $type = stash('type') || '';
%>

<div class="page-path">
  % if ($prefix) {
    <span class="muted">History for</span>
  % }

  <a href="<%= url_for("/$user/$project" . ($operation eq 'commits' ? '/commits' : '')) %>">
    <b><%= $project %></b>
  </a>
  
  % if (defined $Path) {
    /
    % my @parts = split('/', $Path);
    % my $path;
    % for (my $i = 0; $i < @parts; $i++) {
      % my $part = $parts[$i];
      % $path .= $part;
      
      % if ($i == @parts - 1) {
        <b><%= $part %></b>
      % } else {
        <a href=
            "<%= url_for("/$user/$project/$operation/$rev/$path") %>">
          <%= $part %>
        </a>
        % $path .= '/';
      % }
      % unless ($type eq 'blob' && $i == @parts - 1) {
        /
      % }
    % }
  % }
</div>