aboutsummaryrefslogtreecommitdiffstats
path: root/ui-shared.c
diff options
context:
space:
mode:
authorLukas Fleischer <cgit@cryptocrack.de>2015-03-05 20:41:45 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2015-03-13 14:52:52 +0100
commitdb021a1989a52911557ce6b998c11fbe4a4bea9d (patch)
treeb92c3f017e657cf0ecb38f0259b2021a066a3dd8 /ui-shared.c
parentfilters: Add sample gentoo script (diff)
downloadcgit-db021a1989a52911557ce6b998c11fbe4a4bea9d.tar.xz
cgit-db021a1989a52911557ce6b998c11fbe4a4bea9d.zip
Remove no-op link from submodule entries
Instead of linking to the current page ("href='#'"), do not add a link to a submodule entry at all if the module-link setting is not used. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Diffstat (limited to 'ui-shared.c')
-rw-r--r--ui-shared.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 23a893b..1dd8722 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -559,25 +559,32 @@ void cgit_submodule_link(const char *class, char *path, const char *rev)
item = lookup_path(list, path);
}
}
- html("<a ");
- if (class)
- htmlf("class='%s' ", class);
- html("href='");
- if (item) {
- html_attrf(item->util, rev);
- } else if (ctx.repo->module_link) {
- dir = strrchr(path, '/');
- if (dir)
- dir++;
- else
- dir = path;
- html_attrf(ctx.repo->module_link, dir, rev);
+ if (item || ctx.repo->module_link) {
+ html("<a ");
+ if (class)
+ htmlf("class='%s' ", class);
+ html("href='");
+ if (item) {
+ html_attrf(item->util, rev);
+ } else {
+ dir = strrchr(path, '/');
+ if (dir)
+ dir++;
+ else
+ dir = path;
+ html_attrf(ctx.repo->module_link, dir, rev);
+ }
+ html("'>");
+ html_txt(path);
+ html("</a>");
} else {
- html("#");
+ html("<span");
+ if (class)
+ htmlf(" class='%s'", class);
+ html(">");
+ html_txt(path);
+ html("</span>");
}
- html("'>");
- html_txt(path);
- html("</a>");
html_txtf(" @ %.7s", rev);
if (item && tail)
path[len - 1] = tail;