X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/e19683bedebc74593cb4c4518e47a334a5478e1e..837d464af77d76a2661d92e05167657cbf430d80:/ui-repolist.c diff --git a/ui-repolist.c b/ui-repolist.c index 3f78e28..ab050c7 100644 --- a/ui-repolist.c +++ b/ui-repolist.c @@ -59,6 +59,15 @@ int is_match(struct cgit_repo *repo) return 0; } +int is_in_url(struct cgit_repo *repo) +{ + if (!ctx.qry.url) + return 1; + if (repo->url && !prefixcmp(repo->url, ctx.qry.url)) + return 1; + return 0; +} + void print_header(int columns) { html("" @@ -71,6 +80,17 @@ void print_header(int columns) html("\n"); } + +void print_pager(int items, int pagelen, char *search) +{ + int i; + html("
"); + for(i = 0; i * pagelen < items; i++) + cgit_index_link(fmt("[%d]", i+1), fmt("Page %d", i+1), NULL, + search, i * pagelen); + html("
"); +} + void cgit_print_repolist() { int i, columns = 4, hits = 0, header = 0; @@ -90,11 +110,15 @@ void cgit_print_repolist() html(""); for (i=0; i ctx.qry.ofs + ctx.cfg.max_repo_count) continue; if (!header++) print_header(columns); - hits++; if ((last_group == NULL && ctx.repo->group != NULL) || (last_group != NULL && ctx.repo->group == NULL) || (last_group != NULL && ctx.repo->group != NULL && @@ -107,9 +131,7 @@ void cgit_print_repolist() } htmlf(""); if (ctx.cfg.enable_index_links) { html("
", ctx.repo->group ? "sublevel-repo" : "toplevel-repo"); - html_link_open(cgit_repourl(ctx.repo->url), NULL, NULL); - html_txt(ctx.repo->name); - html_link_close(); + cgit_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL); html(""); html_link_open(cgit_repourl(ctx.repo->url), NULL, NULL); html_ntxt(ctx.cfg.max_repodesc_len, ctx.repo->desc); @@ -121,9 +143,7 @@ void cgit_print_repolist() html(""); - html_link_open(cgit_repourl(ctx.repo->url), - NULL, "button"); - html("summary"); + cgit_summary_link("summary", NULL, "button", NULL); cgit_log_link("log", NULL, "button", NULL, NULL, NULL, 0, NULL, NULL); cgit_tree_link("tree", NULL, "button", NULL, NULL, NULL); @@ -134,6 +154,8 @@ void cgit_print_repolist() html("
"); if (!hits) cgit_print_error("No repositories found"); + else if (hits > ctx.cfg.max_repo_count) + print_pager(hits, ctx.cfg.max_repo_count, ctx.qry.search); cgit_print_docend(); }