fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-09-23 07:48 am

[dw-free] Site-styled entry pages: turn subject into clean link

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

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

Add "no subject" so we have linkable text when there's no subject, and also
make sure that the nsfw/security icons are always on the same line as the
subject

Patch by [personal profile] fu.

Files modified:
  • cgi-bin/LJ/Entry.pm
  • htdocs/talkread.bml
--------------------------------------------------------------------------------
diff -r 514569a885c0 -r ef593378e31e cgi-bin/LJ/Entry.pm
--- a/cgi-bin/LJ/Entry.pm	Fri Sep 23 00:44:33 2011 -0500
+++ b/cgi-bin/LJ/Entry.pm	Fri Sep 23 15:46:42 2011 +0800
@@ -2305,7 +2305,7 @@
         $ret .= "<tr><td align='right'>$curname</td>";
         $ret .= "<td>$current{$_}</td></tr>\n";
     }
-    $ret .= "</table><p>\n";
+    $ret .= "</table>\n";
 
     return $ret;
 }
diff -r 514569a885c0 -r ef593378e31e htdocs/talkread.bml
--- a/htdocs/talkread.bml	Fri Sep 23 00:44:33 2011 -0500
+++ b/htdocs/talkread.bml	Fri Sep 23 15:46:42 2011 +0800
@@ -324,17 +324,18 @@
         $age_restriction = LJ::img( "adult-nsfw" );
     }
 
-    $ret .= $sec . $age_restriction;
-    $ret .= "<br />\n" unless ( $sec eq "" && $age_restriction eq "" ) or $item->{subject};
 
     ###
-    if ($item->{'subject'}) {
-        my $subject = LJ::CleanHTML::quote_html( $item->{subject}, $GET{nohtml} );
+    my $subject;
+    if ( $item->{subject} ) {
+        $subject = LJ::CleanHTML::quote_html( $item->{subject}, $GET{nohtml} );
         LJ::CleanHTML::clean_subject(\$subject);
         BML::ebml(\$subject);
-        $ret .= qq{<div id='entrysubj'><a href="$talkurl">$subject</a></div><br />\n};
+    } else {
+        $subject = $T{nosubject};
     }
-
+    my $flags = ( $sec or $age_restriction ) ? "$sec$age_restriction " : "";
+    $ret .= qq{<div id='entrysubj'>$flags<a href="$talkurl">$subject</a></div><br />\n};
 
     $event = LJ::CleanHTML::quote_html( $event, $GET{nohtml} );
     $ret .= $event;
--------------------------------------------------------------------------------

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