author | Lars Hjemli <hjemli@gmail.com> | 2010-02-28 21:18:00 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2010-02-28 21:18:00 (UTC) |
commit | ff3a3b4e2b7463bb8cb370bdda393e8b3526fcb9 (patch) (unidiff) | |
tree | 56a3033b87891fabd2396307fd61faa28bb8fbfa | |
parent | c151ce61d87c577ac8a067523a406938c557d650 (diff) | |
download | cgit-ff3a3b4e2b7463bb8cb370bdda393e8b3526fcb9.zip cgit-ff3a3b4e2b7463bb8cb370bdda393e8b3526fcb9.tar.gz cgit-ff3a3b4e2b7463bb8cb370bdda393e8b3526fcb9.tar.bz2 |
ui-tree: add link to plain view for blobs in tree listing
Suggested-by: Robert Weidlich <mail@robertweidlich.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-tree.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -154,48 +154,50 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen, | |||
154 | sha1_to_hex(sha1))); | 154 | sha1_to_hex(sha1))); |
155 | html("'>"); | 155 | html("'>"); |
156 | html_txt(name); | 156 | html_txt(name); |
157 | html("</a>"); | 157 | html("</a>"); |
158 | } else if (S_ISDIR(mode)) { | 158 | } else if (S_ISDIR(mode)) { |
159 | cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head, | 159 | cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head, |
160 | curr_rev, fullpath); | 160 | curr_rev, fullpath); |
161 | } else { | 161 | } else { |
162 | class = strrchr(name, '.'); | 162 | class = strrchr(name, '.'); |
163 | if (class != NULL) { | 163 | if (class != NULL) { |
164 | class = fmt("ls-blob %s", class + 1); | 164 | class = fmt("ls-blob %s", class + 1); |
165 | } else | 165 | } else |
166 | class = "ls-blob"; | 166 | class = "ls-blob"; |
167 | cgit_tree_link(name, NULL, class, ctx.qry.head, | 167 | cgit_tree_link(name, NULL, class, ctx.qry.head, |
168 | curr_rev, fullpath); | 168 | curr_rev, fullpath); |
169 | } | 169 | } |
170 | htmlf("</td><td class='ls-size'>%li</td>", size); | 170 | htmlf("</td><td class='ls-size'>%li</td>", size); |
171 | 171 | ||
172 | html("<td>"); | 172 | html("<td>"); |
173 | cgit_log_link("log", NULL, "button", ctx.qry.head, curr_rev, | 173 | cgit_log_link("log", NULL, "button", ctx.qry.head, curr_rev, |
174 | fullpath, 0, NULL, NULL, ctx.qry.showmsg); | 174 | fullpath, 0, NULL, NULL, ctx.qry.showmsg); |
175 | if (ctx.repo->max_stats) | 175 | if (ctx.repo->max_stats) |
176 | cgit_stats_link("stats", NULL, "button", ctx.qry.head, | 176 | cgit_stats_link("stats", NULL, "button", ctx.qry.head, |
177 | fullpath); | 177 | fullpath); |
178 | cgit_plain_link("plain", NULL, "button", ctx.qry.head, curr_rev, | ||
179 | fullpath); | ||
178 | html("</td></tr>\n"); | 180 | html("</td></tr>\n"); |
179 | free(name); | 181 | free(name); |
180 | return 0; | 182 | return 0; |
181 | } | 183 | } |
182 | 184 | ||
183 | static void ls_head() | 185 | static void ls_head() |
184 | { | 186 | { |
185 | html("<table summary='tree listing' class='list'>\n"); | 187 | html("<table summary='tree listing' class='list'>\n"); |
186 | html("<tr class='nohover'>"); | 188 | html("<tr class='nohover'>"); |
187 | html("<th class='left'>Mode</th>"); | 189 | html("<th class='left'>Mode</th>"); |
188 | html("<th class='left'>Name</th>"); | 190 | html("<th class='left'>Name</th>"); |
189 | html("<th class='right'>Size</th>"); | 191 | html("<th class='right'>Size</th>"); |
190 | html("<th/>"); | 192 | html("<th/>"); |
191 | html("</tr>\n"); | 193 | html("</tr>\n"); |
192 | header = 1; | 194 | header = 1; |
193 | } | 195 | } |
194 | 196 | ||
195 | static void ls_tail() | 197 | static void ls_tail() |
196 | { | 198 | { |
197 | if (!header) | 199 | if (!header) |
198 | return; | 200 | return; |
199 | html("</table>\n"); | 201 | html("</table>\n"); |
200 | header = 0; | 202 | header = 0; |
201 | } | 203 | } |