From f96685bf9601619f73fb17676f12ab6915a0cabd Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Thu, 1 Oct 2015 13:13:42 +0100 Subject: [PATCH] Filling out some basic templates. --- Literature/lib/Literature.pm | 4 ++++ Literature/views/author.tt | 18 ++++++++++++++++++ Literature/views/authors.tt | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 Literature/views/author.tt 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 @@