);
};
+after blame => sub {
+ my($self, $c, @fn) = @_;
+
+ my $repository = $c->stash->{Repository};
+ my $filename = join('/', @fn);
+
+ # WTF?
+ my $blame = $c->stash->{Commit}->blame($filename, $c->stash->{Commit}->sha1);
+ $c->stash(
+ blame => $blame,
+ filename => $filename,
+
+ # XXX Hack hack hack, see View::SyntaxHighlight
+ language => ($filename =~ /\.p[lm]$/i ? 'Perl' : ''),
+ blob => join("\n", map $_->{line}, @$blame),
+ );
+
+ $c->forward('View::SyntaxHighlight')
+ unless $c->stash->{no_wrapper};
+};
+
__PACKAGE__->meta->make_immutable;
);
}
-sub blame : Chained('base') Args(0) {
- my($self, $c) = @_;
-
- my $repository = $c->stash->{Repository};
- my $h = $c->req->param('h')
- || $repository->hash_by_path($c->req->param('hb'), $c->req->param('f'))
- || die "No file or sha1 provided.";
- my $hb = $c->req->param('hb')
- || $repository->head_hash
- || die "Couldn't discern the corresponding head.";
- my $filename = $c->req->param('f') || '';
-
- my $blame = $repository->get_object($hb)->blame($filename, $h);
- $c->stash(
- blame => $blame,
- head => $repository->get_object($hb),
- filename => $filename,
-
- # XXX Hack hack hack, see View::SyntaxHighlight
- language => ($filename =~ /\.p[lm]$/i ? 'Perl' : ''),
- blob => join("\n", map $_->{line}, @$blame),
- );
-
- $c->forward('View::SyntaxHighlight')
- unless $c->stash->{no_wrapper};
-}
-
sub _blob_objs {
my ( $self, $c ) = @_;
my $repository = $c->stash->{Repository};
--- /dev/null
+[%- BLOCK blame_table_headfoot %]
+<tr>
+ <td>author</td>
+ <td>date</td>
+ <td>sha1</td>
+ <td></td>
+ <td class='data'>data</td>
+</tr>
+[% END -%]
+[% PROCESS 'nav/actions.tt2' object = head %]
+[%- INCLUDE inc/syntax_highlight_css.tt2 -%]
+
+<div class='content'>
+
+[% IF object.type == 'commit' %]
+<div class='commit-message'>[% short_cmt(head.comment) %]</div>
+[% END %]
+
+[% INCLUDE 'nav/path.tt2' %]
+
+<div id='blame'>
+<table>
+ <thead>
+ [% PROCESS blame_table_headfoot %]
+ </thead>
+
+ <tfoot>
+ [% PROCESS blame_table_headfoot %]
+ </tfoot>
+
+ <tbody>
+ [% subinclude('/fragment/commit/blame', c.req.captures, c.req.arguments.to_path ) %]
+ </tbody>
+</table>
+</div>
+
+</div>
-[% PROCESS 'nav/actions.tt2' object = head %]
-[% INCLUDE inc/syntax_highlight_css.tt2 %]
-
-<div class='content'>
-
-[% IF object.type == 'commit' %]
-<div class='commit-message'>[% short_cmt(head.comment) %]</div>
-[% END %]
-
-[% INCLUDE 'nav/path.tt2' %]
-
-<div id='blame'>
-<table>
- <thead>
- <tr>
- <th>author</th>
- <th>date</th>
- <th>sha1</th>
- <th></th>
- <th class='data'>data</th>
- </tr>
- </thead>
-
- <tfoot>
- <tr>
- <td>author</td>
- <td>date</td>
- <td>sha1</td>
- <td></td>
- <td class='data'>data</td>
- </tr>
- </tfoot>
-
- <tbody>
- [% blame_lines = blob.split("\n") %]
+[% blame_lines = blob.split("\n") %]
[% FOR info IN blame %]
<tr class=''>
[%-
[% lastsha1 = info.commit.sha1 %]
</tr>
[% END %]
- </tbody>
-</table>
-</div>
-
-</div>