diff options
Diffstat (limited to 'ui-repolist.c')
-rw-r--r-- | ui-repolist.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/ui-repolist.c b/ui-repolist.c index 529a203..c12cb19 100644 --- a/ui-repolist.c +++ b/ui-repolist.c @@ -92,6 +92,10 @@ static int is_match(struct cgit_repo *repo) return 1; if (repo->desc && strcasestr(repo->desc, ctx.qry.search)) return 1; + if (repo->language && strcasestr(repo->language, ctx.qry.search)) + return 1; + if (repo->license && strcasestr(repo->license, ctx.qry.search)) + return 1; if (repo->owner && strcasestr(repo->owner, ctx.qry.search)) return 1; return 0; @@ -145,6 +149,10 @@ static void print_header(void) html("<tr class='nohover'>"); print_sort_header("Name", "name"); print_sort_header("Description", "desc"); + if (ctx.cfg.enable_index_language) + print_sort_header("Language", "language"); + if (ctx.cfg.enable_index_license) + print_sort_header("License", "license"); if (ctx.cfg.enable_index_owner) print_sort_header("Owner", "owner"); print_sort_header("Idle", "idle"); @@ -200,6 +208,22 @@ static int sort_desc(const void *a, const void *b) return cmp(r1->desc, r2->desc); } +static int sort_language(const void *a, const void *b) +{ + const struct cgit_repo *r1 = a; + const struct cgit_repo *r2 = b; + + return cmp(r1->language, r2->language); +} + +static int sort_license(const void *a, const void *b) +{ + const struct cgit_repo *r1 = a; + const struct cgit_repo *r2 = b; + + return cmp(r1->license, r2->license); +} + static int sort_owner(const void *a, const void *b) { const struct cgit_repo *r1 = a; @@ -244,6 +268,8 @@ struct sortcolumn { static const struct sortcolumn sortcolumn[] = { {"section", sort_section}, {"name", sort_name}, + {"language", sort_language}, + {"license", sort_license}, {"desc", sort_desc}, {"owner", sort_owner}, {"idle", sort_idle}, @@ -282,6 +308,10 @@ void cgit_print_repolist(void) ++columns; if (ctx.cfg.enable_index_owner) ++columns; + if (ctx.cfg.enable_index_license) + ++columns; + if (ctx.cfg.enable_index_language) + ++columns; ctx.page.title = ctx.cfg.root_title; cgit_print_http_headers(); @@ -330,6 +360,16 @@ void cgit_print_repolist(void) html("..."); html_link_close(); html("</td><td>"); + if (ctx.cfg.enable_index_language) { + if (ctx.repo->language) + html(ctx.repo->language); + html("</td><td>"); + } + if (ctx.cfg.enable_index_license) { + if (ctx.repo->license) + html(ctx.repo->license); + html("</td><td>"); + } if (ctx.cfg.enable_index_owner) { if (ctx.repo->owner_filter) { cgit_open_filter(ctx.repo->owner_filter); |