about summary refs log tree commit diff
path: root/ui-repolist.c
diff options
context:
space:
mode:
authorLars Hjemli <hjemli@gmail.com>2009-09-13 22:02:07 +0200
committerLars Hjemli <hjemli@gmail.com>2009-09-13 22:02:07 +0200
commit92f6940975f6771f3a08d497c02575ee5bdc79da (patch)
treec1c538b24e50be3bf63356acf246cda76b91c519 /ui-repolist.c
parentMerge branch 'fp/linenumbers' (diff)
parentcgit.c: respect repo-local 'snapshots' option for --scan-path (diff)
downloadcgit-pink-92f6940975f6771f3a08d497c02575ee5bdc79da.tar.gz
cgit-pink-92f6940975f6771f3a08d497c02575ee5bdc79da.zip
Merge branch 'lh/repo-scan'
Diffstat (limited to 'ui-repolist.c')
-rw-r--r--ui-repolist.c37
1 files changed, 28 insertions, 9 deletions
diff --git a/ui-repolist.c b/ui-repolist.c
index 7c7aa9b..3ef2e99 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -136,6 +136,18 @@ static int cmp(const char *s1, const char *s2)
 	return 0;
 }
 
+static int sort_section(const void *a, const void *b)
+{
+	const struct cgit_repo *r1 = a;
+	const struct cgit_repo *r2 = b;
+	int result;
+
+	result = cmp(r1->section, r2->section);
+	if (!result)
+		result = cmp(r1->name, r2->name);
+	return result;
+}
+
 static int sort_name(const void *a, const void *b)
 {
 	const struct cgit_repo *r1 = a;
@@ -178,6 +190,7 @@ struct sortcolumn {
 };
 
 struct sortcolumn sortcolumn[] = {
+	{"section", sort_section},
 	{"name", sort_name},
 	{"desc", sort_desc},
 	{"owner", sort_owner},
@@ -203,7 +216,8 @@ int sort_repolist(char *field)
 void cgit_print_repolist()
 {
 	int i, columns = 4, hits = 0, header = 0;
-	char *last_group = NULL;
+	char *last_section = NULL;
+	char *section;
 	int sorted = 0;
 
 	if (ctx.cfg.enable_index_links)
@@ -219,6 +233,8 @@ void cgit_print_repolist()
 
 	if(ctx.qry.sort)
 		sorted = sort_repolist(ctx.qry.sort);
+	else
+		sort_repolist("section");
 
 	html("<table summary='repository list' class='list nowrap'>");
 	for (i=0; i<cgit_repolist.count; i++) {
@@ -232,19 +248,22 @@ void cgit_print_repolist()
 			continue;
 		if (!header++)
 			print_header(columns);
+		section = ctx.repo->section;
+		if (section && !strcmp(section, ""))
+			section = NULL;
 		if (!sorted &&
-		    ((last_group == NULL && ctx.repo->group != NULL) ||
-		    (last_group != NULL && ctx.repo->group == NULL) ||
-		    (last_group != NULL && ctx.repo->group != NULL &&
-		     strcmp(ctx.repo->group, last_group)))) {
-			htmlf("<tr class='nohover'><td colspan='%d' class='repogroup'>",
+		    ((last_section == NULL && section != NULL) ||
+		    (last_section != NULL && section == NULL) ||
+		    (last_section != NULL && section != NULL &&
+		     strcmp(section, last_section)))) {
+			htmlf("<tr class='nohover'><td colspan='%d' class='reposection'>",
 			      columns);
-			html_txt(ctx.repo->group);
+			html_txt(section);
 			html("</td></tr>");
-			last_group = ctx.repo->group;
+			last_section = section;
 		}
 		htmlf("<tr><td class='%s'>",
-		      !sorted && ctx.repo->group ? "sublevel-repo" : "toplevel-repo");
+		      !sorted && section ? "sublevel-repo" : "toplevel-repo");
 		cgit_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL);
 		html("</td><td>");
 		html_link_open(cgit_repourl(ctx.repo->url), NULL, NULL);
ghlight'> 2018-09-13Return a format->split even at the end of the stringJune McEnroe 2018-09-13Fix weird tab-complete after commaJune McEnroe I have no idea why I did this. 2018-09-13Rewrite UI againJune McEnroe The persistent topic is gone and the status line is now at the top. The status formatting still needs to be reworked. I also want to try showing the nick in the input window so it really looks like your next message. 2018-09-12Add note about C-oJune McEnroe Why are there so few well usable ctrl key bindings? 2018-09-12Use formatParse split to position input cursorJune McEnroe 2018-09-12Factor out IRC formatting parsingJune McEnroe 2018-09-11Add /help equivalent to /manJune McEnroe 2018-09-11Don't render every PM as a pingJune McEnroe 2018-09-11Add urlOpenMatchJune McEnroe 2018-09-10Depend on man.sh for chroot.tar targetJune McEnroe 2018-09-10Set LESSSECURE=1 in man.shJune McEnroe Ridiculous. 2018-09-10Add /man commandJune McEnroe 2018-09-10Install man page in chrootJune McEnroe 2018-09-10Install man pageJune McEnroe 2018-09-10Split keys into subsections and document colorsJune McEnroe 2018-09-10Add "blank" lines to chatte.1June McEnroe 2018-09-10Document key bindings in chatte.1June McEnroe 2018-09-08Document slash commands in chatte.1June McEnroe