diff options
author | Florian Pritz <bluewind@xinu.at> | 2013-02-01 18:59:13 (JST) |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2013-02-01 20:50:24 (JST) |
commit | b1e172acca870e7999f2d2d917db7b4c42aa05b3 (patch) | |
tree | f68ddabb6975f6ac8ef67d55a585f5369f5e4fb2 | |
parent | c6f5bc7264d9c3687a951a76ad93d15a01d7af59 (diff) | |
download | cgit-b1e172acca870e7999f2d2d917db7b4c42aa05b3.zip cgit-b1e172acca870e7999f2d2d917db7b4c42aa05b3.tar.gz |
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>
-rw-r--r-- | cgit.c | 3 | ||||
-rw-r--r-- | cgit.h | 1 | ||||
-rw-r--r-- | cgitrc.5.txt | 4 | ||||
-rw-r--r-- | ui-repolist.c | 19 |
4 files changed, 20 insertions, 7 deletions
@@ -172,6 +172,8 @@ void config_cb(const char *name, const char *value) | |||
172 | ctx.cfg.enable_http_clone = atoi(value); | 172 | ctx.cfg.enable_http_clone = atoi(value); |
173 | else if (!strcmp(name, "enable-index-links")) | 173 | else if (!strcmp(name, "enable-index-links")) |
174 | ctx.cfg.enable_index_links = atoi(value); | 174 | ctx.cfg.enable_index_links = atoi(value); |
175 | else if (!strcmp(name, "enable-index-owner")) | ||
176 | ctx.cfg.enable_index_owner = atoi(value); | ||
175 | else if (!strcmp(name, "enable-commit-graph")) | 177 | else if (!strcmp(name, "enable-commit-graph")) |
176 | ctx.cfg.enable_commit_graph = atoi(value); | 178 | ctx.cfg.enable_commit_graph = atoi(value); |
177 | else if (!strcmp(name, "enable-log-filecount")) | 179 | else if (!strcmp(name, "enable-log-filecount")) |
@@ -354,6 +356,7 @@ static void prepare_context(struct cgit_context *ctx) | |||
354 | ctx->cfg.logo = "/cgit.png"; | 356 | ctx->cfg.logo = "/cgit.png"; |
355 | ctx->cfg.local_time = 0; | 357 | ctx->cfg.local_time = 0; |
356 | ctx->cfg.enable_http_clone = 1; | 358 | ctx->cfg.enable_http_clone = 1; |
359 | ctx->cfg.enable_index_owner = 1; | ||
357 | ctx->cfg.enable_tree_linenumbers = 1; | 360 | ctx->cfg.enable_tree_linenumbers = 1; |
358 | ctx->cfg.enable_git_config = 0; | 361 | ctx->cfg.enable_git_config = 0; |
359 | ctx->cfg.max_repo_count = 50; | 362 | ctx->cfg.max_repo_count = 50; |
@@ -203,6 +203,7 @@ struct cgit_config { | |||
203 | int enable_filter_overrides; | 203 | int enable_filter_overrides; |
204 | int enable_http_clone; | 204 | int enable_http_clone; |
205 | int enable_index_links; | 205 | int enable_index_links; |
206 | int enable_index_owner; | ||
206 | int enable_commit_graph; | 207 | int enable_commit_graph; |
207 | int enable_log_filecount; | 208 | int enable_log_filecount; |
208 | int enable_log_linecount; | 209 | int enable_log_linecount; |
diff --git a/cgitrc.5.txt b/cgitrc.5.txt index c1038d7..4d27d9f 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt | |||
@@ -120,6 +120,10 @@ enable-index-links:: | |||
120 | each repo in the repository index (specifically, to the "summary", | 120 | each repo in the repository index (specifically, to the "summary", |
121 | "commit" and "tree" pages). Default value: "0". | 121 | "commit" and "tree" pages). Default value: "0". |
122 | 122 | ||
123 | enable-index-owner:: | ||
124 | Flag which, when set to "1", will make cgit display the owner of | ||
125 | each repo in the repository index. Default value: "1". | ||
126 | |||
123 | enable-log-filecount:: | 127 | enable-log-filecount:: |
124 | Flag which, when set to "1", will make cgit print the number of | 128 | Flag which, when set to "1", will make cgit print the number of |
125 | modified files for each commit on the repository log page. Default | 129 | modified files for each commit on the repository log page. Default |
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) | |||
110 | htmlf("'>%s</a></th>", title); | 110 | htmlf("'>%s</a></th>", title); |
111 | } | 111 | } |
112 | 112 | ||
113 | void print_header(int columns) | 113 | void print_header() |
114 | { | 114 | { |
115 | html("<tr class='nohover'>"); | 115 | html("<tr class='nohover'>"); |
116 | print_sort_header("Name", "name"); | 116 | print_sort_header("Name", "name"); |
117 | print_sort_header("Description", "desc"); | 117 | print_sort_header("Description", "desc"); |
118 | print_sort_header("Owner", "owner"); | 118 | if (ctx.cfg.enable_index_owner) |
119 | print_sort_header("Owner", "owner"); | ||
119 | print_sort_header("Idle", "idle"); | 120 | print_sort_header("Idle", "idle"); |
120 | if (ctx.cfg.enable_index_links) | 121 | if (ctx.cfg.enable_index_links) |
121 | html("<th class='left'>Links</th>"); | 122 | html("<th class='left'>Links</th>"); |
@@ -239,13 +240,15 @@ int sort_repolist(char *field) | |||
239 | 240 | ||
240 | void cgit_print_repolist() | 241 | void cgit_print_repolist() |
241 | { | 242 | { |
242 | int i, columns = 4, hits = 0, header = 0; | 243 | int i, columns = 3, hits = 0, header = 0; |
243 | char *last_section = NULL; | 244 | char *last_section = NULL; |
244 | char *section; | 245 | char *section; |
245 | int sorted = 0; | 246 | int sorted = 0; |
246 | 247 | ||
247 | if (ctx.cfg.enable_index_links) | 248 | if (ctx.cfg.enable_index_links) |
248 | columns++; | 249 | ++columns; |
250 | if (ctx.cfg.enable_index_owner) | ||
251 | ++columns; | ||
249 | 252 | ||
250 | ctx.page.title = ctx.cfg.root_title; | 253 | ctx.page.title = ctx.cfg.root_title; |
251 | cgit_print_http_headers(&ctx); | 254 | cgit_print_http_headers(&ctx); |
@@ -271,7 +274,7 @@ void cgit_print_repolist() | |||
271 | if (hits > ctx.qry.ofs + ctx.cfg.max_repo_count) | 274 | if (hits > ctx.qry.ofs + ctx.cfg.max_repo_count) |
272 | continue; | 275 | continue; |
273 | if (!header++) | 276 | if (!header++) |
274 | print_header(columns); | 277 | print_header(); |
275 | section = ctx.repo->section; | 278 | section = ctx.repo->section; |
276 | if (section && !strcmp(section, "")) | 279 | if (section && !strcmp(section, "")) |
277 | section = NULL; | 280 | section = NULL; |
@@ -294,8 +297,10 @@ void cgit_print_repolist() | |||
294 | html_ntxt(ctx.cfg.max_repodesc_len, ctx.repo->desc); | 297 | html_ntxt(ctx.cfg.max_repodesc_len, ctx.repo->desc); |
295 | html_link_close(); | 298 | html_link_close(); |
296 | html("</td><td>"); | 299 | html("</td><td>"); |
297 | html_txt(ctx.repo->owner); | 300 | if (ctx.cfg.enable_index_owner) { |
298 | html("</td><td>"); | 301 | html_txt(ctx.repo->owner); |
302 | html("</td><td>"); | ||
303 | } | ||
299 | print_modtime(ctx.repo); | 304 | print_modtime(ctx.repo); |
300 | html("</td>"); | 305 | html("</td>"); |
301 | if (ctx.cfg.enable_index_links) { | 306 | if (ctx.cfg.enable_index_links) { |