From: "Alex Legler" <a3li@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/ag-web:master commit in: views/
Date: Sun, 22 Feb 2015 00:00:08 +0000 (UTC) [thread overview]
Message-ID: <1424563199.416dec280acb094e40338fe6198b682e71659ba8.a3li@gentoo> (raw)
commit: 416dec280acb094e40338fe6198b682e71659ba8
Author: Alex Legler <alex <AT> a3li <DOT> li>
AuthorDate: Sat Feb 21 23:59:59 2015 +0000
Commit: Alex Legler <a3li <AT> gentoo <DOT> org>
CommitDate: Sat Feb 21 23:59:59 2015 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=416dec28
Limit pages shown in pagination
---
| 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--git a/views/pagination.erb b/views/pagination.erb
index 7d7be9c..9b85ec9 100644
--- a/views/pagination.erb
+++ b/views/pagination.erb
@@ -12,9 +12,15 @@
</a>
<% end %>
</li>
- <% (1..max_pages).each do |page| %>
+ <% min = [1, current_page - 5].max ; max = [max_pages, current_page + 5].min %>
+ <% if min > 10 %>
+ <li><a href="1">1</a></li>
+ <% end %>
+ <% (min..max).each do |page| %>
<li <% if page == current_page %><%= 'class="active"' %><% end %>><a href="<%= page %>"><%= page %></a></li>
<% end %>
+ <% if (max_pages - max) > 10 %>
+ <li><a href="<%= max_pages %>"><%= max_pages %></a></li>
<% if current_page == max_pages %>
<li class="disabled">
<a href="#" aria-label="Next">
next reply other threads:[~2015-02-22 0:00 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-22 0:00 Alex Legler [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-02-26 13:12 [gentoo-commits] proj/ag-web:master commit in: views/ Alex Legler
2015-02-25 21:44 Alex Legler
2015-02-25 21:44 Alex Legler
2015-02-25 10:47 Alex Legler
2015-02-23 23:55 Alex Legler
2015-02-22 11:05 Alex Legler
2015-02-22 11:02 Alex Legler
2015-02-22 4:38 Robin H. Johnson
2015-02-22 0:15 Alex Legler
2015-02-22 0:14 Alex Legler
2015-02-22 0:04 Alex Legler
2015-02-22 0:03 Alex Legler
2015-02-22 0:01 Alex Legler
2015-02-21 23:57 Alex Legler
2015-02-21 23:49 Robin H. Johnson
2015-02-21 23:41 Robin H. Johnson
2015-02-21 23:39 Robin H. Johnson
2015-02-21 23:34 Robin H. Johnson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1424563199.416dec280acb094e40338fe6198b682e71659ba8.a3li@gentoo \
--to=a3li@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox