kareila: (Default)
kareila ([personal profile] kareila) wrote in [site community profile] changelog2010-04-12 07:43 pm

[dw-free] add links to entry pages in the page summary module

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

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

Make comment text in S2 page summary module link to #comments.

Patch by [personal profile] yvi.

Files modified:
  • bin/upgrading/s2layers/core2.s2
--------------------------------------------------------------------------------
diff -r df5508d1443a -r ce8efa4618cb bin/upgrading/s2layers/core2.s2
--- a/bin/upgrading/s2layers/core2.s2	Sat Apr 10 21:58:29 2010 -0500
+++ b/bin/upgrading/s2layers/core2.s2	Mon Apr 12 14:43:34 2010 -0500
@@ -3603,7 +3603,7 @@ function print_module_pagesummary_commen
     return $count;
 }
 
-function print_module_pagesummary_comments(string esubject, int count, string prop) : string {
+function print_module_pagesummary_comments(string esubject, int count, string prop, string read_url) : string {
     var string subject = ($esubject != "" ? striphtml($esubject) : "<em>$*text_nosubject</em>");
     var string module_comment_text = get_plural_phrase($count, $prop);
 
@@ -3611,7 +3611,11 @@ function print_module_pagesummary_commen
         return "title='$module_comment_text'>$subject</a></span>";
     }
     elseif ($count != 0) {
-        return ">$subject</a></span> <span class='pagesummary-commentcount'>+$module_comment_text</span>";
+        if ($read_url == "") {
+            return ">$subject</a></span> <span class='pagesummary-commentcount'>+$module_comment_text</span>";
+        } else {
+            return ">$subject</a></span> <span class='pagesummary-commentcount'><a href='$read_url'>+$module_comment_text</a></span>";
+        }
     }
     else {
         return ">$subject</a></span>";
@@ -3627,7 +3631,7 @@ function print_module_pagesummary() {
         foreach var Comment c ( $cp.comments ) {
             var int count = print_module_pagesummary_comment_count($c);
             var string comment_display =
-                print_module_pagesummary_comments($c.subject, $count, "text_read_comments_threads");
+                print_module_pagesummary_comments($c.subject, $count, "text_read_comments_threads", "");
             var string poster = isnull $c.poster ? $*text_poster_anonymous : $c.poster->ljuser();
 
             $links[size $links] = """<span class="pagesummary-poster">$poster</span> - <span class="pagesummary-subject"><a href="#$c.anchor" $comment_display""";
@@ -3638,7 +3642,7 @@ function print_module_pagesummary() {
         var FriendsPage cp = $p as FriendsPage;
         foreach var Entry e ( $cp.entries ) {
             var string comment_display =
-                print_module_pagesummary_comments($e.subject, $e.comments.count, "text_read_comments_friends");
+                print_module_pagesummary_comments($e.subject, $e.comments.count, "text_read_comments_friends", $e.comments.read_url + "#comments");
             var string poster = "<span class='pagesummary-poster'>" + $e.poster->ljuser() + "</span>";
             
             if ( not $e.poster->equals($e.journal) ) {
@@ -3653,7 +3657,7 @@ function print_module_pagesummary() {
         var RecentPage cp = $p as RecentPage;
         foreach var Entry e ( $cp.entries ) {
             var string comment_display =
-                print_module_pagesummary_comments($e.subject, $e.comments.count, "text_read_comments");
+                print_module_pagesummary_comments($e.subject, $e.comments.count, "text_read_comments", $e.comments.read_url + "#comments");
             var string poster = "<span class='pagesummary-poster'>" + $e.poster->ljuser() + "</span>";
 
             if ( not $e.poster->equals($e.journal) ) {
@@ -3669,7 +3673,7 @@ function print_module_pagesummary() {
         var DayPage cp = $p as DayPage;
         foreach var Entry e ( $cp.entries ) {
             var string comment_display =
-                print_module_pagesummary_comments($e.subject, $e.comments.count, "text_read_comments");
+                print_module_pagesummary_comments($e.subject, $e.comments.count, "text_read_comments", $e.comments.read_url + "#comments");
             var string poster = "<span class='pagesummary-poster'>" + $e.poster->ljuser() + "</span>";
 
             if ( not $e.poster->equals($e.journal) ) {
--------------------------------------------------------------------------------

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