From 1a66e7f3c15bf8d0d5d1b198c6674911a213779e Mon Sep 17 00:00:00 2001 From: Andy Doan Date: Mon, 12 Sep 2016 22:54:08 -0500 Subject: 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 Reviewed-by: John Keeping Signed-off-by: John Keeping --- cgit.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'cgit.h') diff --git a/cgit.h b/cgit.h index df42312..5d81fe8 100644 --- a/cgit.h +++ b/cgit.h @@ -75,6 +75,12 @@ struct cgit_exec_filter { int pid; }; +struct cgit_section { + unsigned int collapse : 1; + char *name; + struct cgit_section *next; +}; + struct cgit_repo { char *url; char *name; @@ -85,7 +91,7 @@ struct cgit_repo { char *defbranch; char *module_link; struct string_list readme; - char *section; + struct cgit_section *section; char *clone_url; char *logo; char *logo_link; @@ -208,7 +214,7 @@ struct cgit_config { char *root_desc; char *root_readme; char *script_name; - char *section; + struct cgit_section *section; char *repository_sort; char *virtual_root; /* Always ends with '/'. */ char *strict_export; @@ -305,6 +311,7 @@ struct cgit_context { struct cgit_config cfg; struct cgit_repo *repo; struct cgit_page page; + struct cgit_section *sections; }; typedef int (*write_archive_fn_t)(const char *, const char *); @@ -322,6 +329,8 @@ extern struct cgit_repolist cgit_repolist; extern struct cgit_context ctx; extern const struct cgit_snapshot_format cgit_snapshot_formats[]; +extern struct cgit_section* get_or_create_section(const char *section); + extern char *cgit_default_repo_desc; extern struct cgit_repo *cgit_add_repo(const char *url); extern struct cgit_repo *cgit_get_repoinfo(const char *url); -- cgit v1.2.3-57-g22cb