aboutsummaryrefslogtreecommitdiffstats
path: root/ui-tree.c
diff options
context:
space:
mode:
authorGravatar Martin Szulecki <opensuse@sukimashita.com>2009-08-07 21:06:02 (JST)
committerGravatar Martin Szulecki <opensuse@sukimashita.com>2009-08-08 21:23:34 (JST)
commitb4c3562f57c924866314d0f80f46dddecd4ce61a (patch)
treea720b48fa2f32458b6d1a80808f329cc90e233fe /ui-tree.c
parent2f56e390f04fe6975b75e512c1436ef173e4aafe (diff)
downloadcgit-b4c3562f57c924866314d0f80f46dddecd4ce61a.zip
cgit-b4c3562f57c924866314d0f80f46dddecd4ce61a.tar.gz
Expose file extension in tree lists as class to allow nicer tree styling
Signed-off-by: Martin Szulecki <opensuse@sukimashita.com>
Diffstat (limited to 'ui-tree.c')
-rw-r--r--ui-tree.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ui-tree.c b/ui-tree.c
index 553dbaa..61fcf5a 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -103,6 +103,7 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen,
103{ 103{
104 char *name; 104 char *name;
105 char *fullpath; 105 char *fullpath;
106 char *class;
106 enum object_type type; 107 enum object_type type;
107 unsigned long size = 0; 108 unsigned long size = 0;
108 109
@@ -135,7 +136,12 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen,
135 cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head, 136 cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head,
136 curr_rev, fullpath); 137 curr_rev, fullpath);
137 } else { 138 } else {
138 cgit_tree_link(name, NULL, "ls-blob", ctx.qry.head, 139 class = strrchr(name, '.');
140 if (class != NULL) {
141 class = fmt("ls-blob %s", class + 1);
142 } else
143 class = "ls-blob";
144 cgit_tree_link(name, NULL, class, ctx.qry.head,
139 curr_rev, fullpath); 145 curr_rev, fullpath);
140 } 146 }
141 htmlf("</td><td class='ls-size'>%li</td>", size); 147 htmlf("</td><td class='ls-size'>%li</td>", size);