Used standard path nav in tree template.
# XXX This could definitely use more context.
|| Carp::croak("Couldn't find a hash for the commit object!");
- my $commit = $m->get_object($hash)
- or Carp::croak("Couldn't find a commit object for '$hash' in '$pd'!");
+ my $obj = $m->get_object($hash)
+ or Carp::croak("Couldn't find a object for '$hash' in '$pd'!");
- return $commit;
+ return $obj;
}
=head2 index
my ( $self, $c ) = @_;
my $project = $c->stash->{Project};
- my $commit = $self->_get_object($c);
+ my $commit = $self->_get_object($c, $c->req->param('hb'));
my $filename = $c->req->param('f') || '';
my %logargs = (
# For legacy support.
sub history : Local {
- $_[0]->shortlog(@_[1 .. $#_]);
+ $_[1]->forward('shortlog');
}
=head2 tree
my ( $self, $c ) = @_;
my $project = $c->stash->{Project};
my $commit = $self->_get_object($c, $c->req->param('hb'));
- my $tree = $self->_get_object($c, $c->req->param('h') || $commit->tree_sha1);
+ my $filename = $c->req->param('f') || '';
+ my $tree = $filename
+ ? $project->get_object($project->hash_by_path($commit->sha1, $filename))
+ : $project->get_object($commit->tree_sha1)
+ ;
$c->stash(
commit => $commit,
tree => $tree,
<tr>
<td class='file-mode'>[% item.modestr %]</td>
[% theact = item.type == 'tree' ? 'tree' : 'blob' -%]
+ [% fullpath = path ? path _ '/' _ item.file : item.file %]
<td class='file-name'>
- <a href="[% c.uri_for(theact, {h=item.sha1, hb=commit.sha1, f=(path ? path _ '/' _ item.file : item.file)}) %]">[% item.file %]</a>
+ <a href="[% c.uri_for(theact, {h=item.sha1, hb=commit.sha1, f=fullpath}) %]">[% item.file %]</a>
</td>
<td class='action-list'>
- <a href="[% c.uri_for(theact, {h=item.sha1, hb=commit.sha1, f=item.file}) %]">[% theact %]</a>
- <a href="[% c.uri_for('history', {h=item.sha1, hb=commit.sha1, f=item.file}) %]">history</a>
+ <a href="[% c.uri_for(theact, {h=item.sha1, hb=commit.sha1, f=fullpath}) %]">[% theact %]</a>
+ <a href="[% c.uri_for('shortlog', {h=item.sha1, hb=commit.sha1, f=fullpath}) %]">history</a>
[% IF item.type == 'blob' %]
- <a href="[% c.uri_for('raw', {hb=commit.sha1, f=item.file}) %]">raw</a>
+ <a href="[% c.uri_for('raw', {hb=commit.sha1, f=fullpath}) %]">raw</a>
[% END %]
</td>
</tr>
[% short_cmt(commit.comment) | html %] ...
</div>
-[% IF path -%]
-<div>
- <a href='[% c.uri_for("tree", {hb=commit.sha1}) %]'>[% Project.name %]</a>
- [% fullpath = ''-%]
- [% FOREACH part IN path.split('/') -%]
- / <a href='[% c.uri_for("tree", {h=tree.sha1, hb=commit.sha1, f=fullpath _ part}) %]'>[% part %]</a>
- [% fullpath = fullpath _ part _ '/'; %]
- [% END -%]
-</div>
-[% END -%]
+[%
+ IF path;
+ INCLUDE 'nav/path.tt2' filename = path, head = commit;
+ END;
-[% INCLUDE '_tree.tt2' %]
+ INCLUDE '_tree.tt2';
+%]