зеркало из https://github.com/microsoft/git.git
gitweb: Use href(-replay=>1, page=>...) to generate pagination links
Use href(-replay=>1, page=>$page-1) and href(-replay=>1, page=>$page+1) to generate previous page and next page links. Generate next page link only once. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
1cad283a71
Коммит
7afd77bfc1
|
@ -2518,7 +2518,7 @@ sub format_paging_nav {
|
|||
|
||||
if ($page > 0) {
|
||||
$paging_nav .= " ⋅ " .
|
||||
$cgi->a({-href => href(action=>$action, hash=>$hash, page=>$page-1),
|
||||
$cgi->a({-href => href(-replay=>1, page=>$page-1),
|
||||
-accesskey => "p", -title => "Alt-p"}, "prev");
|
||||
} else {
|
||||
$paging_nav .= " ⋅ prev";
|
||||
|
@ -2526,7 +2526,7 @@ sub format_paging_nav {
|
|||
|
||||
if ($nrevs >= (100 * ($page+1)-1)) {
|
||||
$paging_nav .= " ⋅ " .
|
||||
$cgi->a({-href => href(action=>$action, hash=>$hash, page=>$page+1),
|
||||
$cgi->a({-href => href(-replay=>1, page=>$page+1),
|
||||
-accesskey => "n", -title => "Alt-n"}, "next");
|
||||
} else {
|
||||
$paging_nav .= " ⋅ next";
|
||||
|
@ -4448,7 +4448,7 @@ sub git_log {
|
|||
}
|
||||
if ($#commitlist >= 100) {
|
||||
print "<div class=\"page_nav\">\n";
|
||||
print $cgi->a({-href => href(action=>"log", hash=>$hash, page=>$page+1),
|
||||
print $cgi->a({-href => href(-replay=>1, page=>$page+1),
|
||||
-accesskey => "n", -title => "Alt-n"}, "next");
|
||||
print "</div>\n";
|
||||
}
|
||||
|
@ -5015,27 +5015,20 @@ sub git_history {
|
|||
file_name=>$file_name)},
|
||||
"first");
|
||||
$paging_nav .= " ⋅ " .
|
||||
$cgi->a({-href => href(action=>"history", hash=>$hash, hash_base=>$hash_base,
|
||||
file_name=>$file_name, page=>$page-1),
|
||||
$cgi->a({-href => href(-replay=>1, page=>$page-1),
|
||||
-accesskey => "p", -title => "Alt-p"}, "prev");
|
||||
} else {
|
||||
$paging_nav .= "first";
|
||||
$paging_nav .= " ⋅ prev";
|
||||
}
|
||||
if ($#commitlist >= 100) {
|
||||
$paging_nav .= " ⋅ " .
|
||||
$cgi->a({-href => href(action=>"history", hash=>$hash, hash_base=>$hash_base,
|
||||
file_name=>$file_name, page=>$page+1),
|
||||
-accesskey => "n", -title => "Alt-n"}, "next");
|
||||
} else {
|
||||
$paging_nav .= " ⋅ next";
|
||||
}
|
||||
my $next_link = '';
|
||||
if ($#commitlist >= 100) {
|
||||
$next_link =
|
||||
$cgi->a({-href => href(action=>"history", hash=>$hash, hash_base=>$hash_base,
|
||||
file_name=>$file_name, page=>$page+1),
|
||||
$cgi->a({-href => href(-replay=>1, page=>$page+1),
|
||||
-accesskey => "n", -title => "Alt-n"}, "next");
|
||||
$paging_nav .= " ⋅ $next_link";
|
||||
} else {
|
||||
$paging_nav .= " ⋅ next";
|
||||
}
|
||||
|
||||
git_header_html();
|
||||
|
@ -5105,30 +5098,23 @@ sub git_search {
|
|||
searchtext=>$searchtext, searchtype=>$searchtype)},
|
||||
"first");
|
||||
$paging_nav .= " ⋅ " .
|
||||
$cgi->a({-href => href(action=>"search", hash=>$hash,
|
||||
searchtext=>$searchtext, searchtype=>$searchtype,
|
||||
page=>$page-1),
|
||||
$cgi->a({-href => href(-replay=>1, page=>$page-1),
|
||||
-accesskey => "p", -title => "Alt-p"}, "prev");
|
||||
} else {
|
||||
$paging_nav .= "first";
|
||||
$paging_nav .= " ⋅ prev";
|
||||
}
|
||||
if ($#commitlist >= 100) {
|
||||
$paging_nav .= " ⋅ " .
|
||||
$cgi->a({-href => href(action=>"search", hash=>$hash,
|
||||
searchtext=>$searchtext, searchtype=>$searchtype,
|
||||
page=>$page+1),
|
||||
-accesskey => "n", -title => "Alt-n"}, "next");
|
||||
} else {
|
||||
$paging_nav .= " ⋅ next";
|
||||
}
|
||||
my $next_link = '';
|
||||
if ($#commitlist >= 100) {
|
||||
$next_link =
|
||||
$cgi->a({-href => href(action=>"search", hash=>$hash,
|
||||
searchtext=>$searchtext, searchtype=>$searchtype,
|
||||
page=>$page+1),
|
||||
$cgi->a({-href => href(-replay=>1, page=>$page+1),
|
||||
-accesskey => "n", -title => "Alt-n"}, "next");
|
||||
$paging_nav .= " ⋅ $next_link";
|
||||
} else {
|
||||
$paging_nav .= " ⋅ next";
|
||||
}
|
||||
|
||||
if ($#commitlist >= 100) {
|
||||
}
|
||||
|
||||
git_print_page_nav('','', $hash,$co{'tree'},$hash, $paging_nav);
|
||||
|
@ -5327,7 +5313,7 @@ sub git_shortlog {
|
|||
my $next_link = '';
|
||||
if ($#commitlist >= 100) {
|
||||
$next_link =
|
||||
$cgi->a({-href => href(action=>"shortlog", hash=>$hash, page=>$page+1),
|
||||
$cgi->a({-href => href(-replay=>1, page=>$page+1),
|
||||
-accesskey => "n", -title => "Alt-n"}, "next");
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче