all repos — cgit @ b4c3562f57c924866314d0f80f46dddecd4ce61a

a hyperfast web frontend for git written in c

Expose file extension in tree lists as class to allow nicer tree styling

Signed-off-by: Martin Szulecki <opensuse@sukimashita.com>
Martin Szulecki opensuse@sukimashita.com
Fri, 07 Aug 2009 14:06:02 +0200
commit

b4c3562f57c924866314d0f80f46dddecd4ce61a

parent

2f56e390f04fe6975b75e512c1436ef173e4aafe

1 files changed, 7 insertions(+), 1 deletions(-)

jump to
M ui-tree.cui-tree.c

@@ -103,6 +103,7 @@ void *cbdata)

{ char *name; char *fullpath; + char *class; enum object_type type; unsigned long size = 0;

@@ -135,7 +136,12 @@ } else if (S_ISDIR(mode)) {

cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head, curr_rev, fullpath); } else { - cgit_tree_link(name, NULL, "ls-blob", ctx.qry.head, + class = strrchr(name, '.'); + if (class != NULL) { + class = fmt("ls-blob %s", class + 1); + } else + class = "ls-blob"; + cgit_tree_link(name, NULL, class, ctx.qry.head, curr_rev, fullpath); } htmlf("</td><td class='ls-size'>%li</td>", size);