From bbf88e0ddb212f945a9641b80746e20cbafe3378 Mon Sep 17 00:00:00 2001 From: edenc Date: Tue, 29 Sep 2009 00:19:59 +0000 Subject: made hidden array field use the value event instead of value_string --- lib/Reaction/UI/Widget/Field/Mutable/HiddenArray.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Reaction/UI/Widget/Field/Mutable/HiddenArray.pm b/lib/Reaction/UI/Widget/Field/Mutable/HiddenArray.pm index e4e1c10..a65f3cb 100644 --- a/lib/Reaction/UI/Widget/Field/Mutable/HiddenArray.pm +++ b/lib/Reaction/UI/Widget/Field/Mutable/HiddenArray.pm @@ -11,6 +11,10 @@ implements fragment hidden_list { }; implements fragment hidden_field { + # this needs to go here in order to override the field_name from + # Widget::Field::Mutable::Simple which defaults to value_string and does not + # make sense for HiddenArray + arg field_name => event_id 'value'; arg field_value => $_; }; -- cgit v1.2.3 From 08c27c5b18df934a3f052d50a9e4ab361ddc4f3e Mon Sep 17 00:00:00 2001 From: purge Date: Fri, 2 Oct 2009 08:51:59 +0000 Subject: allow redirect_to a url parameter --- lib/Reaction/UI/Controller.pm | 3 ++- lib/Reaction/UI/ViewPort/Role/Actions.pm | 10 +++++++--- share/skin/base/layout/field/mutable.tt | 3 +-- share/skin/base/layout/field/mutable/choose_one.tt | 3 +-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/Reaction/UI/Controller.pm b/lib/Reaction/UI/Controller.pm index 2d1b843..8222215 100644 --- a/lib/Reaction/UI/Controller.pm +++ b/lib/Reaction/UI/Controller.pm @@ -55,7 +55,7 @@ sub pop_viewports_to { } sub redirect_to { - my ($self, $c, $to, $cap, $args, $attrs) = @_; + my ($self, $c, $to, $cap, $args, $attrs, $domain) = @_; #the confess calls could be changed later to $c->log ? my $action; @@ -76,6 +76,7 @@ sub redirect_to { $args ||= $c->req->args; $attrs ||= {}; my $uri = $c->uri_for($action, $cap, @$args, $attrs); + $uri->host($domain) if $domain; $c->res->redirect($uri); } diff --git a/lib/Reaction/UI/ViewPort/Role/Actions.pm b/lib/Reaction/UI/ViewPort/Role/Actions.pm index 89b5ae3..778115b 100644 --- a/lib/Reaction/UI/ViewPort/Role/Actions.pm +++ b/lib/Reaction/UI/ViewPort/Role/Actions.pm @@ -62,14 +62,18 @@ sub _build_actions { my $uri = $proto->{uri} or confess('uri is required in prototype action'); my $label = exists $proto->{label} ? $proto->{label} : $proto_name; my $layout = exists $proto->{layout} ? $proto->{layout} : 'uri'; - my $layout_args = exists $proto->{layout_args} ? $proto->{layout_args} : {}; my $action = Reaction::UI::ViewPort::URI->new( location => join ('-', $loc, 'action', $i++), uri => ( ref($uri) eq 'CODE' ? $uri->($target, $ctx) : $uri ), display => ( ref($label) eq 'CODE' ? $label->($target, $ctx) : $label ), - layout => ( ref($layout) eq 'CODE' ? $layout->($target, $ctx) : $layout ), - layout_args => ( ref($layout_args) eq 'CODE' ? $layout_args->($target, $ctx) : $layout_args ), + layout => $layout, + exists $proto->{layout_args} ? + ( ref($proto->{layout_args}) eq 'CODE' ? + $proto->{layout_args}->($target, $ctx) + : + $proto->{layout_args} ) + : () ); push(@act, $action); } diff --git a/share/skin/base/layout/field/mutable.tt b/share/skin/base/layout/field/mutable.tt index 333a27a..c4ef2e1 100644 --- a/share/skin/base/layout/field/mutable.tt +++ b/share/skin/base/layout/field/mutable.tt @@ -18,8 +18,7 @@ class="required_field" =for layout field - + =for layout field_body diff --git a/share/skin/base/layout/field/mutable/choose_one.tt b/share/skin/base/layout/field/mutable/choose_one.tt index 0db3ffd..c366a86 100644 --- a/share/skin/base/layout/field/mutable/choose_one.tt +++ b/share/skin/base/layout/field/mutable/choose_one.tt @@ -15,8 +15,7 @@ =for layout option - + =for layout option_is_selected_yes -- cgit v1.2.3 From 110f5e491eb25e6434bd964388fdbba9619b35f6 Mon Sep 17 00:00:00 2001 From: groditi Date: Fri, 2 Oct 2009 20:09:49 +0000 Subject: undo change allowing domain in redirect_to --- lib/Reaction/UI/Controller.pm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/Reaction/UI/Controller.pm b/lib/Reaction/UI/Controller.pm index 8222215..2d1b843 100644 --- a/lib/Reaction/UI/Controller.pm +++ b/lib/Reaction/UI/Controller.pm @@ -55,7 +55,7 @@ sub pop_viewports_to { } sub redirect_to { - my ($self, $c, $to, $cap, $args, $attrs, $domain) = @_; + my ($self, $c, $to, $cap, $args, $attrs) = @_; #the confess calls could be changed later to $c->log ? my $action; @@ -76,7 +76,6 @@ sub redirect_to { $args ||= $c->req->args; $attrs ||= {}; my $uri = $c->uri_for($action, $cap, @$args, $attrs); - $uri->host($domain) if $domain; $c->res->redirect($uri); } -- cgit v1.2.3 From b8da93ebed6c17a1919d7cde6b784181b5b6d2c8 Mon Sep 17 00:00:00 2001 From: groditi Date: Fri, 2 Oct 2009 20:10:38 +0000 Subject: cleanup of hard to read layout_args code --- lib/Reaction/UI/ViewPort/Role/Actions.pm | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/Reaction/UI/ViewPort/Role/Actions.pm b/lib/Reaction/UI/ViewPort/Role/Actions.pm index 778115b..f2d40fb 100644 --- a/lib/Reaction/UI/ViewPort/Role/Actions.pm +++ b/lib/Reaction/UI/ViewPort/Role/Actions.pm @@ -63,17 +63,21 @@ sub _build_actions { my $label = exists $proto->{label} ? $proto->{label} : $proto_name; my $layout = exists $proto->{layout} ? $proto->{layout} : 'uri'; + my $layout_args; + if( exists $proto->{layout_args} ){ + if( ref($proto->{layout_args}) eq 'CODE' ){ + $layout_args = $proto->{layout_args}->($target, $ctx); + } else { + $layout_args = $proto->{layout_args}; + } + } + my $action = Reaction::UI::ViewPort::URI->new( location => join ('-', $loc, 'action', $i++), uri => ( ref($uri) eq 'CODE' ? $uri->($target, $ctx) : $uri ), display => ( ref($label) eq 'CODE' ? $label->($target, $ctx) : $label ), layout => $layout, - exists $proto->{layout_args} ? - ( ref($proto->{layout_args}) eq 'CODE' ? - $proto->{layout_args}->($target, $ctx) - : - $proto->{layout_args} ) - : () + ( ref($layout_args) eq ' HASH' ? layout_args => $layout_args : () ), ); push(@act, $action); } -- cgit v1.2.3