author: kx <kx@radix.pro> 2023-04-12 19:21:06 +0300
committer: kx <kx@radix.pro> 2023-04-12 19:21:06 +0300
commit: c7693c71799633467d154afe65f9b4810cec42f5
parent: c8b2593c941778dcfa307badf981160e19d2932b
Commit Summary:
Diffstat:
1 file changed, 11 insertions, 5 deletions
diff --git a/csvncgi/ui-repolist.c b/csvncgi/ui-repolist.c index 44795c2..728f658 100644 --- a/csvncgi/ui-repolist.c +++ b/csvncgi/ui-repolist.c @@ -132,8 +132,10 @@ void csvn_print_section_stop( struct strbuf *sb ) void csvn_print_repo( struct strbuf *sb, struct repo *repo ) { - struct variable owner = { (unsigned char *)"owner", { 0 }, DT_STRING }, + struct variable repo_root = { (unsigned char *)"repo-root", { 0 }, DT_PATH }, + owner = { (unsigned char *)"owner", { 0 }, DT_STRING }, description = { (unsigned char *)"description", { 0 }, DT_STRING }; + struct variable *rroot = NULL; struct variable *auth = NULL; struct variable *desc = NULL; @@ -144,12 +146,16 @@ void csvn_print_repo( struct strbuf *sb, struct repo *repo ) if( !sb || !repo || !repo->path ) return; - auth = lookup( repo, &owner ); - desc = lookup( repo, &description ); - time = csvn_repo_last_changed_time( repo ); + rroot = lookup( repo, &repo_root ); + auth = lookup( repo, &owner ); + desc = lookup( repo, &description ); + time = csvn_repo_last_changed_time( repo ); strbuf_addf( sb, " <div class=\"row\">\n" ); - strbuf_addf( sb, " <div class=\"col-name\"><a href=\"/%s/\"><div class=\"repo-name\">%s</div></a></div>\n", repo->path, repo->path ); + if( rroot ) + strbuf_addf( sb, " <div class=\"col-name\"><a href=\"/%s/%s/\"><div class=\"repo-name\">%s</div></a></div>\n", (const char *)rroot->_v.vptr, repo->path, repo->path ); + else + strbuf_addf( sb, " <div class=\"col-name\"><a href=\"/%s/\"><div class=\"repo-name\">%s</div></a></div>\n", repo->path, repo->path ); if( desc ) strbuf_addf( sb, " <div class=\"col-desc\"><div onclick=\"trunc(this)\" class=\"repo-desc trunc\">%s</div></div>\n", (const char *)desc->_v.vptr );