X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FReaction%2FUI%2FController.pm;h=aa1b8bef045763d024567f503d0a3ba0abaab91f;hb=1ef7b9da7545471cbab981e32d42dee14267beb6;hp=fa9290fd612f07b3dac1ba5ae50d24a24bbfc68b;hpb=1810d30231d48a745bab3931c18044bc19c85e61;p=catagits%2FReaction.git diff --git a/lib/Reaction/UI/Controller.pm b/lib/Reaction/UI/Controller.pm index fa9290f..aa1b8be 100644 --- a/lib/Reaction/UI/Controller.pm +++ b/lib/Reaction/UI/Controller.pm @@ -22,7 +22,7 @@ sub push_viewport { if (my $conf_class = delete $vp_attr->{class}) { $class = $conf_class; } - %args = (%$vp_attr, @proto_args); + %args = %{ $self->merge_config_hashes($vp_attr, {@proto_args}) }; } else { $class = $vp_attr; %args = @proto_args; @@ -55,7 +55,7 @@ sub redirect_to { my $action; if(!ref $to){ $action = $self->action_for($to); - confess("Failed to locate action ${to} in " . $self->blessed) unless $action; + confess("Failed to locate action ${to} in " . blessed($self)) unless $action; } elsif( blessed $to && $to->isa('Catalyst::Action') ){ $action = $to; @@ -74,3 +74,89 @@ sub redirect_to { } 1; + +__END__; + +=head1 NAME + +Reaction::UI::Controller + +=head1 DESCRIPTION + +Base Reaction Controller class. Inherits from: + +=over 4 + +=item L +=item L +=item L + +=back + +=head1 METHODS + +=head2 push_viewport $vp_class, %args + +Creates a new instance of the L class +($vp_class) using the rest of the arguments given (%args). Defaults of +the action can be overridden by using the C key in the +controller configuration. For example to override the default number +of items in a CRUD list action: + +__PACKAGE__->config( + action => { + list => { ViewPort => { per_page => 50 } }, + } + ); + +The ViewPort is added to the L's FocusStack in +the stash, and also returned to the calling code. + +Related items: + +=over + +=item L +=item L + +=back + +TODO: explain how next_action as a scalar gets converted to the redirect arrayref thing + +=head2 pop_viewport + +=head2 pop_viewport_to $vp + +Call L or +L on +the C<< $c->stash->{focus_stack} >>. + +=head2 redirect_to $c, $to, $captures, $args, $attrs + +Construct a URI and redirect to it. + +$to can be: + +=over + +=item The name of an action in the current controller. + +=item A L instance. + +=item An arrayref of controller name and the name of an action in that +controller. + +=back + +$captures and $args default to the current requests $captures and +$args if not supplied. + +=head1 AUTHORS + +See L for authors. + +=head1 LICENSE + +See L for the license. + +=cut