Skip to content

Commit

Permalink
Merge pull request #329 from momijizukamori/Bug4764/S2Pagination
Browse files Browse the repository at this point in the history
Bug4764/s2 pagination
  • Loading branch information
afuna committed Mar 22, 2013
2 parents 7729e05 + e39fc95 commit 552ba77
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
21 changes: 14 additions & 7 deletions bin/upgrading/s2layers/siteviews/layout.s2
Expand Up @@ -56,27 +56,31 @@ function ItemRange::print(string{} opts) {
"""<div class="$class">""";
print """<p style="font-weight: bolder; margin: 0 0 .5em 0;">""" + lang_page_of_pages($.current, $.total) + "</p>";
var string url_prev = $this->url_of($.current - 1);
"""<span class="page-prev">""";
if ($.current != 1) {
print " <b><a href='$url_prev$anchor'>$*comment_page_prev</a></b> ";
} else {
print " <b>$*comment_page_prev</b> ";
}
"""<span style="text-align: center">""";
"""</span>
<span style="text-align: center" class="page-links">""";
foreach var int i (1..$.total) {
if ($i == $.current) { "<b>[$i]</b> "; }
else {
var string url_of = $this->url_of($i);
"<a href='$url_of$anchor'><b>[$i]</b></a> ";
}
}
if ($i % 10 == 0){ """<br />"""; }
}
"""</span>""";
var string url_next = $this->url_of($.current + 1);
"""<span class="page-next">""";
if ($.current != $.total) {
print " <b><a href='$url_next$anchor'>$*comment_page_next</a></b> ";
} else {
print " <b>$*comment_page_next</b> ";
}

"""</span>""";
if ( $.url_all != "" ) {
"""<p><a href="$.url_all">View All</a></p>""";
}
Expand Down Expand Up @@ -275,9 +279,11 @@ if ($p isa ReplyPage) {

}
function EntryPage::print_entry_footer(Entry e) {
"""<hr class="above-entry-interaction-links" />""";
"""<hr class="above-entry-interaction-links" />
<div class="comment-pages-wrapper">""";
$.comment_pages->print({ "anchor" => "comments", "class" => "comment-pages toppages comment-page-list" });
"""</div>""";
$e->print_interaction_links("topcomment");
$.comment_pages->print({ "anchor" => "comments", "class" => "comment-pages toppages comment-page-list" });
}

function EntryPage::print_comment_section(Entry e) {
Expand All @@ -296,14 +302,15 @@ function EntryPage::print_comment_section(Entry e) {
$e->print_interaction_links("bottomcomment");
"</div>";
}
$.comment_pages->print({ "anchor" => "comments", "class" => "comment-pages bottompages comment-page-list" });
if ($.comment_pages.total_subitems > 0) {
$.comment_nav->print({ "class" => "comment-pages bottompages" });
$this->print_reply_container({ "target" => "bottomcomment" });
$this->print_multiform_actionline();
$this->print_multiform_end();
}
"</div></div>";
"""<div class="commment-pages-wrapper">""";
$.comment_pages->print({ "anchor" => "comments", "class" => "comment-pages bottompages comment-page-list" });
"</div></div></div>";
}

function EntryPage::print_comments (Comment[] cs) {
Expand Down
6 changes: 4 additions & 2 deletions htdocs/stc/entrypage.css
Expand Up @@ -41,8 +41,10 @@ hr.above-entry-interaction-links, hr.below-entry-interaction-links {margin: 1em
.entry-interaction-links, .comment-pages {text-align: center; font-weight:bold; float:none;}
.entry-interaction-links li {display:inline;}
ul.entry-interaction-links {list-style: none outside none; display: inline; text-align: center; padding: 0.5em 0; margin:0;}
.comment-page-list {max-width: 28em; margin-left:auto; margin-right: auto;}

.comment-page-list { margin: 1em auto; padding: .5em;display:inline-block;}
.page-prev, .page-next, .page-links {display: table-cell;}
.page-prev, .page-next { vertical-align: middle; padding:0 .5em;}
.commment-pages-wrapper {text-align: center;}
/* give talkread styling to management links without S2 overrides*/
.entry-interaction-links li:before, .comment-interaction-links li:before, .view-flat:before, .view-threaded:before, .view-top-only:before, .expand_all:before {content:"(";}
.entry-interaction-links li:after, .comment-interaction-links li:after, .view-flat:after, .view-threaded:after, .view-top-only:after, .expand_all:after {content:")";}
Expand Down

0 comments on commit 552ba77

Please sign in to comment.