Convert pager navigation into a unordered list

It is common practice and semantically appropriate to use unordered
lists for long navigation lists.

This also fixes the layout of very long pager navigations in
Webkit-based browsers.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
This commit is contained in:
Lukas Fleischer 2013-03-07 08:56:22 +01:00 committed by Jason A. Donenfeld
parent 121089ced5
commit b60e6bff75
3 changed files with 20 additions and 9 deletions

View File

@ -538,17 +538,23 @@ div#cgit table.list td.sublevel-repo {
padding-left: 1.5em; padding-left: 1.5em;
} }
div#cgit div.pager { div#cgit ul.pager {
list-style-type: none;
text-align: center; text-align: center;
margin: 1em 0em 0em 0em; margin: 1em 0em 0em 0em;
padding: 0;
} }
div#cgit div.pager a { div#cgit ul.pager li {
display: inline-block;
margin: 0.25em 0.5em;
}
div#cgit ul.pager a {
color: #777; color: #777;
margin: 0em 0.5em;
} }
div#cgit div.pager .current { div#cgit ul.pager .current {
font-weight: bold; font-weight: bold;
} }

View File

@ -405,21 +405,24 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
commit->parents = NULL; commit->parents = NULL;
} }
if (pager) { if (pager) {
html("</table><div class='pager'>"); html("</table><ul class='pager'>");
if (ofs > 0) { if (ofs > 0) {
html("<li>");
cgit_log_link("[prev]", NULL, NULL, ctx.qry.head, cgit_log_link("[prev]", NULL, NULL, ctx.qry.head,
ctx.qry.sha1, ctx.qry.vpath, ctx.qry.sha1, ctx.qry.vpath,
ofs - cnt, ctx.qry.grep, ofs - cnt, ctx.qry.grep,
ctx.qry.search, ctx.qry.showmsg); ctx.qry.search, ctx.qry.showmsg);
html("&nbsp;"); html("</li>");
} }
if ((commit = get_revision(&rev)) != NULL) { if ((commit = get_revision(&rev)) != NULL) {
html("<li>");
cgit_log_link("[next]", NULL, NULL, ctx.qry.head, cgit_log_link("[next]", NULL, NULL, ctx.qry.head,
ctx.qry.sha1, ctx.qry.vpath, ctx.qry.sha1, ctx.qry.vpath,
ofs + cnt, ctx.qry.grep, ofs + cnt, ctx.qry.grep,
ctx.qry.search, ctx.qry.showmsg); ctx.qry.search, ctx.qry.showmsg);
html("</li>");
} }
html("</div>"); html("</ul>");
} else if ((commit = get_revision(&rev)) != NULL) { } else if ((commit = get_revision(&rev)) != NULL) {
htmlf("<tr class='nohover'><td colspan='%d'>", columns); htmlf("<tr class='nohover'><td colspan='%d'>", columns);
cgit_log_link("[...]", NULL, NULL, ctx.qry.head, NULL, cgit_log_link("[...]", NULL, NULL, ctx.qry.head, NULL,

View File

@ -128,13 +128,15 @@ static void print_pager(int items, int pagelen, char *search, char *sort)
{ {
int i, ofs; int i, ofs;
char *class = NULL; char *class = NULL;
html("<div class='pager'>"); html("<ul class='pager'>");
for (i = 0, ofs = 0; ofs < items; i++, ofs = i * pagelen) { for (i = 0, ofs = 0; ofs < items; i++, ofs = i * pagelen) {
class = (ctx.qry.ofs == ofs) ? "current" : NULL; class = (ctx.qry.ofs == ofs) ? "current" : NULL;
html("<li>");
cgit_index_link(fmt("[%d]", i + 1), fmt("Page %d", i + 1), cgit_index_link(fmt("[%d]", i + 1), fmt("Page %d", i + 1),
class, search, sort, ofs); class, search, sort, ofs);
html("</li>");
} }
html("</div>"); html("</ul>");
} }
static int cmp(const char *s1, const char *s2) static int cmp(const char *s1, const char *s2)