[dw-free] /icons: persistent ?view=all and uploaded/keyword sort choices; add all link to top of pag
[commit: http://hg.dwscoalition.org/dw-free/rev/56c1742f02b6]
http://bugs.dwscoalition.org/show_bug.cgi?id=4347
* Persist arguments across all the links by building the relevant links in
the backend where we have access to args, and then giving the URL in the
ItemRange object, rather than guessing at what the link should look like
purely in S2. Also make sortorder links "know" the current page args.
* Finally, check how many items are on the page, not how many items *total*
when deciding whether to show the second set of pagination links.
Patch by
fu.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=4347
* Persist arguments across all the links by building the relevant links in
the backend where we have access to args, and then giving the URL in the
ItemRange object, rather than guessing at what the link should look like
purely in S2. Also make sortorder links "know" the current page args.
* Finally, check how many items are on the page, not how many items *total*
when deciding whether to show the second set of pagination links.
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- bin/upgrading/s2layers/core2.s2
- bin/upgrading/s2layers/siteviews/layout.s2
- bin/upgrading/s2layers/skittlishdreams/layout.s2
- cgi-bin/LJ/S2.pm
- cgi-bin/LJ/S2/IconsPage.pm
-------------------------------------------------------------------------------- diff -r cce33e5e5971 -r 56c1742f02b6 bin/upgrading/s2layers/core2.s2 --- a/bin/upgrading/s2layers/core2.s2 Wed Mar 21 14:21:52 2012 +0800 +++ b/bin/upgrading/s2layers/core2.s2 Wed Mar 21 14:28:33 2012 +0800 @@ -226,6 +226,7 @@ var int from_subitem "The index of the first subitem in this range."; var int to_subitem "The index of the last subitem in this range."; var int total_subitems "The number of subitems."; + var readonly string url_all "URL to view all items. Blank if we don't support viewing all items for this."; var readonly string url_next "URL for the 'next' link. Blank if there isn't a next URL."; var readonly string url_prev "URL for the 'previous' link. Blank if there isn't a previous URL."; var readonly string url_first "URL for the 'first' link. Blank if already on the first page."; @@ -5959,7 +5960,6 @@ var string anchor = $opts{"anchor"} ? "#$opts{"anchor"}" : ""; var string class = $opts{"class"} ? $opts{"class"} : "pages"; - var string all_url = $opts{"all_url"} ? $opts{"all_url"} : ""; """<div class="$class">"""; print "<b>" + lang_page_of_pages($.current, $.total) + "</b>"; @@ -5983,8 +5983,8 @@ print " $*comment_page_next "; } - if ( $all_url != "" ) { - """<p><a href="$all_url">View All</a></p>"""; + if ( $.url_all != "" ) { + """<p><a href="$.url_all">View All</a></p>"""; } "</div>"; @@ -6069,11 +6069,11 @@ "</li>\n"; } "</ul>\n</div>\n"; - $.pages->print({ "class" => "icon-pages toppages", "all_url" => "$.journal.userpic_listing_url?view=all" }); + $.pages->print({ "class" => "icon-pages toppages" }); foreach var Icon i ($.icons) { $i->print(); } - $.pages->print({ "class" => "icon-pages bottompages", "all_url" => "$.journal.userpic_listing_url?view=all" }); + $.pages->print({ "class" => "icon-pages bottompages" }); "</div>\n</div>\n"; """<div class="footer">\n<div class="inner">\n"""; $this->print_icon_manage_link(); diff -r cce33e5e5971 -r 56c1742f02b6 bin/upgrading/s2layers/siteviews/layout.s2 --- a/bin/upgrading/s2layers/siteviews/layout.s2 Wed Mar 21 14:21:52 2012 +0800 +++ b/bin/upgrading/s2layers/siteviews/layout.s2 Wed Mar 21 14:28:33 2012 +0800 @@ -50,7 +50,6 @@ var string anchor = $opts{"anchor"} ? "#$opts{"anchor"}" : ""; var string class = $opts{"class"} ? $opts{"class"} : "action-box"; - var string all_url = $opts{"all_url"} ? $opts{"all_url"} : ""; """<div class="$class">"""; print """<p style="font-weight: bolder; margin: 0 0 .5em 0;">""" + lang_page_of_pages($.current, $.total) + "</p>"; @@ -76,8 +75,8 @@ print " <b>$*comment_page_next</b> "; } - if ( $all_url != "" ) { - """<p><a href="$all_url">View All</a></p>"""; + if ( $.url_all != "" ) { + """<p><a href="$.url_all">View All</a></p>"""; } "</div>"; @@ -119,8 +118,8 @@ } """</p>"""; - if ( $.pages.total > 6 ) { - $.pages->print({ "anchor" => "", "all_url" => "$.journal.userpic_listing_url?view=all" }); + if ( $.pages.num_subitems_displayed > 6 ) { + $.pages->print({ "anchor" => "" }); } """<p>"""; @@ -160,7 +159,7 @@ } """</div>"""; - $.pages->print({ "anchor" => "", "all_url" => "$.journal.userpic_listing_url?view=all" }); + $.pages->print({ "anchor" => "" }); """<div class="clear-floats"></div>"""; } } diff -r cce33e5e5971 -r 56c1742f02b6 bin/upgrading/s2layers/skittlishdreams/layout.s2 --- a/bin/upgrading/s2layers/skittlishdreams/layout.s2 Wed Mar 21 14:21:52 2012 +0800 +++ b/bin/upgrading/s2layers/skittlishdreams/layout.s2 Wed Mar 21 14:28:33 2012 +0800 @@ -434,11 +434,11 @@ "</li>\n"; } "</ul>\n</div>\n"; - $.pages->print({ "class" => "icon-pages toppages", "all_url" => "$.journal.userpic_listing_url?view=all" }); + $.pages->print({ "class" => "icon-pages toppages" }); foreach var Icon i ($.icons) { $i->print(); } - $.pages->print({ "class" => "icon-pages bottompages", "all_url" => "$.journal.userpic_listing_url?view=all" }); + $.pages->print({ "class" => "icon-pages bottompages" }); "</div>\n</div>\n"; """<div class="footer">\n<div class="inner">\n"""; $this->print_icon_manage_link(); diff -r cce33e5e5971 -r 56c1742f02b6 cgi-bin/LJ/S2.pm --- a/cgi-bin/LJ/S2.pm Wed Mar 21 14:21:52 2012 +0800 +++ b/cgi-bin/LJ/S2.pm Wed Mar 21 14:28:33 2012 +0800 @@ -2423,6 +2423,7 @@ $ir->{'num_subitems_displayed'} = @$items; $ir->{'to_subitem'} = $ir->{'from_subitem'} + $ir->{'num_subitems_displayed'} - 1; $ir->{'all_subitems_displayed'} = ($pages == 1); + $ir->{'url_all'} = $opts->{'url_all'} unless $ir->{'all_subitems_displayed'}; $ir->{'_url_of'} = $opts->{'url_of'}; return ItemRange($ir); } diff -r cce33e5e5971 -r 56c1742f02b6 cgi-bin/LJ/S2/IconsPage.pm --- a/cgi-bin/LJ/S2/IconsPage.pm Wed Mar 21 14:21:52 2012 +0800 +++ b/cgi-bin/LJ/S2/IconsPage.pm Wed Mar 21 14:28:33 2012 +0800 @@ -57,6 +57,7 @@ }, viewing_style => 1, cur_args => $get, + keep_args => [ 'sortorder', 'view', 'inactive' ], ) } @sort_methods }; @@ -80,7 +81,13 @@ viewing_style => 1, cur_args => $get, ); - } + }, + url_all => LJ::create_url( undef, + args => { view => "all" }, + keep_args => [ "sortorder", "inactive" ], + viewing_style => 1, + cur_args => $get, + ), }); my @pics_out; --------------------------------------------------------------------------------