2012-09-16 13:17:56 +03:00
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
|
|
<head>
|
2014-12-31 11:50:08 +02:00
|
|
|
|
|
|
|
% relroot = '../' * (len(repo.branch.split('/')) - 1)
|
|
|
|
|
2012-09-16 13:17:56 +03:00
|
|
|
<title>git » {{repo.name}} » {{repo.branch}}</title>
|
2014-12-31 11:50:08 +02:00
|
|
|
<link rel="stylesheet" type="text/css" href="{{relroot}}../../../../static/git-arr.css"/>
|
2012-09-16 13:17:56 +03:00
|
|
|
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body class="branch">
|
2014-12-31 11:50:08 +02:00
|
|
|
<h1><a href="{{relroot}}../../../../">git</a> »
|
|
|
|
<a href="{{relroot}}../../">{{repo.name}}</a> »
|
2012-09-16 13:17:56 +03:00
|
|
|
<a href="./">{{repo.branch}}</a>
|
|
|
|
</h1>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
<a class="explicit" href="t/">Browse current source tree</a>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
% commits = repo.commits("refs/heads/" + repo.branch,
|
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-01 23:41:08 +02:00
|
|
|
% limit = repo.info.commits_per_page + 1,
|
2012-09-16 13:17:56 +03:00
|
|
|
% offset = repo.info.commits_per_page * offset)
|
|
|
|
% commits = list(commits)
|
|
|
|
|
|
|
|
% if len(commits) == 0:
|
|
|
|
% abort(404, "No more commits")
|
|
|
|
% end
|
|
|
|
|
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-01 23:41:08 +02:00
|
|
|
% more = len(commits) > repo.info.commits_per_page
|
|
|
|
% if more:
|
|
|
|
% commits = commits[:-1]
|
|
|
|
% end
|
2015-01-01 23:41:09 +02:00
|
|
|
% more = more and offset + 1 < repo.info.max_pages
|
2012-09-16 13:17:56 +03:00
|
|
|
|
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-01 23:41:08 +02:00
|
|
|
% include paginate more = more, offset = offset
|
2012-09-16 13:17:56 +03:00
|
|
|
|
|
|
|
% kwargs = dict(repo=repo, commits=commits,
|
2014-12-31 11:50:08 +02:00
|
|
|
% shorten=shorten, repo_root=relroot + "../..")
|
2012-09-16 13:17:56 +03:00
|
|
|
% include commit-list **kwargs
|
|
|
|
|
|
|
|
<p/>
|
|
|
|
|
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-01 23:41:08 +02:00
|
|
|
% include paginate more = more, offset = offset
|
2012-09-16 13:17:56 +03:00
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|