[dw-free] Overhaul S2
[commit: http://hg.dwscoalition.org/dw-free/rev/73e069b6c11a]
http://bugs.dwscoalition.org/show_bug.cgi?id=72
Allow limiting tags displayed, sorted by usage count.
Patch by
afuna.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=72
Allow limiting tags displayed, sorted by usage count.
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- cgi-bin/LJ/S2.pm
-------------------------------------------------------------------------------- diff -r 45f1ef43bb1c -r 73e069b6c11a cgi-bin/LJ/S2.pm --- a/cgi-bin/LJ/S2.pm Thu Mar 19 04:24:20 2009 +0000 +++ b/cgi-bin/LJ/S2.pm Thu Mar 19 04:26:19 2009 +0000 @@ -3910,7 +3910,7 @@ foreach my $class (qw(RecentPage Friends sub Page__visible_tag_list { - my ($ctx, $this) = @_; + my ($ctx, $this, $limit) = @_; return $this->{'_visible_tag_list'} if defined $this->{'_visible_tag_list'}; @@ -3928,6 +3928,11 @@ sub Page__visible_tag_list # create tag object push @taglist, LJ::S2::TagDetail($u, $kwid => $tags->{$kwid}); + } + + if ($limit) { + @taglist = sort { $b->{use_count} <=> $a->{use_count} } @taglist; + @taglist = splice @taglist, 0, $limit; } @taglist = sort { $a->{name} cmp $b->{name} } @taglist; --------------------------------------------------------------------------------