diff --git a/Literature/lib/Literature.pm b/Literature/lib/Literature.pm index ef84868..a2bea24 100644 --- a/Literature/lib/Literature.pm +++ b/Literature/lib/Literature.pm @@ -16,4 +16,8 @@ get '/authors/' => sub { template 'authors', { authors => resultset('Author') }; }; +get '/authors/:id' => sub { + template 'author', { author => resultset('Author')->find(param('id')) }; +}; + true; diff --git a/Literature/views/author.tt b/Literature/views/author.tt new file mode 100644 index 0000000..c903a3e --- /dev/null +++ b/Literature/views/author.tt @@ -0,0 +1,18 @@ +[% META title = 'Author' %] + +

[% author.name %]

+[% IF author.born OR author.died %] +

[% IF author.born %]Born: [% author.born.strftime('%m %B %Y'); END -%] +[% IF author.born AND author.died %], [% END %] +[% IF author.died %]Died: [% author.died.strftime('%m %B %Y'); END %]

+[% END %] +

Works

+[% IF author.author_works.size %] + +[% ELSE %] +

No works found.

+[% END %] diff --git a/Literature/views/authors.tt b/Literature/views/authors.tt index c38acb1..fe05d29 100644 --- a/Literature/views/authors.tt +++ b/Literature/views/authors.tt @@ -1,5 +1,5 @@