From: Tomas Doran Date: Mon, 18 Jan 2010 00:13:33 +0000 (+0000) Subject: Make the tree fragment work as expected so that you can browse trees again X-Git-Tag: 0.000006_01~1^2~85 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1f9a47c2059cb212f1287d9af2d6dc8e1f9c9913;p=catagits%2FGitalist.git Make the tree fragment work as expected so that you can browse trees again --- diff --git a/lib/Gitalist/URIStructure/Commit.pm b/lib/Gitalist/URIStructure/Commit.pm index e59e64c..0140681 100644 --- a/lib/Gitalist/URIStructure/Commit.pm +++ b/lib/Gitalist/URIStructure/Commit.pm @@ -27,4 +27,12 @@ sub tree : Chained('find') Args() {} sub commit : Chained('find') PathPart('') {} +sub blob : Chained('find') Args() {} + +sub blame : Chained('find') Args() {} + +sub history : Chained('find') Args() {} + +sub raw : Chained('find') Args() {} + 1; diff --git a/lib/Gitalist/View/Default.pm b/lib/Gitalist/View/Default.pm index 4bc7be6..443704b 100644 --- a/lib/Gitalist/View/Default.pm +++ b/lib/Gitalist/View/Default.pm @@ -1,5 +1,6 @@ package Gitalist::View::Default; use Moose; +use Moose::Autobox; use namespace::autoclean; extends 'Catalyst::View::TT'; @@ -13,6 +14,13 @@ __PACKAGE__->config( subinclude_plugin => 'SubRequest', ); +use Template::Stash; + +# define list method to flatten arrayrefs +$Template::Stash::LIST_OPS->{ to_path } = sub { + return join('%2F', shift->flatten, @_); +}; + __PACKAGE__->meta->make_immutable(inline_constructor => 0); __END__ diff --git a/root/fragment/commit/tree.tt2 b/root/fragment/commit/tree.tt2 index 6a96cda..4c52cd1 100644 --- a/root/fragment/commit/tree.tt2 +++ b/root/fragment/commit/tree.tt2 @@ -1,36 +1,38 @@ - - +[% BLOCK tree_table_headfoot %] +[% END %] +
mode file actions
+ + [% PROCESS tree_table_headfoot %] - - - - - + [% PROCESS tree_table_headfoot %] [% FOREACH item IN tree_list %] - [% theact = item.type == 'tree' ? 'tree' : 'blob' -%] - [% fullpath = path ? path _ '/' _ item.file : item.file %] + [%- + action_type = item.type == 'tree' ? 'tree' : 'blob'; + action_for_link = item.type == 'tree' ? c.action : c.controller.action_for('blob'); + blob_or_tree_link = c.uri_for(action_for_link, c.req.captures, c.req.args.to_path(item.file)) + -%]
modefileactions
[% item.modestr %] - [% item.file %] + [% item.file %] - [% theact %] + [% theact %] [% IF item.type == 'blob' %] - blame + blame [% END %] - history + history [% IF item.type == 'blob' %] - raw + raw [% END %]