use Catalyst qw/-Debug
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
my $list = $c->model('Git')->list_projects;
unless(@$list) {
- die "No projects found";
+ die "No projects found in ".Gitalist->config->{repodir};
}
$c->stash(
<link rel="stylesheet" type="text/css" href="/static/css/syntax/[% language %].css"/>
-[% PROCESS 'commit-nav.tt2' object = head %]
+[% PROCESS 'nav/actions.tt2' object = head %]
<div class='commit-message'>
[% head.comment.substr(0, 85) %] ...
</div>
-[% PROCESS 'commit-nav.tt2' object = commit %]
+[% PROCESS 'nav/actions.tt2' object = commit %]
<div class='commit-message'>
[% commit.comment.substr(0, 85) %] ...
+++ /dev/null
-<div id='commit-nav'>
- <a href="/summary?p=[% project %]">summary</a> |
- <a href="/shortlog?p=[% project %];h=[% object.sha1 %]">shortlog</a> |
- <a href="/log?p=[% project %];h=[% object.sha1 %]">log</a> |
- <a href="/commit?p=[% project %];h=[% object.sha1 %]">commit</a> |
- <a href="/commitdiff?p=[% project %];h=[% object.sha1 %]">commitdiff</a> |
- <a href="/tree?p=[% project %];h=[% object.tree_sha1 %];hb=[% object.sha1 %]">tree</a>
-</div>
-[% INCLUDE 'commit-nav.tt2' object = commit %]
+[% INCLUDE 'nav/actions.tt2' object = commit %]
<div class='commit-message'>
[% commit.comment.substr(0, 85) %] ...
-[% PROCESS 'commit-nav.tt2' object = commit %]
+[% PROCESS 'nav/actions.tt2' object = commit %]
<div class='commit-message'>
[% commit.comment.substr(0, 85) %] ...
-[% INCLUDE 'commit-nav.tt2' object = commit %]
+[% INCLUDE 'nav/actions.tt2' object = commit %]
<div>
[% project %]
-[% INCLUDE 'commit-nav.tt2' object = commit %]
+[% INCLUDE 'nav/actions.tt2' object = commit %]
[% INCLUDE '_log_pager.tt2' %]
--- /dev/null
+<div id='commit-nav'>
+ <a href="[% c.uri_for('summary') %]">summary</a> |
+ <a href="[% c.uri_for('shortlog', {h=object.sha1}) %]">shortlog</a> |
+ <a href="[% c.uri_for('log', {h=object.sha1}) %]">log</a> |
+ <a href="[% c.uri_for('commit', {h=object.sha1}) %]">commit</a> |
+ <a href="[% c.uri_for('commitdiff', {h=object.sha1}) %]">commitdiff</a> |
+ <a href="[% c.uri_for('tree', {h=object.tree_sha1, hb=object.sha1}) %]">tree</a>
+</div>
-[% INCLUDE 'commit-nav.tt2' object = commit %]
+[% INCLUDE 'nav/actions.tt2' object = commit %]
<div>
[% project %]
-[% PROCESS 'commit-nav.tt2' object = head %]
+[% PROCESS 'nav/actions.tt2' object = head %]
<div class='summary'>
<dl>
</div>
<div class='shortlog'>
-<h2><a href='/shortlog?p=[% project %]'>shortlog</a></h2>
+<h2><a href='[% c.uri_for('shortlog') %]'>shortlog</a></h2>
[% INCLUDE '_shortlog.tt2' %]
</div>
<div class='heads'>
-<h2><a href='/heads?p=[% project %]'>heads</a></h2>
+<h2><a href='[% c.uri_for('heads') %]'>heads</a></h2>
[% INCLUDE '_heads.tt2' %]
</div>
-[% INCLUDE 'commit-nav.tt2' object = commit %]
+[% INCLUDE 'nav/actions.tt2' object = commit %]
<div class='commit-message'>
[% commit.comment.substr(0, 85) %] ...