From: Dan Brook Date: Fri, 5 Mar 2010 15:35:25 +0000 (+0000) Subject: Fix paging links for /shortlog. X-Git-Tag: 0.000006_01~1^2~8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=906a2dd285f71590272eeec7806088cc5494a4ad;p=catagits%2FGitalist.git Fix paging links for /shortlog. --- diff --git a/lib/Gitalist.pm b/lib/Gitalist.pm index 91992e4..53dabb1 100644 --- a/lib/Gitalist.pm +++ b/lib/Gitalist.pm @@ -39,6 +39,21 @@ around uri_for => sub { return $uri; }; +around uri_for_action => sub { + my ($orig, $c) = (shift, shift); + my $uri = $c->$orig(@_); + $$uri =~ s[/fragment\b][] if defined $uri; + return $uri; +}; + +sub uri_with { + my ($self, @args) = @_; + my $uri = $self->request->uri_with(@args); + # Wow this awful. + $uri =~ s[/fragment\b][]; + return $uri; +} + 1; __END__ diff --git a/lib/Gitalist/ActionRole/FilenameArgs.pm b/lib/Gitalist/ActionRole/FilenameArgs.pm index 3283aa2..1401cfd 100644 --- a/lib/Gitalist/ActionRole/FilenameArgs.pm +++ b/lib/Gitalist/ActionRole/FilenameArgs.pm @@ -6,7 +6,8 @@ requires 'execute'; before 'execute' => sub { my ($self, $controller, $c, @args) = @_; - $c->stash->{filename} = join('/', @args) || ''; + $c->stash->{filename} = join('/', @args) || '' + unless $c->stash->{filename}; }; 1; diff --git a/lib/Gitalist/Git/Object/Commit.pm b/lib/Gitalist/Git/Object/Commit.pm index 921fb6b..7ac568b 100644 --- a/lib/Gitalist/Git/Object/Commit.pm +++ b/lib/Gitalist/Git/Object/Commit.pm @@ -105,7 +105,7 @@ class Gitalist::Git::Object::Commit $line{sha1} = $line{sha1dst}; $line{is_new} = $line{sha1src} =~ /^0+$/ if $line{sha1src}; - @line{qw/status sim/} = $line{status} =~ /(R)(\d+)/ + @line{qw/status sim/} = $line{status} =~ /(R)0*(\d+)/ if $line{status} =~ /^R/; push @ret, \%line; } diff --git a/lib/Gitalist/URIStructure/Fragment/WithLog.pm b/lib/Gitalist/URIStructure/Fragment/WithLog.pm index 470f59d..ea3ae2a 100644 --- a/lib/Gitalist/URIStructure/Fragment/WithLog.pm +++ b/lib/Gitalist/URIStructure/Fragment/WithLog.pm @@ -14,9 +14,11 @@ after log => sub { ); my $page = $c->req->param('pg') || 0; - $logargs{skip} = $c->req->param('pg') * $logargs{count} - if $c->req->param('pg'); + $logargs{skip} = abs $page * $logargs{count} + if $page; + $c->stash( + page => $page, log_lines => [$repository->list_revs(%logargs)], refs => $repository->references, ); diff --git a/root/repository/shortlog.tt2 b/root/repository/shortlog.tt2 index 74bdbba..1a39f61 100644 --- a/root/repository/shortlog.tt2 +++ b/root/repository/shortlog.tt2 @@ -1,2 +1,2 @@ [% INCLUDE 'nav/actions.tt2' object = commit %] -[% subinclude('/fragment/' _ c.action, c.req.captures) %] +[% subinclude('/fragment/' _ c.action, c.req.captures, c.req.parameters) %] diff --git a/root/wrapper.tt2 b/root/wrapper.tt2 index f0dc83b..b6c6c86 100644 --- a/root/wrapper.tt2 +++ b/root/wrapper.tt2 @@ -4,14 +4,14 @@ - + [%# FIXME - MING %][%- title = BLOCK; c.config.sitename; IF Repository; ' - ' _ Repository.name | html; END; - IF c.action; ' / ' _ c.action; END; - IF filename; ' - ' _ filename | html; END; + IF c.action; ' / ' _ c.action; END; + IF filename; ' - ' _ filename | html; END; IF c.action && c.action == 'tree'; '/'; END; END; title; @@ -30,24 +30,22 @@ <div id='the-container'> -[% site_header %] - <div id="page-header"> <a title="git homepage" href="http://git-scm.org"> <img src="[% c.uri_for('/logo.png') %]" alt="git" class="logo"> </a> - <a href="[% c.uri_for('/') %]">A Gitalist</a> - [%- IF Repository %] - / <a href="[% c.uri_for_action('/repository/summary', [Repository.name]) %]">[% Repository.name %]</a> - [% - INCLUDE 'nav/search.tt2'; - END; %] + <div id='header-title'> + <a href="[% c.uri_for('/') %]">A Gitalist</a> + [%- IF Repository %] + / <a href="[% c.uri_for_action('/repository/summary', [Repository.name]) %]">[% Repository.name %]</a> + [%# INCLUDE 'nav/branches.tt2' %] + </div> + [% INCLUDE 'nav/search.tt2' %] + [% END %] </div> <div id='body'> -[% - content; -%] +[% content %] </div> <div id="page-footer">