]> git.cameronkatri.com Git - cgit.git/commitdiff
Make "owner" column on index page configurable
authorFlorian Pritz <bluewind@xinu.at>
Fri, 1 Feb 2013 09:59:13 +0000 (10:59 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Fri, 1 Feb 2013 11:50:24 +0000 (12:50 +0100)
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>
cgit.c
cgit.h
cgitrc.5.txt
ui-repolist.c

diff --git a/cgit.c b/cgit.c
index a97ed69653b36d696c0fd564bfbc4be55f99f2b0..11edd81cbb69d5b3eab7fe0cdc0c720fea05d951 100644 (file)
--- a/cgit.c
+++ b/cgit.c
@@ -172,6 +172,8 @@ void config_cb(const char *name, const char *value)
                ctx.cfg.enable_http_clone = atoi(value);
        else if (!strcmp(name, "enable-index-links"))
                ctx.cfg.enable_index_links = atoi(value);
+       else if (!strcmp(name, "enable-index-owner"))
+               ctx.cfg.enable_index_owner = atoi(value);
        else if (!strcmp(name, "enable-commit-graph"))
                ctx.cfg.enable_commit_graph = atoi(value);
        else if (!strcmp(name, "enable-log-filecount"))
@@ -354,6 +356,7 @@ static void prepare_context(struct cgit_context *ctx)
        ctx->cfg.logo = "/cgit.png";
        ctx->cfg.local_time = 0;
        ctx->cfg.enable_http_clone = 1;
+       ctx->cfg.enable_index_owner = 1;
        ctx->cfg.enable_tree_linenumbers = 1;
        ctx->cfg.enable_git_config = 0;
        ctx->cfg.max_repo_count = 50;
diff --git a/cgit.h b/cgit.h
index 7a99135710d9c9ed96fe1eeac4b3dc6500723b3e..f3d2556949ddce9d698ae6231b887328cc83f6db 100644 (file)
--- a/cgit.h
+++ b/cgit.h
@@ -203,6 +203,7 @@ struct cgit_config {
        int enable_filter_overrides;
        int enable_http_clone;
        int enable_index_links;
+       int enable_index_owner;
        int enable_commit_graph;
        int enable_log_filecount;
        int enable_log_linecount;
index c1038d78ef382ebdb3becf76b7d179734593cd96..4d27d9ff6a810aaa5d109295e8e89e40344edc64 100644 (file)
@@ -120,6 +120,10 @@ enable-index-links::
        each repo in the repository index (specifically, to the "summary",
        "commit" and "tree" pages). Default value: "0".
 
+enable-index-owner::
+       Flag which, when set to "1", will make cgit display the owner of
+       each repo in the repository index. Default value: "1".
+
 enable-log-filecount::
        Flag which, when set to "1", will make cgit print the number of
        modified files for each commit on the repository log page. Default
index dead1bfe5fea732d7bd4444a9873d81b96a8faae..2a910bdc9f0d8ea35db73fec7a38fd6774d5df71 100644 (file)
@@ -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) {