From 224898fb1fd3046fcb82461610d5dd3ff0d0b01f Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 17 Feb 2011 21:35:06 -0600 Subject: use OX::View::TT --- lib/Narwhal.pm | 4 ++-- lib/Narwhal/Component/Role/Wiki.pm | 4 ++-- lib/Narwhal/Component/Wiki/Edit.pm | 14 ++++++-------- lib/Narwhal/Component/Wiki/Page.pm | 12 ++++-------- 4 files changed, 14 insertions(+), 20 deletions(-) diff --git a/lib/Narwhal.pm b/lib/Narwhal.pm index 82ad0ab..333ba89 100644 --- a/lib/Narwhal.pm +++ b/lib/Narwhal.pm @@ -23,8 +23,8 @@ component WikiEdit => 'Narwhal::Component::Wiki::Edit', ( ); # turn these two into specialized classes later -component TT => 'Template', ( - INCLUDE_PATH => depends_on('/Config/template_root'), +component TT => 'OX::View::TT', ( + template_root => depends_on('/Config/template_root'), ); component Kioku => 'KiokuX::Model', ( diff --git a/lib/Narwhal/Component/Role/Wiki.pm b/lib/Narwhal/Component/Role/Wiki.pm index c57cf7e..a48cf9b 100644 --- a/lib/Narwhal/Component/Role/Wiki.pm +++ b/lib/Narwhal/Component/Role/Wiki.pm @@ -8,9 +8,9 @@ has kioku => ( ); has tt => ( - isa => 'Template', + isa => 'OX::View::TT', required => 1, - handles => ['process'], + handles => ['render'], ); has scope => ( diff --git a/lib/Narwhal/Component/Wiki/Edit.pm b/lib/Narwhal/Component/Wiki/Edit.pm index d05e7a0..df03598 100644 --- a/lib/Narwhal/Component/Wiki/Edit.pm +++ b/lib/Narwhal/Component/Wiki/Edit.pm @@ -8,17 +8,15 @@ sub get { my ($req, $page) = @_; my $page_obj = $self->lookup("page:$page"); - my $out; - $self->process( + + $self->render( + $req, 'edit.tt', { - uri_for => sub { $req->uri_for({@_}) }, - text => ($page_obj ? $page_obj->text : ''), - page => $page - }, - \$out, + text => ($page_obj ? $page_obj->text : ''), + page => $page, + } ); - return $req->new_response(200, [], $out); } sub post { diff --git a/lib/Narwhal/Component/Wiki/Page.pm b/lib/Narwhal/Component/Wiki/Page.pm index 09cdb34..8dd6adf 100644 --- a/lib/Narwhal/Component/Wiki/Page.pm +++ b/lib/Narwhal/Component/Wiki/Page.pm @@ -11,18 +11,14 @@ sub get { return $req->new_response(404) unless $page_obj; - my $out; - $self->process( + $self->render( + $req, 'page.tt', { - uri_for => sub { $req->uri_for({@_}) }, - text => $page_obj->text, - page => $page + text => $page_obj->text, + page => $page, }, - \$out ); - - return $req->new_response(200, [], $out); } __PACKAGE__->meta->make_immutable; -- cgit v1.2.3-54-g00ecf