summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--cgit.css6
-rw-r--r--ui-summary.c2
-rw-r--r--ui-view.c10
3 files changed, 13 insertions, 5 deletions
diff --git a/cgit.css b/cgit.css
index c16f3f2..97b4e27 100644
--- a/cgit.css
+++ b/cgit.css
@@ -41,32 +41,38 @@ img {
41 41
42div#header { 42div#header {
43 background-color: #ddd; 43 background-color: #ddd;
44 padding: 0.25em 0.25em 0.25em 0.5em; 44 padding: 0.25em 0.25em 0.25em 0.5em;
45 font-size: 150%; 45 font-size: 150%;
46 font-weight: bold; 46 font-weight: bold;
47 border: solid 1px #aaa; 47 border: solid 1px #aaa;
48 vertical-align: middle; 48 vertical-align: middle;
49} 49}
50 50
51div#header img#logo { 51div#header img#logo {
52 float: right; 52 float: right;
53} 53}
54 54
55div#content { 55div#content {
56 margin: 0.5em 0.5em; 56 margin: 0.5em 0.5em;
57} 57}
58 58
59div.error { 59div.error {
60 color: red; 60 color: red;
61 font-weight: bold; 61 font-weight: bold;
62 margin: 1em 2em; 62 margin: 1em 2em;
63} 63}
64div.ls-dir a { 64div.ls-dir a {
65 font-weight: bold; 65 font-weight: bold;
66} 66}
67th.filesize, td.filesize { 67th.filesize, td.filesize {
68 text-align: right; 68 text-align: right;
69} 69}
70th.filemode, td.filemode { 70th.filemode, td.filemode {
71 text-align: center; 71 text-align: center;
72} 72}
73
74td.blob {
75 white-space: pre;
76 font-family: courier;
77 font-size: 100%;
78} \ No newline at end of file
diff --git a/ui-summary.c b/ui-summary.c
index 29baa74..46814dd 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -17,44 +17,44 @@ static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1,
17 commit = lookup_commit(sha1); 17 commit = lookup_commit(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='"); 30 html("</td><td><a href='");
31 html_attr(cgit_pageurl(cgit_query_repo, "tree", 31 html_attr(cgit_pageurl(cgit_query_repo, "tree",
32 fmt("id=%s", 32 fmt("id=%s",
33 sha1_to_hex(commit->tree->object.sha1)))); 33 sha1_to_hex(commit->tree->object.sha1))));
34 html("'>tree</a>"); 34 html("'>tree</a>");
35 html("</td></tr>\n"); 35 html("</td></tr>\n");
36 } else { 36 } else {
37 html("<tr><td>"); 37 html("<tr><td>");
38 html_txt(buf); 38 html_txt(buf);
39 html("</td><td>"); 39 html("</td><td>");
40 htmlf("*** bad ref %s", sha1_to_hex(sha1)); 40 htmlf("*** bad ref %s", sha1_to_hex(sha1));
41 html("</td></tr>\n"); 41 html("</td></tr>\n");
42 } 42 }
43 return 0; 43 return 0;
44} 44}
45 45
46static void cgit_print_branches() 46static void cgit_print_branches()
47{ 47{
48 html("<table class='list'>"); 48 html("<table class='list'>");
49 html("<tr><th>Branch name</th><th>Latest</th><th>Link</th></tr>\n"); 49 html("<tr><th>Branch</th><th>Last commit</th><th>Link</th></tr>\n");
50 for_each_branch_ref(cgit_print_branch_cb, NULL); 50 for_each_branch_ref(cgit_print_branch_cb, NULL);
51 html("</table>"); 51 html("</table>");
52} 52}
53 53
54void cgit_print_summary() 54void cgit_print_summary()
55{ 55{
56 html("<h2>"); 56 html("<h2>");
57 html_txt("Repo summary page"); 57 html_txt("Repo summary page");
58 html("</h2>"); 58 html("</h2>");
59 cgit_print_branches(); 59 cgit_print_branches();
60} 60}
diff --git a/ui-view.c b/ui-view.c
index 1bf8472..9d13be1 100644
--- a/ui-view.c
+++ b/ui-view.c
@@ -3,38 +3,40 @@
3 * Copyright (C) 2006 Lars Hjemli 3 * Copyright (C) 2006 Lars Hjemli
4 * 4 *
5 * Licensed under GNU General Public License v2 5 * Licensed under GNU General Public License v2
6 * (see COPYING for full license text) 6 * (see COPYING for full license text)
7 */ 7 */
8 8
9#include "cgit.h" 9#include "cgit.h"
10 10
11void cgit_print_view(char *hex) 11void cgit_print_view(char *hex)
12{ 12{
13 unsigned char sha1[20]; 13 unsigned char sha1[20];
14 char type[20]; 14 char type[20];
15 unsigned char *buf; 15 unsigned char *buf;
16 unsigned long size; 16 unsigned long size;
17 17
18 if (get_sha1_hex(hex, sha1)){ 18 if (get_sha1_hex(hex, sha1)){
19 cgit_print_error(fmt("Bad hex value: %s", hex)); 19 cgit_print_error(fmt("Bad hex value: %s", hex));
20 return; 20 return;
21 } 21 }
22 22
23 if (sha1_object_info(sha1, type, &size)){ 23 if (sha1_object_info(sha1, type, &size)){
24 cgit_print_error("Bad object name"); 24 cgit_print_error("Bad object name");
25 return; 25 return;
26 } 26 }
27 27
28 buf = read_sha1_file(sha1, type, &size); 28 buf = read_sha1_file(sha1, type, &size);
29 if (!buf) { 29 if (!buf) {
30 cgit_print_error("Error reading object"); 30 cgit_print_error("Error reading object");
31 return; 31 return;
32 } 32 }
33 33
34 buf[size] = '\0'; 34 buf[size] = '\0';
35 html("<h2>Object view</h2>"); 35 html("<h2>Object content</h2>\n");
36 htmlf("sha1=%s<br/>type=%s<br/>size=%i<br/>", hex, type, size); 36 html("<table class='list'>\n");
37 html("<pre>"); 37 htmlf("<tr><th>%s %s, %li bytes</th></tr>\n", type, hex, size);
38 html("<tr><td class='blob'>\n");
38 html_txt(buf); 39 html_txt(buf);
39 html("</pre>"); 40 html("\n</td></tr>\n");
41 html("</table>\n");
40} 42}