author | Lars Hjemli <hjemli@gmail.com> | 2006-12-12 23:13:27 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2006-12-12 23:13:27 (UTC) |
commit | 06fe0c2f47eaf467db8ab1443e61dfa1c280f30a (patch) (unidiff) | |
tree | 481164eeeeb5ca3302f7b3d38d1debbad9db9296 /ui-summary.c | |
parent | 58d04f6523b0029281d65f841859fa42d0c744ff (diff) | |
download | cgit-06fe0c2f47eaf467db8ab1443e61dfa1c280f30a.zip cgit-06fe0c2f47eaf467db8ab1443e61dfa1c280f30a.tar.gz cgit-06fe0c2f47eaf467db8ab1443e61dfa1c280f30a.tar.bz2 |
Add display of tree content w/ui-tree.c
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-summary.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ui-summary.c b/ui-summary.c index cc918ad..29baa74 100644 --- a/ui-summary.c +++ b/ui-summary.c | |||
@@ -18,38 +18,43 @@ static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1, | |||
18 | if (commit && !parse_commit(commit)){ | 18 | if (commit && !parse_commit(commit)){ |
19 | html("<tr><td>"); | 19 | html("<tr><td>"); |
20 | url = cgit_pageurl(cgit_query_repo, "log", | 20 | url = cgit_pageurl(cgit_query_repo, "log", |
21 | fmt("h=%s", refname)); | 21 | fmt("h=%s", refname)); |
22 | html_link_open(url, NULL, NULL); | 22 | html_link_open(url, NULL, NULL); |
23 | strncpy(buf, refname, sizeof(buf)); | 23 | strncpy(buf, refname, sizeof(buf)); |
24 | html_txt(buf); | 24 | html_txt(buf); |
25 | html_link_close(); | 25 | html_link_close(); |
26 | html("</td><td>"); | 26 | html("</td><td>"); |
27 | pretty_print_commit(CMIT_FMT_ONELINE, commit, ~0, buf, | 27 | pretty_print_commit(CMIT_FMT_ONELINE, commit, ~0, buf, |
28 | sizeof(buf), 0, NULL, NULL, 0); | 28 | sizeof(buf), 0, NULL, NULL, 0); |
29 | html_txt(buf); | 29 | html_txt(buf); |
30 | html("</td><td><a href='"); | ||
31 | html_attr(cgit_pageurl(cgit_query_repo, "tree", | ||
32 | fmt("id=%s", | ||
33 | sha1_to_hex(commit->tree->object.sha1)))); | ||
34 | html("'>tree</a>"); | ||
30 | html("</td></tr>\n"); | 35 | html("</td></tr>\n"); |
31 | } else { | 36 | } else { |
32 | html("<tr><td>"); | 37 | html("<tr><td>"); |
33 | html_txt(buf); | 38 | html_txt(buf); |
34 | html("</td><td>"); | 39 | html("</td><td>"); |
35 | htmlf("*** bad ref %s", sha1_to_hex(sha1)); | 40 | htmlf("*** bad ref %s", sha1_to_hex(sha1)); |
36 | html("</td></tr>\n"); | 41 | html("</td></tr>\n"); |
37 | } | 42 | } |
38 | return 0; | 43 | return 0; |
39 | } | 44 | } |
40 | 45 | ||
41 | static void cgit_print_branches() | 46 | static void cgit_print_branches() |
42 | { | 47 | { |
43 | html("<table class='list'>"); | 48 | html("<table class='list'>"); |
44 | html("<tr><th>Branch name</th><th>Head commit</th></tr>\n"); | 49 | html("<tr><th>Branch name</th><th>Latest</th><th>Link</th></tr>\n"); |
45 | for_each_branch_ref(cgit_print_branch_cb, NULL); | 50 | for_each_branch_ref(cgit_print_branch_cb, NULL); |
46 | html("</table>"); | 51 | html("</table>"); |
47 | } | 52 | } |
48 | 53 | ||
49 | void cgit_print_summary() | 54 | void cgit_print_summary() |
50 | { | 55 | { |
51 | html("<h2>"); | 56 | html("<h2>"); |
52 | html_txt("Repo summary page"); | 57 | html_txt("Repo summary page"); |
53 | html("</h2>"); | 58 | html("</h2>"); |
54 | cgit_print_branches(); | 59 | cgit_print_branches(); |
55 | } | 60 | } |