mirror of
https://git.zx2c4.com/cgit
synced 2024-11-09 10:08:42 +00:00
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>
This commit is contained in:
parent
7511f4b4df
commit
db021a1989
2
cgit.css
2
cgit.css
@ -254,7 +254,7 @@ div#cgit div.error {
|
|||||||
margin: 1em 2em;
|
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;
|
font-family: monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
41
ui-shared.c
41
ui-shared.c
@ -559,25 +559,32 @@ void cgit_submodule_link(const char *class, char *path, const char *rev)
|
|||||||
item = lookup_path(list, path);
|
item = lookup_path(list, path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
html("<a ");
|
if (item || ctx.repo->module_link) {
|
||||||
if (class)
|
html("<a ");
|
||||||
htmlf("class='%s' ", class);
|
if (class)
|
||||||
html("href='");
|
htmlf("class='%s' ", class);
|
||||||
if (item) {
|
html("href='");
|
||||||
html_attrf(item->util, rev);
|
if (item) {
|
||||||
} else if (ctx.repo->module_link) {
|
html_attrf(item->util, rev);
|
||||||
dir = strrchr(path, '/');
|
} else {
|
||||||
if (dir)
|
dir = strrchr(path, '/');
|
||||||
dir++;
|
if (dir)
|
||||||
else
|
dir++;
|
||||||
dir = path;
|
else
|
||||||
html_attrf(ctx.repo->module_link, dir, rev);
|
dir = path;
|
||||||
|
html_attrf(ctx.repo->module_link, dir, rev);
|
||||||
|
}
|
||||||
|
html("'>");
|
||||||
|
html_txt(path);
|
||||||
|
html("</a>");
|
||||||
} else {
|
} 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);
|
html_txtf(" @ %.7s", rev);
|
||||||
if (item && tail)
|
if (item && tail)
|
||||||
path[len - 1] = tail;
|
path[len - 1] = tail;
|
||||||
|
Loading…
Reference in New Issue
Block a user