ui-repolist: Allow sections to be collapsible

The index page can be difficult to navigate for really large git
servers. This change allows a configuration like:

 section-collapse=people
 section-collapse=tests

And an index page would only display the "people" and "tests" section
headers entries (not their repos) with a hyperlink that can be used to
drill down into each section.

Additionally the boolean logic around displaying sections in
ui-repolist.c was simplified to eliminate an impossible condition.

Signed-off-by: Andy Doan <andy.doan@linaro.org>
Reviewed-by: John Keeping <john@keeping.me.uk>
Signed-off-by: John Keeping <john@keeping.me.uk>
This commit is contained in:
Andy Doan 2016-09-12 22:54:08 -05:00 committed by John Keeping
parent 84b158abe0
commit 1a66e7f3c1
6 changed files with 63 additions and 24 deletions

View file

@ -443,13 +443,16 @@ typedef struct {
void cgit_prepare_repo_env(struct cgit_repo * repo)
{
char *section = NULL;
if (repo->section)
section = repo->section->name;
cgit_env_var env_vars[] = {
{ .name = "CGIT_REPO_URL", .value = repo->url },
{ .name = "CGIT_REPO_NAME", .value = repo->name },
{ .name = "CGIT_REPO_PATH", .value = repo->path },
{ .name = "CGIT_REPO_OWNER", .value = repo->owner },
{ .name = "CGIT_REPO_DEFBRANCH", .value = repo->defbranch },
{ .name = "CGIT_REPO_SECTION", .value = repo->section },
{ .name = "CGIT_REPO_SECTION", .value = section },
{ .name = "CGIT_REPO_CLONE_URL", .value = repo->clone_url }
};
int env_var_count = ARRAY_SIZE(env_vars);