diff options
author | Lukas Fleischer | 2015-03-05 20:41:45 +0100 |
---|---|---|
committer | Jason A. Donenfeld | 2015-03-13 14:52:52 +0100 |
commit | db021a1989a52911557ce6b998c11fbe4a4bea9d (patch) | |
tree | b92c3f017e657cf0ecb38f0259b2021a066a3dd8 /ui-shared.c | |
parent | 7511f4b4df521656d422010b06e2b5b96b21eb84 (diff) | |
download | cgit-db021a1989a52911557ce6b998c11fbe4a4bea9d.tar.gz cgit-db021a1989a52911557ce6b998c11fbe4a4bea9d.tar.bz2 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.c | 41 |
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) | |||
559 | item = lookup_path(list, path); | 559 | item = lookup_path(list, path); |
560 | } | 560 | } |
561 | } | 561 | } |
562 | html("<a "); | 562 | if (item || ctx.repo->module_link) { |
563 | if (class) | 563 | html("<a "); |
564 | htmlf("class='%s' ", class); | 564 | if (class) |
565 | html("href='"); | 565 | htmlf("class='%s' ", class); |
566 | if (item) { | 566 | html("href='"); |
567 | html_attrf(item->util, rev); | 567 | if (item) { |
568 | } else if (ctx.repo->module_link) { | 568 | html_attrf(item->util, rev); |
569 | dir = strrchr(path, '/'); | 569 | } else { |
570 | if (dir) | 570 | dir = strrchr(path, '/'); |
571 | dir++; | 571 | if (dir) |
572 | else | 572 | dir++; |
573 | dir = path; | 573 | else |
574 | html_attrf(ctx.repo->module_link, dir, rev); | 574 | dir = path; |
575 | html_attrf(ctx.repo->module_link, dir, rev); | ||
576 | } | ||
577 | html("'>"); | ||
578 | html_txt(path); | ||
579 | html("</a>"); | ||
575 | } else { | 580 | } else { |
576 | html("#"); | 581 | html("<span"); |
582 | if (class) | ||
583 | htmlf(" class='%s'", class); | ||
584 | html(">"); | ||
585 | html_txt(path); | ||
586 | html("</span>"); | ||
577 | } | 587 | } |
578 | html("'>"); | ||
579 | html_txt(path); | ||
580 | html("</a>"); | ||
581 | html_txtf(" @ %.7s", rev); | 588 | html_txtf(" @ %.7s", rev); |
582 | if (item && tail) | 589 | if (item && tail) |
583 | path[len - 1] = tail; | 590 | path[len - 1] = tail; |