git-arr/views
Eric Sunshine ac105c8383 views: branch/paginate: fix incorrectly enabled "next" link
When the number of commits on a branch page is less than
'commits_per_page', the pagination "next" link is disabled, indicating
correctly that this is the final page. However, if the number of commits
on the branch page is exactly 'commits_per_page', then the "next" link
is incorrectly enabled, even on the final page. When clicked, the user
is taken to a "404 Page not found" error page, which makes for a poor
user experience.

Fix this problem by reliably detecting when the branch page is the final
one. Do so by asking for (but not displaying) one commit more than
actually needed by the page. If the additional commit is successfully
retrieved, then another page definitely follows this one. If not
retrieved, then this is definitely the final page.

(Unfortunately, the seemingly more expedient approach of checking if the
final commit on the current page is a root commit -- has no parents --
is not a reliable indicator that this the final page since a branch may
have multiple root commits due to merging.)

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
2015-01-11 21:18:22 +00:00
..
blob.html Fix one-line 'if' termination in tree, blob templates 2014-06-30 08:45:36 +01:00
branch.html views: branch/paginate: fix incorrectly enabled "next" link 2015-01-11 21:18:22 +00:00
commit-list.html Initial commit 2012-11-10 17:49:54 +00:00
commit.html Fix committer field in the commit view 2013-11-03 10:57:54 +00:00
index.html Show the age of a repository in the index, via javascript 2013-11-02 22:18:33 +00:00
paginate.html views: branch/paginate: fix incorrectly enabled "next" link 2015-01-11 21:18:22 +00:00
summary.html views: summary: suppress extra horizontal rule when no "master" branch 2015-01-11 21:18:06 +00:00
tree.html views/tree.html: Fix lambda syntax 2014-07-28 23:46:50 +01:00