Первый фоллен на хелле (wildkin) wrote in changelog,
Первый фоллен на хелле
wildkin
changelog

[livejournal] r19166: LJSUP-8922: Show maximum 5 tags on page ...

Committer: dnikolaev
LJSUP-8922: Show maximum 5 tags on page '/friends/edit.bml', if more tags - show dots

U   trunk/htdocs/friends/edit.bml
Modified: trunk/htdocs/friends/edit.bml
===================================================================
--- trunk/htdocs/friends/edit.bml	2011-05-30 06:29:38 UTC (rev 19165)
+++ trunk/htdocs/friends/edit.bml	2011-05-30 06:50:17 UTC (rev 19166)
@@ -224,12 +224,18 @@
                 my ($friend_tags_mode, $friend_tags_list) = $friends_tags->get_tags($who_u->{userid});
                 if ($friends{$who} && $friends{$who}->{rel} ne 'FO' && !$who_u->is_identity()) {
                     if ($friend_tags_list && ref($friend_tags_list) eq 'ARRAY' && scalar(@$friend_tags_list) > 0) {
-                        my $friend_tags_str = LJ::FriendsTags->is_allow_mode($friend_tags_mode) ?
-                                                  LJ::ehtml(join(', ', @$friend_tags_list)) :
-                                                  join(', ', map { '<s>' . LJ::ehtml($_) . '</s>' } @$friend_tags_list );
-                        $ret .= "<a href='/friends/add.bml?user=$who_u->{user}'>" . 
-                                $friend_tags_str .
-                                "</a>";
+                        my $stringify = sub {
+                            return LJ::FriendsTags->is_allow_mode($friend_tags_mode) ?
+                                       join(', ', map { LJ::ehtml($_) } @_) :
+                                       join(', ', map { '<s>' . LJ::ehtml($_) . '</s>' } @_);
+                        };
+                        my $friend_tags_str;
+                        if (scalar(@$friend_tags_list) > 5) {
+                            $friend_tags_str = $stringify->(@$friend_tags_list[0..4]) . ',&nbsp;...';
+                        } else {
+                            $friend_tags_str = $stringify->(@$friend_tags_list);
+                        }
+                        $ret .= "<a href='/friends/add.bml?user=$who_u->{user}'>$friend_tags_str</a>";
                     } else {
                         $ret .= "(<a href='/friends/add.bml?user=$who_u->{user}'>" . BML::ml('.selecttags.text') . "</a>)";
                     }

Tags: bml, livejournal, wildkin
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments