summaryrefslogtreecommitdiffabout
authorLars Hjemli <hjemli@gmail.com>2006-12-12 23:36:22 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2006-12-12 23:36:22 (UTC)
commit9c2e863ec22ce552f1a2e06c6c9e3d77368b0e87 (patch) (unidiff)
tree9c274a102df9a26e54e7ed3b833c5e2ab428cff9
parent06fe0c2f47eaf467db8ab1443e61dfa1c280f30a (diff)
downloadcgit-9c2e863ec22ce552f1a2e06c6c9e3d77368b0e87.zip
cgit-9c2e863ec22ce552f1a2e06c6c9e3d77368b0e87.tar.gz
cgit-9c2e863ec22ce552f1a2e06c6c9e3d77368b0e87.tar.bz2
Small layout adjustments to summary and blob view
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (more/less context) (ignore 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
@@ -1,72 +1,78 @@
1body { 1body {
2 font-family: arial; 2 font-family: arial;
3 font-size: normal; 3 font-size: normal;
4 background: white; 4 background: white;
5 padding: 0em; 5 padding: 0em;
6 margin: 0.5em; 6 margin: 0.5em;
7} 7}
8 8
9 9
10h2 { 10h2 {
11 font-size: normal; 11 font-size: normal;
12 font-weight: bold; 12 font-weight: bold;
13 margin-bottom: 0.1em; 13 margin-bottom: 0.1em;
14} 14}
15 15
16 16
17table.list { 17table.list {
18 border: solid 1px black; 18 border: solid 1px black;
19 border-collapse: collapse; 19 border-collapse: collapse;
20 border: solid 1px #aaa; 20 border: solid 1px #aaa;
21} 21}
22 22
23table.list th { 23table.list th {
24 text-align: left; 24 text-align: left;
25 font-weight: bold; 25 font-weight: bold;
26 background: #ddd; 26 background: #ddd;
27 border-bottom: solid 1px #aaa; 27 border-bottom: solid 1px #aaa;
28 padding: 0.1em 0.5em 0.1em; 28 padding: 0.1em 0.5em 0.1em;
29 vertical-align: baseline; 29 vertical-align: baseline;
30} 30}
31table.list td { 31table.list td {
32 border: none; 32 border: none;
33 padding: 0.1em 1em 0.1em 0.5em; 33 padding: 0.1em 1em 0.1em 0.5em;
34 background: white; 34 background: white;
35} 35}
36 36
37img { 37img {
38 border: none; 38 border: none;
39} 39}
40 40
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
@@ -1,60 +1,60 @@
1/* ui-summary.c: functions for generating repo summary page 1/* ui-summary.c: functions for generating repo summary page
2 * 2 *
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
11static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1, 11static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1,
12 int flags, void *cb_data) 12 int flags, void *cb_data)
13{ 13{
14 struct commit *commit; 14 struct commit *commit;
15 char buf[256], *url; 15 char buf[256], *url;
16 16
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
@@ -1,40 +1,42 @@
1/* ui-view.c: functions to output _any_ object, given it's sha1 1/* ui-view.c: functions to output _any_ object, given it's sha1
2 * 2 *
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}