diff options
author | edenc <edenc@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2009-01-28 23:06:24 +0000 |
---|---|---|
committer | edenc <edenc@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2009-01-28 23:06:24 +0000 |
commit | f5e2ab69e2045b9ffe04b7436c7e2cf51bc4c4e9 (patch) | |
tree | 973a06f93e74d08e7338204f76b401ffc124e54b /lib/Reaction/UI/ViewPort/Collection | |
parent | 46ce622d342de1ad3bef7354e4653ddc91fabaf1 (diff) | |
download | reaction-f5e2ab69e2045b9ffe04b7436c7e2cf51bc4c4e9.tar.gz reaction-f5e2ab69e2045b9ffe04b7436c7e2cf51bc4c4e9.zip |
added included_fields patch from abs
Diffstat (limited to 'lib/Reaction/UI/ViewPort/Collection')
-rw-r--r-- | lib/Reaction/UI/ViewPort/Collection/Grid.pm | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/Reaction/UI/ViewPort/Collection/Grid.pm b/lib/Reaction/UI/ViewPort/Collection/Grid.pm index c9fc2f1..3879233 100644 --- a/lib/Reaction/UI/ViewPort/Collection/Grid.pm +++ b/lib/Reaction/UI/ViewPort/Collection/Grid.pm @@ -10,6 +10,7 @@ extends 'Reaction::UI::ViewPort::Collection'; has field_order => ( is => 'ro', isa => 'ArrayRef', lazy_build => 1); has excluded_fields => ( is => 'ro', isa => 'ArrayRef', lazy_build => 1); +has included_fields => ( is => 'ro', isa => 'ArrayRef', lazy_build => 1); has computed_field_order => (is => 'ro', isa => 'ArrayRef', lazy_build => 1); has _raw_field_labels => ( @@ -58,13 +59,17 @@ sub _build_field_order { []; } sub _build_excluded_fields { []; } +sub _build_included_fields { [] } + #this is a total clusterfuck and it sucks we should just eliminate it and have # the grid members not render ArrayRef or Collection fields sub _build_computed_field_order { my ($self) = @_; my %excluded = map { $_ => undef } @{ $self->excluded_fields }; + my %included = map { $_ => undef } @{ $self->included_fields }; #treat _$field_name as private and exclude fields with no reader - my @names = grep { $_ !~ /^_/ && !exists($excluded{$_})} map { $_->name } + my @names = grep { $_ !~ /^_/ && (!%included || exists( $included{$_}) ) + && !exists($excluded{$_})} map { $_->name } grep { !($_->has_type_constraint && ($_->type_constraint->is_a_type_of('ArrayRef') || @@ -118,6 +123,21 @@ homogenous collection of Reaction::InterfaceModel::Objects as a grid. =head2 excluded_fields +List of field names to exclude. + +=head2 included_fields + +List of field names to include. If both C<included_fields> and +C<excluded_fields> are specified the result is those fields which +are in C<included_fields> and not in C<excluded_fields>. + +=head2 included_fields + +List of field names to include. If both C<included_fields> and +C<excluded_fields> are specified the result is those fields which +are in C<included_fields> and not in C<excluded_fields>. + + =head2 field_labels =head2 _raw_field_labels |