diff options
author | Jason A. Donenfeld | 2016-02-22 16:04:15 +0100 |
---|---|---|
committer | Jason A. Donenfeld | 2016-02-22 18:40:13 +0100 |
commit | 5f2664f13c90f083b827d8fafa6cfc01c0c4f513 (patch) | |
tree | 76fff0ba1df2d97bc6e814311ed6494724c47101 | |
parent | 75298209bf8386656b82f185e2901690ac5b671c (diff) | |
download | cgit-5f2664f13c90f083b827d8fafa6cfc01c0c4f513.tar.gz cgit-5f2664f13c90f083b827d8fafa6cfc01c0c4f513.tar.bz2 cgit-5f2664f13c90f083b827d8fafa6cfc01c0c4f513.zip |
ui-shared: add homepage to tabs
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | cgit.c | 4 | ||||
-rw-r--r-- | cgit.css | 5 | ||||
-rw-r--r-- | cgit.h | 1 | ||||
-rw-r--r-- | cgitrc.5.txt | 13 | ||||
-rw-r--r-- | scan-tree.c | 2 | ||||
-rw-r--r-- | shared.c | 1 | ||||
-rw-r--r-- | ui-shared.c | 5 |
7 files changed, 26 insertions, 5 deletions
@@ -41,6 +41,8 @@ static void repo_config(struct cgit_repo *repo, const char *name, const char *va | |||
41 | repo->desc = xstrdup(value); | 41 | repo->desc = xstrdup(value); |
42 | else if (!strcmp(name, "owner")) | 42 | else if (!strcmp(name, "owner")) |
43 | repo->owner = xstrdup(value); | 43 | repo->owner = xstrdup(value); |
44 | else if (!strcmp(name, "homepage")) | ||
45 | repo->homepage = xstrdup(value); | ||
44 | else if (!strcmp(name, "defbranch")) | 46 | else if (!strcmp(name, "defbranch")) |
45 | repo->defbranch = xstrdup(value); | 47 | repo->defbranch = xstrdup(value); |
46 | else if (!strcmp(name, "snapshots")) | 48 | else if (!strcmp(name, "snapshots")) |
@@ -793,6 +795,8 @@ static void print_repo(FILE *f, struct cgit_repo *repo) | |||
793 | fprintf(f, "repo.module-link=%s\n", repo->module_link); | 795 | fprintf(f, "repo.module-link=%s\n", repo->module_link); |
794 | if (repo->section) | 796 | if (repo->section) |
795 | fprintf(f, "repo.section=%s\n", repo->section); | 797 | fprintf(f, "repo.section=%s\n", repo->section); |
798 | if (repo->homepage) | ||
799 | fprintf(f, "repo.homepage=%s\n", repo->homepage); | ||
796 | if (repo->clone_url) | 800 | if (repo->clone_url) |
797 | fprintf(f, "repo.clone-url=%s\n", repo->clone_url); | 801 | fprintf(f, "repo.clone-url=%s\n", repo->clone_url); |
798 | fprintf(f, "repo.enable-commit-graph=%d\n", | 802 | fprintf(f, "repo.enable-commit-graph=%d\n", |
@@ -85,6 +85,11 @@ div#cgit table.tabs td a.active { | |||
85 | background-color: #ccc; | 85 | background-color: #ccc; |
86 | } | 86 | } |
87 | 87 | ||
88 | div#cgit table.tabs a[href^="http://"]:after, div#cgit table.tabs a[href^="https://"]:after { | ||
89 | content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAQAAAAnOwc2AAAAAnNCSVQICFXsRgQAAAAJcEhZcwAAABQAAAAUAVyMgXwAAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb7jwaAAAAeklEQVQI12NoYCu3q3ABwXL98vTy/0D4jaF8XXldRRoYejAwlu8BCTOU72SAg4q08j/le0GC22BC5anlfyrSGBiBGCZYllz+pywLJg8WLOMtf1GeCjRgI5IgSBhMboUIHq40r1CCQrfyDRAV6uXdZTMhsKKlVIIBFwAAVeg4KFYK95cAAAAASUVORK5CYII=); | ||
90 | margin: 0 0 0 5px; | ||
91 | } | ||
92 | |||
88 | div#cgit table.tabs td.form { | 93 | div#cgit table.tabs td.form { |
89 | text-align: right; | 94 | text-align: right; |
90 | } | 95 | } |
@@ -81,6 +81,7 @@ struct cgit_repo { | |||
81 | char *path; | 81 | char *path; |
82 | char *desc; | 82 | char *desc; |
83 | char *owner; | 83 | char *owner; |
84 | char *homepage; | ||
84 | char *defbranch; | 85 | char *defbranch; |
85 | char *module_link; | 86 | char *module_link; |
86 | struct string_list readme; | 87 | struct string_list readme; |
diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 47850a8..94901bd 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt | |||
@@ -205,11 +205,11 @@ enable-git-config:: | |||
205 | Flag which, when set to "1", will allow cgit to use git config to set | 205 | Flag which, when set to "1", will allow cgit to use git config to set |
206 | any repo specific settings. This option is used in conjunction with | 206 | any repo specific settings. This option is used in conjunction with |
207 | "scan-path", and must be defined prior, to augment repo-specific | 207 | "scan-path", and must be defined prior, to augment repo-specific |
208 | settings. The keys gitweb.owner, gitweb.category, and gitweb.description | 208 | settings. The keys gitweb.owner, gitweb.category, gitweb.description, |
209 | will map to the cgit keys repo.owner, repo.section, and repo.desc, | 209 | and gitweb.homepage will map to the cgit keys repo.owner, repo.section, |
210 | respectively. All git config keys that begin with "cgit." will be mapped | 210 | repo.desc, and repo.homepage respectively. All git config keys that begin |
211 | to the corresponding "repo." key in cgit. Default value: "0". See also: | 211 | with "cgit." will be mapped to the corresponding "repo." key in cgit. |
212 | scan-path, section-from-path. | 212 | Default value: "0". See also: scan-path, section-from-path. |
213 | 213 | ||
214 | favicon:: | 214 | favicon:: |
215 | Url used as link to a shortcut icon for cgit. It is suggested to use | 215 | Url used as link to a shortcut icon for cgit. It is suggested to use |
@@ -496,6 +496,9 @@ repo.defbranch:: | |||
496 | repo.desc:: | 496 | repo.desc:: |
497 | The value to show as repository description. Default value: none. | 497 | The value to show as repository description. Default value: none. |
498 | 498 | ||
499 | repo.homepage:: | ||
500 | The value to show as repository homepage. Default value: none. | ||
501 | |||
499 | repo.email-filter:: | 502 | repo.email-filter:: |
500 | Override the default email-filter. Default value: none. See also: | 503 | Override the default email-filter. Default value: none. See also: |
501 | "enable-filter-overrides". See also: "FILTER API". | 504 | "enable-filter-overrides". See also: "FILTER API". |
diff --git a/scan-tree.c b/scan-tree.c index b5a10ff..2e87999 100644 --- a/scan-tree.c +++ b/scan-tree.c | |||
@@ -61,6 +61,8 @@ static int gitconfig_config(const char *key, const char *value, void *cb) | |||
61 | config_fn(repo, "desc", value); | 61 | config_fn(repo, "desc", value); |
62 | else if (!strcmp(key, "gitweb.category")) | 62 | else if (!strcmp(key, "gitweb.category")) |
63 | config_fn(repo, "section", value); | 63 | config_fn(repo, "section", value); |
64 | else if (!strcmp(key, "gitweb.homepage")) | ||
65 | config_fn(repo, "homepage", value); | ||
64 | else if (starts_with(key, "cgit.")) | 66 | else if (starts_with(key, "cgit.")) |
65 | config_fn(repo, key + 5, value); | 67 | config_fn(repo, key + 5, value); |
66 | 68 | ||
@@ -54,6 +54,7 @@ struct cgit_repo *cgit_add_repo(const char *url) | |||
54 | ret->path = NULL; | 54 | ret->path = NULL; |
55 | ret->desc = cgit_default_repo_desc; | 55 | ret->desc = cgit_default_repo_desc; |
56 | ret->owner = NULL; | 56 | ret->owner = NULL; |
57 | ret->homepage = NULL; | ||
57 | ret->section = ctx.cfg.section; | 58 | ret->section = ctx.cfg.section; |
58 | ret->snapshots = ctx.cfg.snapshots; | 59 | ret->snapshots = ctx.cfg.snapshots; |
59 | ret->enable_commit_graph = ctx.cfg.enable_commit_graph; | 60 | ret->enable_commit_graph = ctx.cfg.enable_commit_graph; |
diff --git a/ui-shared.c b/ui-shared.c index 03dcc08..2c91e75 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -997,6 +997,11 @@ void cgit_print_pageheader(void) | |||
997 | if (ctx.repo->max_stats) | 997 | if (ctx.repo->max_stats) |
998 | cgit_stats_link("stats", NULL, hc("stats"), | 998 | cgit_stats_link("stats", NULL, hc("stats"), |
999 | ctx.qry.head, ctx.qry.vpath); | 999 | ctx.qry.head, ctx.qry.vpath); |
1000 | if (ctx.repo->homepage) { | ||
1001 | html("<a href='"); | ||
1002 | html_attr(ctx.repo->homepage); | ||
1003 | html("' target='_blank'>homepage</a>"); | ||
1004 | } | ||
1000 | html("</td><td class='form'>"); | 1005 | html("</td><td class='form'>"); |
1001 | html("<form class='right' method='get' action='"); | 1006 | html("<form class='right' method='get' action='"); |
1002 | if (ctx.cfg.virtual_root) { | 1007 | if (ctx.cfg.virtual_root) { |