all repos — cgit @ db021a1989a52911557ce6b998c11fbe4a4bea9d

a hyperfast web frontend for git written in c

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>
Lukas Fleischer cgit@cryptocrack.de
Thu, 05 Mar 2015 20:41:45 +0100
commit

db021a1989a52911557ce6b998c11fbe4a4bea9d

parent

7511f4b4df521656d422010b06e2b5b96b21eb84

2 files changed, 25 insertions(+), 18 deletions(-)

jump to
M cgit.csscgit.css

@@ -254,7 +254,7 @@ font-weight: bold;

margin: 1em 2em; } -div#cgit a.ls-blob, div#cgit a.ls-dir, div#cgit a.ls-mod { +div#cgit a.ls-blob, div#cgit a.ls-dir, div#cgit .ls-mod { font-family: monospace; }
M ui-shared.cui-shared.c

@@ -559,25 +559,32 @@ path[len - 1] = 0;

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;