summary refs log tree commit diff
path: root/ui-repolist.c
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2013-02-01 10:59:13 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2013-02-01 12:50:24 +0100
commitb1e172acca870e7999f2d2d917db7b4c42aa05b3 (patch)
treef68ddabb6975f6ac8ef67d55a585f5369f5e4fb2 /ui-repolist.c
parentc6f5bc7264d9c3687a951a76ad93d15a01d7af59 (diff)
Make "owner" column on index page configurable
This is not really needed for personal sites where all repos belong to
the same person. Since it is pretty useful for shared sites however, it
should be configurable.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ui-repolist.c')
-rw-r--r--ui-repolist.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/ui-repolist.c b/ui-repolist.c
index dead1bf..2a910bd 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -110,12 +110,13 @@ void print_sort_header(const char *title, const char *sort)
 	htmlf("'>%s</a></th>", title);
 }
 
-void print_header(int columns)
+void print_header()
 {
 	html("<tr class='nohover'>");
 	print_sort_header("Name", "name");
 	print_sort_header("Description", "desc");
-	print_sort_header("Owner", "owner");
+	if (ctx.cfg.enable_index_owner)
+		print_sort_header("Owner", "owner");
 	print_sort_header("Idle", "idle");
 	if (ctx.cfg.enable_index_links)
 		html("<th class='left'>Links</th>");
@@ -239,13 +240,15 @@ int sort_repolist(char *field)
 
 void cgit_print_repolist()
 {
-	int i, columns = 4, hits = 0, header = 0;
+	int i, columns = 3, hits = 0, header = 0;
 	char *last_section = NULL;
 	char *section;
 	int sorted = 0;
 
 	if (ctx.cfg.enable_index_links)
-		columns++;
+		++columns;
+	if (ctx.cfg.enable_index_owner)
+		++columns;
 
 	ctx.page.title = ctx.cfg.root_title;
 	cgit_print_http_headers(&ctx);
@@ -271,7 +274,7 @@ void cgit_print_repolist()
 		if (hits > ctx.qry.ofs + ctx.cfg.max_repo_count)
 			continue;
 		if (!header++)
-			print_header(columns);
+			print_header();
 		section = ctx.repo->section;
 		if (section && !strcmp(section, ""))
 			section = NULL;
@@ -294,8 +297,10 @@ void cgit_print_repolist()
 		html_ntxt(ctx.cfg.max_repodesc_len, ctx.repo->desc);
 		html_link_close();
 		html("</td><td>");
-		html_txt(ctx.repo->owner);
-		html("</td><td>");
+		if (ctx.cfg.enable_index_owner) {
+			html_txt(ctx.repo->owner);
+			html("</td><td>");
+		}
 		print_modtime(ctx.repo);
 		html("</td>");
 		if (ctx.cfg.enable_index_links) {