mirror of
https://github.com/wezm/wezm.net.git
synced 2024-11-10 01:42:32 +00:00
Fix pagination controls
This commit is contained in:
parent
2961b40251
commit
b310b66e2e
3 changed files with 7 additions and 7 deletions
|
@ -52,9 +52,9 @@
|
||||||
|
|
||||||
<div class="pagination">
|
<div class="pagination">
|
||||||
<% pagepath = @item.identifier; pagepath += 'page/' if pagepath !~ %r{/page/$} %>
|
<% pagepath = @item.identifier; pagepath += 'page/' if pagepath !~ %r{/page/$} %>
|
||||||
<a href="<%= pagepath %>#2" class="newer">« Newer</a>
|
<a href="<%= pagepath %>" class="newer">« Newer</a>
|
||||||
|
|
|
|
||||||
<a href="<%= pagepath %>" class="older">Older »</a>
|
<a href="<%= pagepath %>#2" class="older">Older »</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<%= render '_footer' %>
|
<%= render '_footer' %>
|
||||||
|
|
|
@ -145,7 +145,7 @@ body.articles #content {
|
||||||
display: none;
|
display: none;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
.pagination .older {
|
.pagination .newer {
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,12 +18,12 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
function update_pagination_controls(page) {
|
function update_pagination_controls(page) {
|
||||||
var newer = $('.pagination .newer').attr('href', '#' + (page + 1));
|
var older = $('.pagination .older').attr('href', '#' + (page + 1));
|
||||||
var older = $('.pagination .older').attr('href', '#' + (page - 1));
|
var newer = $('.pagination .newer').attr('href', '#' + (page - 1));
|
||||||
|
|
||||||
// Hide if out of range
|
// Hide if out of range
|
||||||
older.css('visibility', page <= 1 ? 'hidden' : 'visible');
|
older.css('visibility', page * per_page >= articles.length ? 'hidden' : 'visible');
|
||||||
newer.css('visibility', page * per_page >= articles.length ? 'hidden' : 'visible');
|
newer.css('visibility', page <= 1 ? 'hidden' : 'visible');
|
||||||
};
|
};
|
||||||
|
|
||||||
function articles_loaded(data) {
|
function articles_loaded(data) {
|
||||||
|
|
Loading…
Reference in a new issue