From: broquaint Date: Sun, 1 Nov 2009 17:02:00 +0000 (+0000) Subject: Started the switch from hand-written URLs to uri_for. X-Git-Tag: 0.000000_01~100^2~9 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=61b56ed67fa1788aed0d0acf11e251308b9943f4;p=catagits%2FGitalist.git Started the switch from hand-written URLs to uri_for. --- diff --git a/lib/Gitalist.pm b/lib/Gitalist.pm index 4429439..e877fa7 100644 --- a/lib/Gitalist.pm +++ b/lib/Gitalist.pm @@ -9,20 +9,35 @@ extends 'Catalyst'; use Catalyst qw/ ConfigLoader Static::Simple - StackTrace/; + StackTrace/; + +use Class::C3::Adopt::NEXT -no_warn; + our $VERSION = '0.01'; # Bring in the libified gitweb.cgi. use gitweb; __PACKAGE__->config( - name => 'Gitalist', - default_view => 'Default', + name => 'Gitalist', + default_view => 'Default', ); # Start the application __PACKAGE__->setup(); +sub uri_for { + my $p = ref $_[-1] eq 'HASH' + ? $_[-1] + : push(@_, {}) && $_[-1]; + $p->{p} = $_[0]->model('Git')->project; + + (my $uri = $_[0]->NEXT::uri_for(@_[1 .. $#_])) + # Ampersand! What is this, the 90s? + =~ s/&/;/g; + return $uri; +} + =head1 NAME Gitalist - Catalyst based application diff --git a/lib/Gitalist/Controller/Root.pm b/lib/Gitalist/Controller/Root.pm index 6bb73e9..6e3a0de 100644 --- a/lib/Gitalist/Controller/Root.pm +++ b/lib/Gitalist/Controller/Root.pm @@ -94,7 +94,7 @@ sub index :Path :Args(0) { my $list = $c->model('Git')->list_projects; unless(@$list) { - die "No projects found"; + die "No projects found in ".Gitalist->config->{repodir}; } $c->stash( diff --git a/templates/blob.tt2 b/templates/blob.tt2 index 7b04661..df95156 100644 --- a/templates/blob.tt2 +++ b/templates/blob.tt2 @@ -1,6 +1,6 @@ -[% PROCESS 'commit-nav.tt2' object = head %] +[% PROCESS 'nav/actions.tt2' object = head %]
[% head.comment.substr(0, 85) %] ...
diff --git a/templates/blobdiff.tt2 b/templates/blobdiff.tt2 index 8d6820b..d03aeb0 100644 --- a/templates/blobdiff.tt2 +++ b/templates/blobdiff.tt2 @@ -1,4 +1,4 @@ -[% PROCESS 'commit-nav.tt2' object = commit %] +[% PROCESS 'nav/actions.tt2' object = commit %]
[% commit.comment.substr(0, 85) %] ... diff --git a/templates/commit-nav.tt2 b/templates/commit-nav.tt2 deleted file mode 100644 index 24f38bb..0000000 --- a/templates/commit-nav.tt2 +++ /dev/null @@ -1,8 +0,0 @@ -
- summary | - shortlog | - log | - commit | - commitdiff | - tree -
diff --git a/templates/commit.tt2 b/templates/commit.tt2 index c671f41..3d3d54b 100644 --- a/templates/commit.tt2 +++ b/templates/commit.tt2 @@ -1,4 +1,4 @@ -[% INCLUDE 'commit-nav.tt2' object = commit %] +[% INCLUDE 'nav/actions.tt2' object = commit %]
[% commit.comment.substr(0, 85) %] ... diff --git a/templates/commitdiff.tt2 b/templates/commitdiff.tt2 index a106b26..24723bc 100644 --- a/templates/commitdiff.tt2 +++ b/templates/commitdiff.tt2 @@ -1,4 +1,4 @@ -[% PROCESS 'commit-nav.tt2' object = commit %] +[% PROCESS 'nav/actions.tt2' object = commit %]
[% commit.comment.substr(0, 85) %] ... diff --git a/templates/heads.tt2 b/templates/heads.tt2 index 016b0d4..86c8cec 100644 --- a/templates/heads.tt2 +++ b/templates/heads.tt2 @@ -1,4 +1,4 @@ -[% INCLUDE 'commit-nav.tt2' object = commit %] +[% INCLUDE 'nav/actions.tt2' object = commit %]
[% project %] diff --git a/templates/log.tt2 b/templates/log.tt2 index 2953d4e..29dbe96 100644 --- a/templates/log.tt2 +++ b/templates/log.tt2 @@ -1,4 +1,4 @@ -[% INCLUDE 'commit-nav.tt2' object = commit %] +[% INCLUDE 'nav/actions.tt2' object = commit %] [% INCLUDE '_log_pager.tt2' %] diff --git a/templates/nav/actions.tt2 b/templates/nav/actions.tt2 new file mode 100644 index 0000000..8f2293b --- /dev/null +++ b/templates/nav/actions.tt2 @@ -0,0 +1,8 @@ +
+ summary | + shortlog | + log | + commit | + commitdiff | + tree +
diff --git a/templates/shortlog.tt2 b/templates/shortlog.tt2 index c8e9ef2..2ad5505 100644 --- a/templates/shortlog.tt2 +++ b/templates/shortlog.tt2 @@ -1,4 +1,4 @@ -[% INCLUDE 'commit-nav.tt2' object = commit %] +[% INCLUDE 'nav/actions.tt2' object = commit %]
[% project %] diff --git a/templates/summary.tt2 b/templates/summary.tt2 index f320ffc..7ccf7af 100644 --- a/templates/summary.tt2 +++ b/templates/summary.tt2 @@ -1,4 +1,4 @@ -[% PROCESS 'commit-nav.tt2' object = head %] +[% PROCESS 'nav/actions.tt2' object = head %]
@@ -9,11 +9,11 @@
-

shortlog

+

shortlog

[% INCLUDE '_shortlog.tt2' %]
-

heads

+

heads

[% INCLUDE '_heads.tt2' %]
diff --git a/templates/tree.tt2 b/templates/tree.tt2 index 7b55830..4419028 100644 --- a/templates/tree.tt2 +++ b/templates/tree.tt2 @@ -1,4 +1,4 @@ -[% INCLUDE 'commit-nav.tt2' object = commit %] +[% INCLUDE 'nav/actions.tt2' object = commit %]
[% commit.comment.substr(0, 85) %] ...