1 package Reaction::UI::ViewPort::GridView::Role::Order;
7 has order_by => (isa => 'Str', is => 'rw', trigger_adopt('order_by'));
8 has order_by_desc => (isa => 'Int', is => 'rw', trigger_adopt('order_by'), lazy_build => 1);
10 implements _build_order_by_desc => as { 0 };
12 implements adopt_order_by => as {
13 shift->clear_current_collection;
16 around _build_current_collection => sub {
19 my $collection = $orig->(@_);
22 #XXX DBICism that needs to be fixed
23 if ($self->has_order_by) {
24 $attrs{order_by} = $self->order_by;
25 $attrs{order_by} .= ' DESC' if ($self->order_by_desc);
28 return $collection->where(undef, \%attrs);
31 around accept_events => sub { ('order_by', 'order_by_desc', shift->(@_)); };