[prev in list] [next in list] [prev in thread] [next in thread]
List: bricolage-devel
Subject: Re: patch for new sorting options
From: "David E. Wheeler" <david () kineticode ! com>
Date: 2008-01-23 0:47:17
Message-ID: 88C8A987-B91D-41A4-BBF3-FB2114504F96 () kineticode ! com
[Download RAW message or body]
And this?
Thanks,
David
On Dec 18, 2007, at 11:30, Greg Heo wrote:
> Here's patch 2 of 2 for the day...
>
> This one adds an additional option to the cover date/deploy date
> sort in the "Sort by" select at the top-right of a desk page. "Cover
> Date" is now two options: "Cover Date (newest first)" and "Cover
> Date (oldest first)".
>
> The descending sort could be applied to the other fields by adding
> the option to desk_top.html. Probably cover_date is the most useful
> one (having newer items appear first) but it's easy enough to add if
> the need strikes.
>
> -Greg
>
>
> Index: comp/widgets/desk/desk.mc
> ===================================================================
> --- comp/widgets/desk/desk.mc (revision 8010)
> +++ comp/widgets/desk/desk.mc (working copy)
> @@ -66,6 +66,8 @@
>
> if (my $curr_objs = $objs->{$ckey}) {
> if ($sort_by) {
> + # check for sort order
> + my $sort_descending = $sort_by =~ s/__desc$//gi;
> # Check for READ permission and sort them.
> my ($sort_get, $sort_arg) =
> @{$meths->{$sort_by}}{'get_meth', 'get_args'};
> @@ -88,6 +90,7 @@
> lc $sort_get->($b, @$sort_arg)
> } grep { chk_authz($_, READ, 1) } @$curr_objs;
> }
> + @$curr_objs = reverse @$curr_objs if $sort_descending;
>
> } else {
> # Just check for READ permission.
> Index: comp/widgets/desk/desk_top.html
> ===================================================================
> --- comp/widgets/desk/desk_top.html (revision 8010)
> +++ comp/widgets/desk/desk_top.html (working copy)
> @@ -46,6 +46,10 @@
> } else {
> ($link1, $lab1, $img1) = ('story', $pl_names->{story},
> 'stories') if $others->{story};
> ($link2, $lab2, $img2) = ('media', $pl_names->{media}, 'media')
> if $others->{media};
> + $sort_by_val = $sort_by_val eq 'cover_date' ? 'deploy_date'
> + : $sort_by_val eq 'cover_date__desc' ?
> 'deploy_date__desc'
> + : $sort_by_val eq 'element_type' ? 'output_channel'
> + : $sort_by_val;
> }
>
> my $sites = $c->get('__SITES__');
> @@ -66,20 +70,23 @@
> story => [
> [ name => 'Title' ],
> [ uri => 'Primary URI' ],
> - [ cover_date => 'Cover Date' ],
> + [ cover_date => 'Cover Date (oldest first)' ],
> + [ cover_date__desc => 'Cover Date (newest first)' ],
> [ element_type => 'Story Type' ],
> [ priority => 'Priority' ],
> ],
> media => [
> [ name => 'Title' ],
> [ uri => 'Primary URI' ],
> - [ cover_date => 'Cover Date' ],
> + [ cover_date => 'Cover Date (oldest first)' ],
> + [ cover_date__desc => 'Cover Date (newest first)' ],
> [ element_type => 'Media Type' ],
> [ priority => 'Priority' ],
> ],
> template => [
> [ name => 'File Name' ],
> - [ deploy_date => 'Deployed Date' ],
> + [ deploy_date => 'Deployed Date (oldest first)' ],
> + [ deploy_date__desc => 'Deployed Date (newest first)' ],
> [ output_channel => 'Output Channel' ],
> [ priority => 'Priority' ],
> ]
>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic