aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ComponentUI
diff options
context:
space:
mode:
authorgroditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2009-05-06 15:58:22 +0000
committergroditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2009-05-06 15:58:22 +0000
commitc1b16a7de0859d507d350fd946abed84ac3683ad (patch)
treeb38c5cee9ef3d37ddba0a4fafab4230a439f4297 /lib/ComponentUI
parenta6dd5692f77afb88f9aa5a8de13a0519e24a361d (diff)
downloadreaction-c1b16a7de0859d507d350fd946abed84ac3683ad.tar.gz
reaction-c1b16a7de0859d507d350fd946abed84ac3683ad.zip
order_by fixes including enable_order_by and coerce_order_by
Diffstat (limited to 'lib/ComponentUI')
-rw-r--r--lib/ComponentUI/Controller/TestModel/Bar.pm12
-rw-r--r--lib/ComponentUI/Controller/TestModel/Baz.pm9
-rw-r--r--lib/ComponentUI/Controller/TestModel/Foo.pm1
3 files changed, 21 insertions, 1 deletions
diff --git a/lib/ComponentUI/Controller/TestModel/Bar.pm b/lib/ComponentUI/Controller/TestModel/Bar.pm
index 0839506..4b592c0 100644
--- a/lib/ComponentUI/Controller/TestModel/Bar.pm
+++ b/lib/ComponentUI/Controller/TestModel/Bar.pm
@@ -8,7 +8,19 @@ __PACKAGE__->config(
collection_name => 'Bar',
action => {
base => { Chained => '/base', PathPart => 'testmodel/bar' },
+ list => {
+ ViewPort => {
+ enable_order_by => [qw/name foo published_at/],
+ coerce_order_by => { foo => ['foo.last_name', 'foo.first_name'] },
+ }
+ }
},
);
+sub get_collection {
+ my ($self, $c) = @_;
+ my $collection = $self->next::method($c);
+ return $collection->where({}, { prefetch => 'foo' });
+}
+
1;
diff --git a/lib/ComponentUI/Controller/TestModel/Baz.pm b/lib/ComponentUI/Controller/TestModel/Baz.pm
index f1d7c8b..2fece5a 100644
--- a/lib/ComponentUI/Controller/TestModel/Baz.pm
+++ b/lib/ComponentUI/Controller/TestModel/Baz.pm
@@ -6,7 +6,14 @@ use Reaction::Class;
__PACKAGE__->config(
model_name => 'TestModel',
collection_name => 'Baz',
- action => { base => { Chained => '/base', PathPart => 'testmodel/baz' } },
+ action => {
+ base => { Chained => '/base', PathPart => 'testmodel/baz' },
+ list => {
+ ViewPort => {
+ enable_order_by => [qw/id name/],
+ },
+ },
+ },
);
1;
diff --git a/lib/ComponentUI/Controller/TestModel/Foo.pm b/lib/ComponentUI/Controller/TestModel/Foo.pm
index 56839a2..917ea17 100644
--- a/lib/ComponentUI/Controller/TestModel/Foo.pm
+++ b/lib/ComponentUI/Controller/TestModel/Foo.pm
@@ -13,6 +13,7 @@ __PACKAGE__->config(
action_prototypes => { delete_all => 'Delete all records' },
excluded_fields => [qw/id/],
action_order => [qw/delete_all create/],
+ enable_order_by => [qw/last_name/],
Member => {
action_order => [qw/view update delete/],
},