aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgroditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2009-05-26 14:54:58 +0000
committergroditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2009-05-26 14:54:58 +0000
commit428ba7bb99982ba6d8c6be8eca4d71484c6e0d37 (patch)
treeda4167c7b32ca5da7174bdfe571e355721aee662
parent2841624d93859db95f51351a0acb159fdc2a25d4 (diff)
parent1d97ac81307f0e5ab44163aa9665c1b15fd73543 (diff)
downloadreaction-428ba7bb99982ba6d8c6be8eca4d71484c6e0d37.tar.gz
reaction-428ba7bb99982ba6d8c6be8eca4d71484c6e0d37.zip
r27792@martha (orig r1097): groditi | 2009-05-26 10:17:32 -0400
POD for Order role
-rw-r--r--lib/Reaction/UI/ViewPort/Collection/Role/Order.pm51
-rw-r--r--lib/Reaction/UI/ViewPort/Collection/Role/Pager.pm4
2 files changed, 52 insertions, 3 deletions
diff --git a/lib/Reaction/UI/ViewPort/Collection/Role/Order.pm b/lib/Reaction/UI/ViewPort/Collection/Role/Order.pm
index 648b8cd..48a5001 100644
--- a/lib/Reaction/UI/ViewPort/Collection/Role/Order.pm
+++ b/lib/Reaction/UI/ViewPort/Collection/Role/Order.pm
@@ -63,6 +63,55 @@ around _build_current_collection => sub {
around accept_events => sub { ('order_by', 'order_by_desc', shift->(@_)); };
+1;
+__END__;
-1;
+=head1 NAME
+
+Reaction::UI::ViewPort::Collection::Role::Order - Order support for collections
+
+=head1 DESCRIPTION
+
+Role to add order support to collection viewports.
+
+=head1 ATTRIBUTES
+
+=head2 enable_order_by
+
+Re-writable array reference. Optionally use this to manually specify a list of
+fields that support ordering, instead of the default of all fields. This is
+useful to exclude computed values or non-indexed columns from being sortable.
+
+=head2 coerce_order_by
+
+Re-writeable hash reference. Optionally use this to manually specify the way in
+which a field should be ordered. This is useful when the field name and the
+query to sort it differ. E.g. for a belongs_to item:
+
+ coerce_order_by => { foo => ['foo.last_name', 'foo.first_name'] },
+
+=head2 order_by
+
+Re-writeable string. Optionally set it to dictate which field to use when
+sorting.
+
+=head2 order_by_desc
+
+Re-writeable boolean. Optionally use descending order when sorting. Defaults to false.
+
+=head1 METHODS
+
+=head2 can_order_by $field_name
+
+Returns true if sorting by that field is supported, false otherwise.
+
+=head1 AUTHORS
+
+See L<Reaction::Class> for authors.
+
+=head1 LICENSE
+
+See L<Reaction::Class> for the license.
+
+=cut
diff --git a/lib/Reaction/UI/ViewPort/Collection/Role/Pager.pm b/lib/Reaction/UI/ViewPort/Collection/Role/Pager.pm
index 5f7c8f2..5947752 100644
--- a/lib/Reaction/UI/ViewPort/Collection/Role/Pager.pm
+++ b/lib/Reaction/UI/ViewPort/Collection/Role/Pager.pm
@@ -47,6 +47,6 @@ around _build_current_collection => sub {
return $collection->where(undef, {rows => $self->per_page})->page($self->page);
};
-
-
1;
+
+__END__;