[Jifty-commit] r4806 - in jifty/trunk: lib/Jifty/Plugin/REST
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Thu Jan 10 15:00:45 EST 2008
Author: sartak
Date: Thu Jan 10 15:00:44 2008
New Revision: 4806
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/Plugin/REST/Dispatcher.pm
Log:
r50044 at onn: sartak | 2008-01-10 14:59:41 -0500
REST: Add __order_by, __order_by_asc, and __order_by_desc to /=/search
Modified: jifty/trunk/lib/Jifty/Plugin/REST/Dispatcher.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/REST/Dispatcher.pm (original)
+++ jifty/trunk/lib/Jifty/Plugin/REST/Dispatcher.pm Thu Jan 10 15:00:44 2008
@@ -485,8 +485,24 @@
current_page => 1,
);
},
+ __order_by => sub {
+ my $col = shift;
+ my $order = shift || 'ASC';
+
+ $collection->order_by(
+ column => $col,
+ order => $order,
+ );
+ },
);
+ # /__order_by/name/desc is impossible to distinguish between ordering by
+ # 'name', descending, and ordering by 'name', with output column 'desc'.
+ # so we use __order_by_desc instead (and __order_by_asc is provided for
+ # consistency)
+ $special{__order_by_asc} = $special{__order_by};
+ $special{__order_by_desc} = sub { $special{__order_by}->($_[0], 'DESC') };
+
while (@pieces) {
my $column = shift @pieces;
my $value = shift @pieces;
More information about the Jifty-commit
mailing list