Fixed links on the /index action and broken times in the shortlog.
broquaint [Tue, 3 Nov 2009 10:34:23 +0000 (10:34 +0000)]
lib/Gitalist.pm
lib/Gitalist/Controller/Root.pm
root/index.tt2

index 8b0cee5..afad99f 100644 (file)
@@ -27,9 +27,10 @@ __PACKAGE__->setup();
 
 around uri_for => sub {
   my ($orig, $c) = (shift, shift);
+  my $hash = ref($_[-1]) eq 'HASH' ? pop @_ : {};
   my $params = Catalyst::Utils::merge_hashes(
-    { p => $c->model('Git')->project },
-    ref($_[-1]) eq 'HASH' ? pop @_ : {}
+    { p => $hash->{p} || $c->model()->project },
+    $hash,
   );
   (my $uri = $c->$orig(@_, $params))
     =~ tr[&][;];
index af0f86b..f576ca7 100644 (file)
@@ -61,7 +61,7 @@ sub run_gitweb {
 sub _get_commit {
   my($self, $c, $haveh) = @_;
 
-  my $h = $haveh || $c->req->param('h');
+  my $h = $haveh || $c->req->param('h') || '';
   my $f = $c->req->param('f');
   my $m = $c->model();
 
@@ -564,9 +564,8 @@ sub end : ActionClass('RenderView') {
     my($age) = $dt < (DateTime->now - DateTime::Duration->new(days=>12))
       ? $dt->ymd
       : DateTime::Format::Human::Duration->new->format_duration($now - $dt)
-          =~ /^(?:.*?weeks?, )?(\d+ [^\d]+)(?:,|$) /;
+          =~ /^(?:.*?weeks?, )?(\d+ [^\d]+)(?:,| and|$)/;
 
-    
     return $age;
   };
 }
index 93ec59e..227dcf6 100644 (file)
     USE Cycle('dark', 'light');
     FOR p IN projects %]
     <tr class="[% Cycle.next %]">
-        <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 } ) %]">[% p.description.substr(0, 20) %]</a></td>
+        <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} ) %]">[% p.description.substr(0, 20) %]</a></td>
         <td>[% p.owner %]</td>
         <td class="age2">[% p.last_change %]</td>
-        <td class="link"><a href="[% c.uri_for("summary") %]">summary</a>
-            | <a href="[% c.uri_for("shortlog") %]">shortlog</a>
-            | <a href="[% c.uri_for("log") %]">log</a>
-            | <a href="[% c.uri_for("tree") %]">tree</a></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>