diff options
author | groditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2009-10-02 20:11:10 +0000 |
---|---|---|
committer | groditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2009-10-02 20:11:10 +0000 |
commit | cfa0aa508979066893f1867e27da32372ba8acf2 (patch) | |
tree | 7489ec5fce11d39259cc09d8a11bdb3a3be15d55 | |
parent | 9bb62506e33250989de0bbd80bdd182d9425e5c6 (diff) | |
parent | b8da93ebed6c17a1919d7cde6b784181b5b6d2c8 (diff) | |
download | reaction-cfa0aa508979066893f1867e27da32372ba8acf2.tar.gz reaction-cfa0aa508979066893f1867e27da32372ba8acf2.zip |
r31705@martha (orig r1240): edenc | 2009-09-28 20:19:59 -0400
made hidden array field use the value event instead of value_string
r31706@martha (orig r1241): purge | 2009-10-02 04:51:59 -0400
allow redirect_to a url parameter
r31707@martha (orig r1242): groditi | 2009-10-02 16:09:49 -0400
undo change allowing domain in redirect_to
r31708@martha (orig r1243): groditi | 2009-10-02 16:10:38 -0400
cleanup of hard to read layout_args code
-rw-r--r-- | lib/Reaction/UI/ViewPort/Role/Actions.pm | 14 | ||||
-rw-r--r-- | lib/Reaction/UI/Widget/Field/Mutable/HiddenArray.pm | 4 | ||||
-rw-r--r-- | share/skin/base/layout/field/mutable.tt | 3 | ||||
-rw-r--r-- | share/skin/base/layout/field/mutable/choose_one.tt | 3 |
4 files changed, 17 insertions, 7 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 => $_; }; 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 -<input type="[% field_type %]" name="[% field_name %]" id="[% field_id %]" - [% field_body %] /> +<input type="[% field_type %]" name="[% field_name %]" id="[% field_id %]" [% field_body %] /> =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 - <option value="[% option_value %]" [% option_is_selected %] - > [% option_name %]</option> + <option value="[% option_value %]" [% option_is_selected %]>[% option_name %]</option> =for layout option_is_selected_yes |