aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Reaction/UI/Controller.pm
diff options
context:
space:
mode:
authorgroditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2009-12-15 21:07:09 +0000
committergroditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2009-12-15 21:07:09 +0000
commitaa15b8c15992caa0b57c5066865b675c5d8587dc (patch)
treef4ca78e432197a294172df8a63f0351d32dc6685 /lib/Reaction/UI/Controller.pm
parent647af385a1d7e40412752efb61672c80067a302f (diff)
parent66057c3c1af63001383cd73e83c5a8adc94cef97 (diff)
downloadreaction-aa15b8c15992caa0b57c5066865b675c5d8587dc.tar.gz
reaction-aa15b8c15992caa0b57c5066865b675c5d8587dc.zip
r31711@martha (orig r1246): groditi | 2009-10-02 17:01:17 -0400
move redirect_to to a role and deprecate it
Diffstat (limited to 'lib/Reaction/UI/Controller.pm')
-rw-r--r--lib/Reaction/UI/Controller.pm42
1 files changed, 12 insertions, 30 deletions
diff --git a/lib/Reaction/UI/Controller.pm b/lib/Reaction/UI/Controller.pm
index f428941..3ed253c 100644
--- a/lib/Reaction/UI/Controller.pm
+++ b/lib/Reaction/UI/Controller.pm
@@ -7,7 +7,10 @@ use Scalar::Util 'weaken';
use namespace::clean -except => [ qw(meta) ];
has context => (is => 'ro', isa => 'Object', weak_ref => 1);
-with 'Catalyst::Component::InstancePerContext';
+with(
+ 'Catalyst::Component::InstancePerContext',
+ 'Reaction::UI::Controller::Role::RedirectTo'
+);
sub build_per_context_instance {
my ($self, $c, @args) = @_;
@@ -54,31 +57,6 @@ sub pop_viewports_to {
return $self->context->stash->{focus_stack}->pop_viewports_to($vp);
}
-sub redirect_to {
- my ($self, $c, $to, $cap, $args, $attrs) = @_;
-
- #the confess calls could be changed later to $c->log ?
- my $action;
- my $reftype = ref($to);
- if( $reftype eq '' ){
- $action = $self->action_for($to);
- confess("Failed to locate action ${to} in " . blessed($self)) unless $action;
- } elsif($reftype eq 'ARRAY' && @$to == 2){ #is that overkill / too strict?
- $action = $c->controller($to->[0])->action_for($to->[1]);
- confess("Failed to locate action $to->[1] in $to->[0]" ) unless $action;
- } elsif( blessed $to && $to->isa('Catalyst::Action') ){
- $action = $to;
- } else{
- confess("Failed to locate action from ${to}");
- }
-
- $cap ||= $c->req->captures;
- $args ||= $c->req->args;
- $attrs ||= {};
- my $uri = $c->uri_for($action, $cap, @$args, $attrs);
- $c->res->redirect($uri);
-}
-
sub make_context_closure {
my($self, $closure) = @_;
my $ctx = $self->context;
@@ -115,13 +93,17 @@ Reaction::UI::Controller - Reaction Base Controller Class
=head1 DESCRIPTION
-Base Reaction Controller class. Inherits from:
+Base Reaction Controller class, subclass of L<Catalyst::Controller>.
+
+=head1 ROLES CONSUMED
=over 4
-=item L<Catalyst::Controller>
-=item L<Catalyst::Component::ACCEPT_CONTEXT>
-=item L<Reaction::Object>
+=item L<Catalyst::Component::InstancePerContext>
+
+=item L<Reaction::UI::Controller::Role::RedirectTo>
+
+Please not that this functionality is now deprecated.
=back