[Rt-commit] rt branch, admin_ui, updated. 949e4cb1dfb85f51e8e0f10237ceb3c3265f6f98
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Wed Dec 30 05:37:15 EST 2009
The branch, admin_ui has been updated
via 949e4cb1dfb85f51e8e0f10237ceb3c3265f6f98 (commit)
from 031fecc68cdd640b244aa81f5cc643d7ce6e5b2f (commit)
Summary of changes:
lib/RT/Action/WithCustomFields.pm | 50 ++++++++++++++++++++++++------------
1 files changed, 33 insertions(+), 17 deletions(-)
- Log -----------------------------------------------------------------
commit 949e4cb1dfb85f51e8e0f10237ceb3c3265f6f98
Author: sunnavy <sunnavy at bestpractical.com>
Date: Wed Dec 30 18:35:40 2009 +0800
add _setup_custom_fields so we can get cf args directly instead of transmitting a method to do stuff
diff --git a/lib/RT/Action/WithCustomFields.pm b/lib/RT/Action/WithCustomFields.pm
index a0b8083..d80335e 100644
--- a/lib/RT/Action/WithCustomFields.pm
+++ b/lib/RT/Action/WithCustomFields.pm
@@ -9,9 +9,22 @@ sub _add_custom_fields {
my $cfs = $args{cfs};
my $method = $args{method};
- while (my $cf = $cfs->next) {
+ my @args = $self->_setup_custom_fields( cfs => $cfs );
+
+ for my $args ( @args ) {
+ $self->$method( $args );
+ }
+}
+
+sub _setup_custom_fields {
+ my $self = shift;
+ my %args = @_;
+ my $cfs = $args{cfs};
+
+ my @args;
+ while ( my $cf = $cfs->next ) {
my $render_as = $cf->type_for_rendering;
- my $name = 'cf_' . $cf->id;
+ my $name = 'cf_' . $cf->id;
my %args = (
name => $name,
@@ -19,25 +32,28 @@ sub _add_custom_fields {
render_as => $render_as,
);
- if ($render_as =~ /Select/i) {
- $args{valid_values} = [ {
- collection => $cf->values,
- display_from => 'name',
- value_from => 'name',
- } ];
+ if ( $render_as =~ /Select/i ) {
+ $args{valid_values} = [
+ {
+ collection => $cf->values,
+ display_from => 'name',
+ value_from => 'name',
+ }
+ ];
}
- elsif ($render_as =~ /Combobox/i) {
- $args{available_values} = [ {
- collection => $cf->values,
- display_from => 'name',
- value_from => 'name',
- } ];
+ elsif ( $render_as =~ /Combobox/i ) {
+ $args{available_values} = [
+ {
+ collection => $cf->values,
+ display_from => 'name',
+ value_from => 'name',
+ }
+ ];
}
- $self->$method(
- %args,
- );
+ push @args, \%args;
}
+ return @args;
}
1;
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list