afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
afuna ([personal profile] afuna) wrote in [site community profile] changelog2009-06-30 01:55 pm

[dw-free] Manage circle sometimes displays table headers for empty table

[commit: http://hg.dwscoalition.org/dw-free/rev/c2a33a479a66]

http://bugs.dwscoalition.org/show_bug.cgi?id=747

Don't display patch headers for empty tables.

Patch by [personal profile] ysobel.

Files modified:
  • htdocs/manage/circle/edit.bml
--------------------------------------------------------------------------------
diff -r 674d26b9c7eb -r c2a33a479a66 htdocs/manage/circle/edit.bml
--- a/htdocs/manage/circle/edit.bml	Mon Jun 29 16:49:42 2009 +0000
+++ b/htdocs/manage/circle/edit.bml	Tue Jun 30 13:50:28 2009 +0000
@@ -51,11 +51,13 @@ body<=
 
         # people table
         if ( @trusted_userids || keys %$watch_list || @trusted_by_userids || @watched_by_userids || @member_of_userids ) {
-            $ret .= "<p>$ML{'.circle.intro.people'}</p>";
-            $ret .= "<div align='center'><table class='editfriends'>";
-            $ret .= "<tr class='header'><th>$ML{'.circle.username'}</th><th>$ML{'.circle.name'}</th><th>$ML{'.circle.trusted_by'}</th><th>$ML{'.circle.watched_by'}</th>";
-            $ret .= "<th>$ML{'.circle.trust'}</th>";
-            $ret .= "<th>$ML{'.circle.watch'}</th></tr>";
+            my $first = 1;
+            my $tableheader = "";
+            $tableheader .= "<p>$ML{'.circle.intro.people'}</p>";
+            $tableheader .= "<div align='center'><table class='editfriends'>";
+            $tableheader .= "<tr class='header'><th>$ML{'.circle.username'}</th><th>$ML{'.circle.name'}</th><th>$ML{'.circle.trusted_by'}</th><th>$ML{'.circle.watched_by'}</th>";
+            $tableheader .= "<th>$ML{'.circle.trust'}</th>";
+            $tableheader .= "<th>$ML{'.circle.watch'}</th></tr>";
             foreach my $uid ( sort { $us->{$a}->display_name cmp $us->{$b}->display_name } keys %$us ) {
                 my $other_u = $us->{$uid};
                 next unless $other_u;
@@ -63,6 +65,11 @@ body<=
                 if ( $other_u->is_community || $other_u->is_syndicated ) {
                     push @nonperson_userids, $uid;
                     next;
+                }
+
+                if ( $first ) {
+                    $ret .= $tableheader;
+                    $first = 0;
                 }
 
                 my ( $u_fg, $u_bg, $t_bg, $w_bg, $t_text, $w_text );
@@ -126,7 +133,7 @@ body<=
                 $ret .= "</tr>";
                 $ret .= LJ::html_hidden( "editfriend_edit_${uid}_user" => 1 );
             }
-            $ret .= "</table></div>";
+            $ret .= "</table></div>" unless $first;
         }
 
         # non-people table
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org