]> granicus.if.org Git - cgit/commitdiff
Remove no-op link from submodule entries
authorLukas Fleischer <cgit@cryptocrack.de>
Thu, 5 Mar 2015 19:41:45 +0000 (20:41 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Fri, 13 Mar 2015 13:52:52 +0000 (14:52 +0100)
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>
cgit.css
ui-shared.c

index 6888cde733d485d31e416c4c0de7b5e6a5985a62..82c755cfeabe6d3bad303d4e0e1d540ad19956f1 100644 (file)
--- a/cgit.css
+++ b/cgit.css
@@ -254,7 +254,7 @@ div#cgit div.error {
        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;
 }
 
index 23a893be1cb6cab351adf596c26aa4f8637d9911..1dd872264504c555bd0b7ee2784301c162eb28fa 100644 (file)
@@ -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;