aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Reaction
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Reaction')
-rw-r--r--lib/Reaction/UI/ViewPort/Role/Actions.pm14
-rw-r--r--lib/Reaction/UI/Widget/Field/Mutable/HiddenArray.pm4
2 files changed, 15 insertions, 3 deletions
diff --git a/lib/Reaction/UI/ViewPort/Role/Actions.pm b/lib/Reaction/UI/ViewPort/Role/Actions.pm
index 89b5ae3..f2d40fb 100644
--- a/lib/Reaction/UI/ViewPort/Role/Actions.pm
+++ b/lib/Reaction/UI/ViewPort/Role/Actions.pm
@@ -62,14 +62,22 @@ 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 $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 => ( ref($layout) eq 'CODE' ? $layout->($target, $ctx) : $layout ),
- layout_args => ( ref($layout_args) eq 'CODE' ? $layout_args->($target, $ctx) : $layout_args ),
+ layout => $layout,
+ ( ref($layout_args) eq ' HASH' ? layout_args => $layout_args : () ),
);
push(@act, $action);
}
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 => $_;
};