Максим Червонный (fiskus_boulder) wrote in changelog,
Максим Червонный
fiskus_boulder
changelog

[ljcom] r11046: LJSUP-9934: Refactoring of print_comment...

Committer: mchervonniy
LJSUP-9934: Refactoring of print_comment_partial() function in s2 styles
U   trunk/bin/upgrading/s2layers/3column/layout.s2
U   trunk/bin/upgrading/s2layers/anovelconundrum/layout.s2
U   trunk/bin/upgrading/s2layers/flexiblesquares/layout.s2
U   trunk/bin/upgrading/s2layers/gradient/layout.s2
U   trunk/bin/upgrading/s2layers/nebula/layout.s2
U   trunk/bin/upgrading/s2layers/opal/layout.s2
U   trunk/bin/upgrading/s2layers/smoothsailing/layout.s2
U   trunk/bin/upgrading/s2layers/sup/layout.s2
U   trunk/bin/upgrading/s2layers/tranquilityii/layout.s2
U   trunk/bin/upgrading/s2layers/unearthed/layout.s2
U   trunk/bin/upgrading/s2layers/voxhtml/layout.s2
Modified: trunk/bin/upgrading/s2layers/3column/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/3column/layout.s2	2011-09-28 06:49:37 UTC (rev 11045)
+++ trunk/bin/upgrading/s2layers/3column/layout.s2	2011-09-28 08:55:13 UTC (rev 11046)
@@ -161,8 +161,8 @@
     set t_view_userinfo = "userinfo";
     property string t_view_friends{ des = "Navigation Bar: Friends text"; }
     set t_view_friends= "friends";
-    property string t_nosubject{ des = "\"No Subject\" text"; }
-    set t_nosubject= "(no subject)";
+    property string text_nosubject{ des = "\"No Subject\" text"; }
+    set text_nosubject= "(no subject)";
     property string t_noentries_day{ des = "Text for a day without posts"; }
     set t_noentries_day= "I didn't post on this day. Sorry!";
     property string t_meta_music{ des = "Text for 'Current Music'"; }
@@ -678,19 +678,20 @@
     }
 }
 
-function EntryPage::print_comment_partial(Comment c) {
-    var string poster = defined $c.poster ? $c.poster->as_string() : "<i>$*text_poster_anonymous</i>";
-    var string subj = $c.subject != "" ? $c.subject : """<i class="nosubject">$*t_nosubject</i>""";
+function EntryPage::print_comment_partial (Comment c) {
+    var string poster = defined $c.poster ? $c.poster->as_string() : """<em class="noposter">$*text_poster_anonymous</em>""";
+    var string subj = $c.subject != "" ? $c.subject : """<em class="nosubject">$*text_nosubject</em>""";
+    var string sep = "-";
     var string indent = ($c.depth - 1) * 25 + "px";
-    print safe """
-    <a name='$c.anchor'></a><div style="margin-left: $indent;" id="$c.dom_id"><div><div class="entry">
-        <div class="minicomment">$poster - <a href="$c.permalink_url">$subj</a>""";
-
-    if ($c.thread_url != "") {
-        $c->print_expand_collapse_links({ "expand"=>" - %_", "collapse"=>" - %_"});
-    }
+    print safe """<a name="$c.anchor"></a>
+    <div style="margin-left: $indent;" id="$c.dom_id">
+        <div>
+            <div class="entry">
+                <div class="minicomment">
+                    <a href="$c.permalink_url">$subj</a>
+                    $sep $poster""";
+    $c->print_expand_collapse_links({ "expand"=>" $sep %_", "collapse"=>" $sep %_"});
     print """</div></div></div></div>""";
-    ### $this->print_comments($c.replies);
 }
 
 function ItemRange::print() {
@@ -1119,7 +1120,7 @@
         if ($e.subject != "") {
             " <a href=\"$e.permalink_url\">$e.subject</a>";
         } else {
-            print safe """ <a href="$e.permalink_url"><i class="nosubject">$*t_nosubject</i></a>""";
+            print safe """ <a href="$e.permalink_url"><i class="nosubject">$*text_nosubject</i></a>""";
         }
         if ($e.comments.count > 0) {
             print safe " - " + get_plural_phrase($e.comments.count, "t_read_comments");

Modified: trunk/bin/upgrading/s2layers/anovelconundrum/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/anovelconundrum/layout.s2	2011-09-28 06:49:37 UTC (rev 11045)
+++ trunk/bin/upgrading/s2layers/anovelconundrum/layout.s2	2011-09-28 08:55:13 UTC (rev 11046)
@@ -1200,18 +1200,16 @@
 }
 
 
-function EntryPage::print_comment_partial(Comment c) {
-    var string poster = defined $c.poster ? $c.poster->as_string() : $*text_poster_anonymous;
+function EntryPage::print_comment_partial (Comment c) {
+    var string poster = defined $c.poster ? $c.poster->as_string() : """<em class="noposter">$*text_poster_anonymous</em>""";
+    var string sep = "&middot;";
     var bool subj = $c.subject != "";
     print safe "<div class='ult' style='width:$*body_width; margin-top:${*font_leading}pt;'>";
     "&mdash;&thinsp;On " + $c->time_display("long", "") + ", $poster ";
     if ($c.metadata{"poster_ip"}) { "(" + $c.metadata{"poster_ip"} + ") "; }
     if($subj) { """replied, <a href="$c.permalink_url">&ldquo;$c.subject&rdquo;</a>"""; }
     else { """posted <a href="$c.permalink_url">a reply</a>"""; }
-    var Link expand_link = $c->get_link("expand_comments");
-    if ($c.thread_url != "") {
-        $c->print_expand_collapse_links({ "expand"=>" &middot; %_", "collapse"=>" &middot; %_"});
-    }
+    $c->print_expand_collapse_links({ "expand"=>" $sep %_", "collapse"=>" $sep %_"});
     "</div>";
 }
 

Modified: trunk/bin/upgrading/s2layers/flexiblesquares/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/flexiblesquares/layout.s2	2011-09-28 06:49:37 UTC (rev 11045)
+++ trunk/bin/upgrading/s2layers/flexiblesquares/layout.s2	2011-09-28 08:55:13 UTC (rev 11046)
@@ -2388,13 +2388,12 @@
     "</div></div>\n";
 }
 
-function EntryPage::print_comment_partial( Comment c )
-{
-    var string subject = $c.subject ? $c.subject : $*text_nosubject;
+function EntryPage::print_comment_partial (Comment c) {
+    var string poster = defined $c.poster ? $c.poster->as_string() : """<em class="noposter">$*text_poster_anonymous</em>""";
+    var string subj = $c.subject != "" ? $c.subject : """<em class="nosubject">$*text_nosubject</em>""";
+    var string sep = "-";
     var string date = $c->time_display("long", "");
-    var string poster = isnull $c.poster ? $*text_poster_anonymous : $c.poster->as_string();
-
-    print safe """<a href="$c.permalink_url">$subject</a> - $poster on $date""";
+    print safe """<a href="$c.permalink_url">$subj</a> $sep $poster on $date""";
     $c->print_expand_collapse_links({ "expand"=>" (%_) ", "collapse"=>" (%_) "});
 }
 

Modified: trunk/bin/upgrading/s2layers/gradient/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/gradient/layout.s2	2011-09-28 06:49:37 UTC (rev 11045)
+++ trunk/bin/upgrading/s2layers/gradient/layout.s2	2011-09-28 08:55:13 UTC (rev 11046)
@@ -1698,38 +1698,29 @@
 }
 
 function EntryPage::print_comment_partial (Comment c) {
-   if($c.depth == 1) {
-      var Comment[] replies;
-      $replies = $c.replies;
-      var int count = 0;
-      foreach var Comment reply ($replies) {
-         $count ++;
-      }
-   }
-   var string indent = ($c.depth - 1) * 15 + "px";
-   """<div class="comment" id="$c.dom_id" style="margin-left: $indent;">""";
-   if($c.screened) {
-      """Screened Comment""";
-   }
-   elseif ($c.deleted) {
-      """Deleted Comment""";
-   }
-   else {
-      var string subject = $c.subject != "" ? $c.subject : $*text_nosubject;
-      print safe """<a href="$c.permalink_url">$subject</a> by """;
-      if (defined $c.poster) {
-         "<a href=\"" + $c.poster->base_url() + "\">$c.poster.username</a>";
-      }
-      else {
-         print safe """$*text_poster_anonymous""";
-      }
-   }
-    var Link expand_link = $c->get_link("expand_comments");
-    if ($c.thread_url != "" and defined $expand_link) {
-        " " + $c->expand_link();
+    if($c.depth == 1) {
+        var Comment[] replies;
+        $replies = $c.replies;
+        var int count = 0;
+        foreach var Comment reply ($replies) {
+            $count ++;
+        }
     }
-   """</div>""";
-   $this->print_comments($c.replies);
+    var string indent = ($c.depth - 1) * 15 + "px";
+    """<div class="comment" id="$c.dom_id" style="margin-left: $indent;">""";
+    if($c.screened) {
+        """Screened Comment""";
+    } elseif ($c.deleted) {
+        """Deleted Comment""";
+    } else {
+        var string poster = defined $c.poster ? "<a href=\"" + $c.poster->base_url() + "\">$c.poster.username</a>" : """<em class="noposter">$*text_poster_anonymous</em>""";
+        var string subj = $c.subject != "" ? $c.subject : """<em class="nosubject">$*text_nosubject</em>""";
+        var string sep = "by";
+        print safe """<a href="$c.permalink_url">$subj</a> $sep $poster """;
+        $c->print_expand_collapse_links({ "expand"=>" $sep %_", "collapse"=>" $sep %_"});
+    }
+    """</div>""";
+    $this->print_comments($c.replies);
 }
 
 function EntryPage::print_comments (Comment[] cs) {

Modified: trunk/bin/upgrading/s2layers/nebula/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/nebula/layout.s2	2011-09-28 06:49:37 UTC (rev 11045)
+++ trunk/bin/upgrading/s2layers/nebula/layout.s2	2011-09-28 08:55:13 UTC (rev 11046)
@@ -1732,18 +1732,13 @@
 }
 
 function EntryPage::print_comment_partial (Comment c) {
-    var string poster = defined $c.poster ? $c.poster->as_string() : "<i>$*text_poster_anonymous</i>";
-    var string subj = $c.subject != "" ? $c.subject : $*text_nosubject;
-    print safe "<a href='$c.permalink_url'>$subj</a> - $poster";
-    var Link expand_link = $c->get_link("expand_comments");
-    # if ($c.thread_url != "" and defined $expand_link) {
-    if ($c.thread_url != "") {
-        # " "; $c->print_expand_link();
-        $c->print_expand_collapse_links({ "expand"=>" (%_) ", "collapse"=>" (%_) "});
-    }
+    var string poster = defined $c.poster ? $c.poster->as_string() : """<em class="noposter">$*text_poster_anonymous</em>""";
+    var string subj = $c.subject != "" ? $c.subject : """<em class="nosubject">$*text_nosubject</em>""";
+    var string sep = "-";
+    print safe """<a href="$c.permalink_url">$subj</a> $sep $poster""";
+    $c->print_expand_collapse_links({ "expand"=>" (%_) ", "collapse"=>" (%_) "});
 }
 
-
 ## --  p r i n t   r e p l y   p a g e  -- ####################################
 
 function ReplyPage::print_body ()

Modified: trunk/bin/upgrading/s2layers/opal/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/opal/layout.s2	2011-09-28 06:49:37 UTC (rev 11045)
+++ trunk/bin/upgrading/s2layers/opal/layout.s2	2011-09-28 08:55:13 UTC (rev 11046)
@@ -1309,18 +1309,20 @@
 
 }
 
-function EntryPage::print_comment_partial(Comment c) {
-    var string poster = defined $c.poster ? $c.poster->as_string() : "<i>(Anonymous)</i>";
-    var string subj = $c.subject != "" ? $c.subject : """<i class="nosubject">$*text_nosubject</i>""";
+function EntryPage::print_comment_partial (Comment c) {
+    var string poster = defined $c.poster ? $c.poster->as_string() : """<em class="noposter">$*text_poster_anonymous</em>""";
+    var string subj = $c.subject != "" ? $c.subject : """<em class="nosubject">$*text_nosubject</em>""";
+    var string sep = "-";
     var string indent = ($c.depth - 1) * 25 + "px";
     print safe """
-            <div id="$c.dom_id" class="entry" style="margin-left: $indent;"><div class="minicommentholder"><div class="minicomment">$poster - <a href="$c.permalink_url">$subj</a>
+    <div id="$c.dom_id" class="entry" style="margin-left: $indent;">
+        <div class="minicommentholder">
+            <div class="minicomment">
+                <a href="$c.permalink_url">$subj</a>
+                $sep $poster
     """;
-    var Link expand_link = $c->get_link("expand_comments");
-    if ($c.thread_url != "" and defined $expand_link) {
-        " " + $c->expand_link();
-    }
-    print """</div></div></div>""";
+    $c->print_expand_collapse_links({ "expand"=>" $sep %_", "collapse"=>" $sep %_"});
+    """</div></div></div>""";
     $this->print_comments($c.replies);
 }
 

Modified: trunk/bin/upgrading/s2layers/smoothsailing/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/smoothsailing/layout.s2	2011-09-28 06:49:37 UTC (rev 11045)
+++ trunk/bin/upgrading/s2layers/smoothsailing/layout.s2	2011-09-28 08:55:13 UTC (rev 11046)
@@ -1903,13 +1903,15 @@
     """;
 }
 
-function EntryPage::print_comment_partial(Comment comment) {
-    var Page p = get_page();
-    """<a name="$comment.anchor"></a>
-    <div class="commentHolder"><div class="commentText">""";
-    print "<a href=\"$comment.permalink_url\">"+($comment.subject==""?"<i>(no subject)</i>":"$comment.subject")+"</a> - ";
-    print (defined $comment.poster?"<span class=\"ljuser\" style=\"white-space:nowrap;\">$comment.poster</span>":"<i>Anonymous</i>");
-    $comment->print_expand_collapse_links({ "expand"=>" - %_", "collapse"=>" - %_"});
+function EntryPage::print_comment_partial (Comment c) {
+    var string poster = defined $c.poster ? """<span class="ljuser" style="white-space:nowrap;">$c.poster</span>""" : """<em class="noposter">$*text_poster_anonymous</em>""";
+    var string subj = $c.subject != "" ? $c.subject : """<em class="nosubject">$*text_nosubject</em>""";
+    var string sep = "-";
+    """<a name="$c.anchor"></a>
+    <div class="commentHolder">
+        <div class="commentText">""";
+    print safe """<a href="$c.permalink_url">$subj</a> $sep $poster""";
+    $c->print_expand_collapse_links({ "expand"=>" $sep %_", "collapse"=>" $sep %_"});
     """</div></div>""";
 }
 

Modified: trunk/bin/upgrading/s2layers/sup/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/sup/layout.s2	2011-09-28 06:49:37 UTC (rev 11045)
+++ trunk/bin/upgrading/s2layers/sup/layout.s2	2011-09-28 08:55:13 UTC (rev 11046)
@@ -1564,13 +1564,9 @@
 }
 
 function EntryPage::print_comment_partial (Comment c) {
-    var string poster = defined $c.poster ? _user_print($c.poster, "simple") : "<em>$*text_poster_anonymous</em>";
-    var string subj = $c.subject != "" ? $c.subject : $*text_nosubject;
-    if ($subj == "...") {
-        $subj = "…";
-    }
-    print safe """<a href="$c.permalink_url">$subj</a> <span class="emdash">—</span> $poster""";
-    if ($c.thread_url != "") {
-        $c->print_expand_collapse_links({ "expand"=>"<span class='emdash'>—</span> %_", "collapse"=>"<span class='emdash'>—</span> %_"});
-    }
+    var string poster = defined $c.poster ? _user_print($c.poster, "simple") : """<em class="noposter">$*text_poster_anonymous</em>""";
+    var string subj = $c.subject != "" ? $c.subject : """<em class="nosubject">$*text_nosubject</em>""";
+    var string sep = """<span class="emdash">—</span>""";
+    print safe """<a href="$c.permalink_url">$subj</a> $sep $poster""";
+    $c->print_expand_collapse_links({ "expand"=>" $sep %_", "collapse"=>" $sep %_"});
 }

Modified: trunk/bin/upgrading/s2layers/tranquilityii/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/tranquilityii/layout.s2	2011-09-28 06:49:37 UTC (rev 11045)
+++ trunk/bin/upgrading/s2layers/tranquilityii/layout.s2	2011-09-28 08:55:13 UTC (rev 11046)
@@ -1333,13 +1333,11 @@
 }
 
 function EntryPage::print_comment_partial (Comment c) {
-    var string poster = defined $c.poster ? $c.poster->as_string() : "<i>$*text_poster_anonymous</i>";
-    var string subj = $c.subject != "" ? $c.subject : $*text_nosubject;
-    print safe "<a href='$c.permalink_url'>$subj</a> - $poster";
-    var Link expand_link = $c->get_link("expand_comments");
-    if ($c.thread_url != "") {
-        $c->print_expand_collapse_links({ "expand"=>" - %_", "collapse"=>" - %_"});
-    }
+    var string poster = defined $c.poster ? $c.poster->as_string() : "<em>" + $*text_poster_anonymous + "</em>";
+    var string subj = $c.subject != "" ? $c.subject : """<em class="nosubject">$*text_nosubject</em>""";
+    var string sep = "-";
+    print safe """<a href="$c.permalink_url">$subj</a> $sep $poster""";
+    $c->print_expand_collapse_links({ "expand"=>" $sep %_", "collapse"=>" $sep %_"});
 }
 
 # -------------------------------

Modified: trunk/bin/upgrading/s2layers/unearthed/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/unearthed/layout.s2	2011-09-28 06:49:37 UTC (rev 11045)
+++ trunk/bin/upgrading/s2layers/unearthed/layout.s2	2011-09-28 08:55:13 UTC (rev 11046)
@@ -1402,12 +1402,11 @@
 }
 
 function EntryPage::print_comment_partial (Comment c) {
-    var string poster = defined $c.poster ? $c.poster->as_string() : "<i>$*text_poster_anonymous</i>";
-    var string subj = $c.subject != "" ? $c.subject : $*text_nosubject;
-    print safe "<a href='$c.permalink_url'>$subj</a> - $poster";
-    if ($c.thread_url != "") {
-        $c->print_expand_collapse_links({ "expand"=>" - %_", "collapse"=>" - %_"});
-    }
+    var string poster = defined $c.poster ? $c.poster->as_string() : """<em class="noposter">$*text_poster_anonymous</em>""";
+    var string subj = $c.subject != "" ? $c.subject : """<em class="nosubject">$*text_nosubject</em>""";
+    var string sep = "-";
+    print safe """<a href="$c.permalink_url">$subj</a> $sep $poster""";
+    $c->print_expand_collapse_links({ "expand"=>" $sep %_", "collapse"=>" $sep %_"});
 }
 
 function EntryPage::print_comment_full(Comment c)

Modified: trunk/bin/upgrading/s2layers/voxhtml/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/voxhtml/layout.s2	2011-09-28 06:49:37 UTC (rev 11045)
+++ trunk/bin/upgrading/s2layers/voxhtml/layout.s2	2011-09-28 08:55:13 UTC (rev 11046)
@@ -2373,49 +2373,34 @@
     $c->print_reply_container();
 }
 
-function EntryPage::print_comment_partial (Comment e) {
+function EntryPage::print_comment_partial (Comment c) {
     var Page p = get_page();
-    var string barc = "comment-" + ($e.depth % 2 ? "odd" : "even");
-    var string indent = ($e.depth - 1) * 25 + "px";
-    var string id     = $e.dom_id ? " id=\"$e.dom_id\"" : "";
+    var string barc = "comment-" + ($c.depth % 2 ? "odd" : "even");
+    var string indent = ($c.depth - 1) * 25 + "px";
+    var string id     = $c.dom_id ? " id=\"$c.dom_id\"" : "";
 
-     """
-     <a name='$e.anchor'></a>
-     <div $id style="margin-left: $indent">
-       <div class="collapsed-comment comment-inner">
-         <div class="comment-meta">""";
+    """
+    <a name="$c.anchor"></a>
+    <div $id style="margin-left: $indent">
+        <div class="collapsed-comment comment-inner">
+            <div class="comment-meta">""";
  
-     var string subject = $e.subject != "" ? $e.subject : """<i class="nosubject">$*text_nosubject</i>""";
+     var string subj = $c.subject != "" ? $c.subject : """<em class="nosubject">$*text_nosubject</em>""";
+     var string sep = """<span class="separator">-</span>""";
      
-     if ($e.spam and not $p.showspam) {
-         print safe """<strong>$*text_spam_comment</strong> <span class="separator">-</span> """;
+     if ($c.spam and not $p.showspam) {
+         """<strong>$*text_spam_comment</strong> $sep """;
      } else {
-          print safe """<a href="$e.permalink_url" class="collapsed-comment-link">$subject</a> <span class="separator">-</span> """;
+          print safe """<a href="$c.permalink_url" class="collapsed-comment-link">$subj</a> $sep """;
      }
  
-     var string poster = (defined $e.poster ? ""+$e.poster : """<i class="noposter">$*text_poster_anonymous</i>""");
-     print safe """$poster <span class="separator">-</span> """;
-     print lang_posted_by_date_and_time($e, false, true, true);
- 
-     #var Link expand_link = $e->get_link("expand_comments");
-     #if ($e.thread_url != "" and defined $expand_link) {
-     #      " " + $e->expand_link({ "class" => "collapsed-comment-link" });
-     #}
-        $e->print_expand_collapse_links({ "expand"=>" - %_", "collapse"=>" - %_"});
- 
-     """
-         </div>
-       </div>
-     </div>\n""";
- 
-     #if (size($e.replies) > 0) {
-     #    foreach var Comment c ($e.replies) {
-     #        $this->print_comment($c);
-     #    }
-     #}
+     var string poster = (defined $c.poster ? ""+$c.poster : """<i class="noposter">$*text_poster_anonymous</i>""");
+     print safe """$poster $sep """;
+     print lang_posted_by_date_and_time($c, false, true, true);
+     $c->print_expand_collapse_links({ "expand"=>" $sep %_", "collapse"=>" $sep %_"});
+     """</div></div></div>""";
 }
 
-
 function EntryPage::print_comment_full(Comment e) {
     var Page p = get_page();
     var string barc = "comment-" + ($e.depth % 2 ? "odd" : "even");

Tags: fiskus_boulder, ljcom, s2
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