BEGIN { extends 'Catalyst::Controller' }
-sub base : Chained('/root') PathPart('fragment') CaptureArgs(0) {}
+sub base : Chained('/root') PathPart('fragment') CaptureArgs(0) {
+ my ($self, $c) = @_;
+ $c->stash(no_wrapper => 1);
+}
+
+sub collectionofrepositories : Chained('base') Args(0) {
+ my ($self, $c) = @_;
+ my @list = @{ $c->model()->repositories };
+ die 'No repositories found in '. $c->model->repo_dir
+ unless @list;
+
+ my $search = $c->req->param('s') || '';
+ if($search) {
+ @list = grep {
+ index($_->name, $search) > -1
+ or ( $_->description !~ /^Unnamed repository/ and index($_->description, $search) > -1 )
+ } @list
+ }
+
+ $c->stash(
+ repositories => \@list,
+ );
+}
__PACKAGE__->meta->make_immutable;
BEGIN { extends 'Catalyst::Controller' }
with 'Gitalist::URIStructure::Repository';
-sub base : Chained('/fragment/base') PathPart('') CaptureArgs(0) {
- my ($self, $c) = @_;
- $c->stash(no_wrapper => 1);
-}
+sub base : Chained('/fragment/base') PathPart('') CaptureArgs(0) {}
after shortlog => sub {
my ($self, $c) = @_;
BEGIN { extends 'Catalyst::Controller' }
with 'Gitalist::URIStructure::Repository';
-sub base : Chained('/root') PathPart('') CaptureArgs(0) {}
+sub base : Chained('/base') PathPart('') CaptureArgs(0) {}
__PACKAGE__->meta->make_immutable;
$c->detach($c->req->param('a'))
if $c->req->param('a');
- my @list = @{ $c->model()->repositories };
- die 'No repositories found in '. $c->model->repo_dir
- unless @list;
-
my $search = $c->req->param('s') || '';
- if($search) {
- @list = grep {
- index($_->name, $search) > -1
- or ( $_->description !~ /^Unnamed repository/ and index($_->description, $search) > -1 )
- } @list
- }
$c->stash(
search_text => $search,
- repositories => \@list,
- action => 'index',
);
}
)],
refs => $repository->references,
heads => [ @heads[0 .. ($#heads < $maxitems ? $#heads : $maxitems)] ],
- action => 'summary',
);
}
$c->stash(
commit => $self->_get_object($c),
heads => $repository->heads,
- action => 'heads',
);
}
$c->stash(
commit => $self->_get_object($c),
tags => $repository->tags,
- action => 'tags',
);
}
filename => $filename,
# XXX Hack hack hack, see View::SyntaxHighlight
language => ($filename =~ /\.p[lm]$/i ? 'Perl' : ''),
- action => 'blob',
);
$c->forward('View::SyntaxHighlight')
# XXX Hack hack hack, see View::SyntaxHighlight
blobs => [$patch->[0]->{diff}],
language => 'Diff',
- action => 'blobdiff',
);
$c->forward('View::SyntaxHighlight')
commit => $commit,
diff_tree => ($repository->diff(commit => $commit))[0],
refs => $repository->references,
- action => 'commit',
);
}
# XXX Hack hack hack, see View::SyntaxHighlight
blobs => [map $_->{diff}, @$patch],
language => 'Diff',
- action => 'commitdiff',
);
$c->forward('View::SyntaxHighlight')
refs => $repository->references,
page => $page,
filename => $filename,
- action => 'shortlog',
);
}
sub log : Chained('base') Args(0) {
$_[0]->shortlog($_[1]);
- $_[1]->stash->{action} = 'log';
}
# For legacy support.
$c->stash->{filename}
)
);
- $c->stash( action => 'history',
+ $c->stash(
filetype => $file->type,
);
}
tree => $tree,
tree_list => [$repository->list_tree($tree->sha1)],
path => $c->req->param('f') || '',
- action => 'tree',
);
}
$c->stash(
log => \@log,
- action => 'reflog',
);
}
$c->stash(
commit => $commit,
results => [$repository->list_revs(%logargs)],
- action => 'search',
# This could be added - page => $page,
);
}
sub base : Chained('/root') PathPart('') CaptureArgs(0) {
my($self, $c) = @_;
- my $repository = $c->req->param('p');
- if (defined $repository) {
- eval {
- $c->stash(Repository => $c->model()->get_repository($repository));
- };
- if ($@) {
- $c->detach('/error_404');
- }
- }
-
- my $a_repository = $c->stash->{Repository} || $c->model()->repositories->[0];
+ my $git_version = `git --version`;
+ chomp($git_version);
$c->stash(
- git_version => $a_repository->run_cmd('--version'),
+ git_version => $git_version,
version => $Gitalist::VERSION,
# XXX Move these to a plugin!
--- /dev/null
+<tbody class='listing'>
+ [% FOR p IN repositories %]
+ [%- repos_link = c.uri_for_action('/repository/summary', [p.name]) -%]
+<tr>
+ <td><a class="list" href="[% repos_link %]">[% p.name %]</a></td>
+ <td><a class="list" title="[% p.description %]" href="[% repos_link %]">[% abridged_description(p.description) %]</a></td>
+ <td>[% p.owner %]</td>
+ <td class="time-since">[% time_since(p.last_change) %]</td>
+ <td class="link"><a href="[% repos_link %]">summary</a>
+ | <a href="[% c.uri_for_action('/repository/shortlog', [p.name]) %]">shortlog</a>
+ | <a href="[% c.uri_for_action('/repository/log', [p.name]) %]">log</a>
+ | <a href="[% c.uri_for_action('/commit/tree', [p.name, 'HEAD']) %]">tree</a></td>
+</tr>
+ [% END %]
+</tbody>
+[% BLOCK repos_table_headfoot %]
+<tr>
+ <th>Repository</th>
+ <!-- XXX These do nothing presently -->
+ <th><a class="header" href="/?o=descr">Description</a></th>
+ <th><a class="header" href="/?o=owner">Owner</a></th>
+ <th><a class="header" href="/?o=age">Last Change</a></th>
+ <th></th>
+</tr>
+[% END %]
<div class='content'>
<form method="get" action="/" enctype="application/x-www-form-urlencoded">
<p class="projsearch">Search:
<table class="repository_list">
<thead>
- <tr>
- <th>Repository</th>
- <!-- XXX These do nothing presently -->
- <th><a class="header" href="/?o=descr">Description</a></th>
- <th><a class="header" href="/?o=owner">Owner</a></th>
- <th><a class="header" href="/?o=age">Last Change</a></th>
- <th></th>
- </tr>
+ [% INCLUDE repos_table_headfoot %]
</thead>
<tfoot>
- <tr>
- <td>Repository</td>
- <!-- XXX These do nothing presently -->
- <td><a href="/?o=descr">Description</a></td>
- <td><a href="/?o=owner">Owner</a></td>
- <td><a href="/?o=age">Last Change</a></td>
- <td></td>
- </tr>
+ [% INCLUDE repos_table_headfoot %]
</tfoot>
- <tbody class='listing'>
- [% FOR p IN repositories %]
- <tr>
- <td><a class="list" href="[% c.uri_for('/summary', {p=p.name}) %]">[% p.name %]</a></td>
- <td><a class="list" title="[% p.description %]" href="[% c.uri_for('/summary', {p=p.name} ) %]">[% abridged_description(p.description) %]</a></td>
- <td>[% p.owner %]</td>
- <td class="time-since">[% time_since(p.last_change) %]</td>
- <td class="link"><a href="[% c.uri_for("summary", {p=p.name}) %]">summary</a>
- | <a href="[% c.uri_for("shortlog", {p=p.name}) %]">shortlog</a>
- | <a href="[% c.uri_for("log", {p=p.name}) %]">log</a>
- | <a href="[% c.uri_for("tree", {p=p.name}) %]">tree</a></td>
- </tr>
- [% END %]
- </tbody>
+ [% subinclude('/fragment/collectionofrepositories') %]
</table>
</div>