From a0c5a7ce958bf1f619b95f7b5235b1fddd43e961 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 17 Feb 2011 21:41:31 -0600 Subject: actually, only edit needs the special http method thing --- lib/Narwhal/Component/Wiki.pm | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 lib/Narwhal/Component/Wiki.pm (limited to 'lib/Narwhal/Component/Wiki.pm') diff --git a/lib/Narwhal/Component/Wiki.pm b/lib/Narwhal/Component/Wiki.pm new file mode 100644 index 0000000..985e1af --- /dev/null +++ b/lib/Narwhal/Component/Wiki.pm @@ -0,0 +1,27 @@ +package Narwhal::Component::Wiki; +use Moose; + +with 'Narwhal::Component::Role::Wiki'; + +sub page { + my $self = shift; + my ($req, $page) = @_; + + my $page_obj = $self->lookup("page:$page"); + return $req->new_response(404) + unless $page_obj; + + $self->render( + $req, + 'page.tt', + { + text => $page_obj->text, + page => $page, + }, + ); +} + +__PACKAGE__->meta->make_immutable; +no Moose; + +1; -- cgit v1.2.3-54-g00ecf