summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.css4
-rw-r--r--ui-tree.c11
2 files changed, 9 insertions, 6 deletions
diff --git a/cgit.css b/cgit.css
index ae304fa..5f01926 100644
--- a/cgit.css
+++ b/cgit.css
@@ -1,166 +1,166 @@
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 1em; 6 margin: 0.5em 1em;
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
16a { 16a {
17 color: blue; 17 color: blue;
18 text-decoration: none; 18 text-decoration: none;
19} 19}
20 20
21a:hover { 21a:hover {
22 text-decoration: underline; 22 text-decoration: underline;
23} 23}
24 24
25table.list { 25table.list {
26 border: solid 1px black; 26 border: solid 1px black;
27 border-collapse: collapse; 27 border-collapse: collapse;
28 border: solid 1px #aaa; 28 border: solid 1px #aaa;
29} 29}
30table.list tr { 30table.list tr {
31 background: white; 31 background: white;
32} 32}
33table.list tr:hover { 33table.list tr:hover {
34 background: #eee; 34 background: #eee;
35} 35}
36table.list th { 36table.list th {
37 font-weight: bold; 37 font-weight: bold;
38 background: #ddd; 38 background: #ddd;
39 border-bottom: solid 1px #aaa; 39 border-bottom: solid 1px #aaa;
40 padding: 0.1em 0.5em 0.1em 0.5em; 40 padding: 0.1em 0.5em 0.1em 0.5em;
41 vertical-align: baseline; 41 vertical-align: baseline;
42} 42}
43table.list td { 43table.list td {
44 border: none; 44 border: none;
45 padding: 0.1em 0.5em 0.1em 0.5em; 45 padding: 0.1em 0.5em 0.1em 0.5em;
46} 46}
47img { 47img {
48 border: none; 48 border: none;
49} 49}
50 50
51 51
52div#header { 52div#header {
53 background-color: #eee; 53 background-color: #eee;
54 padding: 0.25em 0.25em 0.25em 0.5em; 54 padding: 0.25em 0.25em 0.25em 0.5em;
55 font-size: 150%; 55 font-size: 150%;
56 font-weight: bold; 56 font-weight: bold;
57 border: solid 1px #ccc; 57 border: solid 1px #ccc;
58 vertical-align: middle; 58 vertical-align: middle;
59} 59}
60div#header img#logo { 60div#header img#logo {
61 float: right; 61 float: right;
62} 62}
63div#header a { 63div#header a {
64 color: black; 64 color: black;
65} 65}
66 66
67div#content { 67div#content {
68 margin: 0.5em 0.5em; 68 margin: 0.5em 0.5em;
69} 69}
70 70
71div#blob { 71div#blob {
72 border: solid 1px black; 72 border: solid 1px black;
73} 73}
74 74
75div.error { 75div.error {
76 color: red; 76 color: red;
77 font-weight: bold; 77 font-weight: bold;
78 margin: 1em 2em; 78 margin: 1em 2em;
79} 79}
80div.ls-dir a { 80div.ls-dir a {
81 font-weight: bold; 81 font-weight: bold;
82} 82}
83th.filesize, td.filesize { 83th.filesize, td.filesize {
84 text-align: right; 84 text-align: right;
85} 85}
86th.filemode, td.filemode { 86td.filemode {
87 text-align: center; 87 font-family: monospace;
88} 88}
89 89
90td.blob { 90td.blob {
91 white-space: pre; 91 white-space: pre;
92 font-family: courier; 92 font-family: courier;
93 font-size: 100%; 93 font-size: 100%;
94 background-color: white; 94 background-color: white;
95} 95}
96 96
97table.log td { 97table.log td {
98 white-space: nowrap; 98 white-space: nowrap;
99} 99}
100 100
101table.commit-info { 101table.commit-info {
102 border-collapse: collapse; 102 border-collapse: collapse;
103 margin-top: 1.5em; 103 margin-top: 1.5em;
104} 104}
105table.commit-info th { 105table.commit-info th {
106 text-align: left; 106 text-align: left;
107 font-weight: normal; 107 font-weight: normal;
108 padding: 0.1em 1em 0.1em 0.1em; 108 padding: 0.1em 1em 0.1em 0.1em;
109} 109}
110table.commit-info td { 110table.commit-info td {
111 font-weight: normal; 111 font-weight: normal;
112 padding: 0.1em 1em 0.1em 0.1em; 112 padding: 0.1em 1em 0.1em 0.1em;
113} 113}
114div.commit-subject { 114div.commit-subject {
115 font-weight: bold; 115 font-weight: bold;
116 font-size: 125%; 116 font-size: 125%;
117 margin: 1.5em 0em 0.5em 0em; 117 margin: 1.5em 0em 0.5em 0em;
118 padding: 0em; 118 padding: 0em;
119} 119}
120div.commit-msg { 120div.commit-msg {
121 white-space: pre; 121 white-space: pre;
122 font-family: monospace; 122 font-family: monospace;
123} 123}
124table.diffstat { 124table.diffstat {
125 border-collapse: collapse; 125 border-collapse: collapse;
126 margin-top: 1.5em; 126 margin-top: 1.5em;
127} 127}
128table.diffstat th { 128table.diffstat th {
129 font-weight: normal; 129 font-weight: normal;
130 text-align: left; 130 text-align: left;
131 text-decoration: underline; 131 text-decoration: underline;
132 padding: 0.1em 1em 0.1em 0.1em; 132 padding: 0.1em 1em 0.1em 0.1em;
133 font-size: 100%; 133 font-size: 100%;
134} 134}
135table.diffstat td { 135table.diffstat td {
136 padding: 0.1em 1em 0.1em 0.1em; 136 padding: 0.1em 1em 0.1em 0.1em;
137 font-size: 100%; 137 font-size: 100%;
138} 138}
139table.diffstat td span.modechange { 139table.diffstat td span.modechange {
140 padding-left: 1em; 140 padding-left: 1em;
141 color: red; 141 color: red;
142} 142}
143table.diffstat td.add a { 143table.diffstat td.add a {
144 color: green; 144 color: green;
145} 145}
146table.diffstat td.del a { 146table.diffstat td.del a {
147 color: red; 147 color: red;
148} 148}
149table.diffstat td.upd a { 149table.diffstat td.upd a {
150 color: blue; 150 color: blue;
151} 151}
152table.diffstat td.summary { 152table.diffstat td.summary {
153 /* border-top: solid 1px black; */ 153 /* border-top: solid 1px black; */
154 color: #888; 154 color: #888;
155 padding-top: 0.5em; 155 padding-top: 0.5em;
156} 156}
157.sha1 { 157.sha1 {
158 font-family: courier; 158 font-family: courier;
159 font-size: 90%; 159 font-size: 90%;
160} 160}
161.left { 161.left {
162 text-align: left; 162 text-align: left;
163} 163}
164.right { 164.right {
165 text-align: right; 165 text-align: right;
166} 166}
diff --git a/ui-tree.c b/ui-tree.c
index c4d75ab..54dcdbe 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -1,70 +1,73 @@
1/* ui-tree.c: functions for tree output 1/* ui-tree.c: functions for tree output
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
11 11
12static int print_entry(const unsigned char *sha1, const char *base, 12static int print_entry(const unsigned char *sha1, const char *base,
13 int baselen, const char *pathname, unsigned int mode, 13 int baselen, const char *pathname, unsigned int mode,
14 int stage) 14 int stage)
15{ 15{
16 char *name; 16 char *name;
17 char type[20]; 17 char type[20];
18 unsigned long size; 18 unsigned long size;
19 19
20 if (sha1_object_info(sha1, type, &size)) { 20 if (sha1_object_info(sha1, type, &size)) {
21 cgit_print_error(fmt("Bad object name: %s", 21 cgit_print_error(fmt("Bad object name: %s",
22 sha1_to_hex(sha1))); 22 sha1_to_hex(sha1)));
23 return 0; 23 return 0;
24 } 24 }
25 name = xstrdup(pathname); 25 name = xstrdup(pathname);
26 html("<tr><td>"); 26 html("<tr><td class='filemode'>");
27 html_filemode(mode);
28 html("</td><td>");
27 if (S_ISDIR(mode)) { 29 if (S_ISDIR(mode)) {
28 html("<div class='ls-dir'><a href='"); 30 html("<div class='ls-dir'><a href='");
29 html_attr(cgit_pageurl(cgit_query_repo, "tree", 31 html_attr(cgit_pageurl(cgit_query_repo, "tree",
30 fmt("id=%s", sha1_to_hex(sha1)))); 32 fmt("id=%s", sha1_to_hex(sha1))));
31 } else { 33 } else {
32 html("<div class='ls-blob'><a href='"); 34 html("<div class='ls-blob'><a href='");
33 html_attr(cgit_pageurl(cgit_query_repo, "view", 35 html_attr(cgit_pageurl(cgit_query_repo, "view",
34 fmt("id=%s", sha1_to_hex(sha1)))); 36 fmt("id=%s", sha1_to_hex(sha1))));
35 } 37 }
36 html("'>"); 38 html("'>");
37 html_txt(name); 39 html_txt(name);
38 if (S_ISDIR(mode)) 40 if (S_ISDIR(mode))
39 html("/"); 41 html("/");
40 html("</a></div></td>"); 42 html("</a></div></td>");
41 htmlf("<td class='filesize'>%li</td>", size); 43 htmlf("<td class='filesize'>%li</td>", size);
42 htmlf("<td class='filemode'>%06o</td>", mode);
43 html("</tr>\n"); 44 html("</tr>\n");
44 free(name); 45 free(name);
45 return 0; 46 return 0;
46} 47}
47 48
48void cgit_print_tree(const char *hex) 49void cgit_print_tree(const char *hex)
49{ 50{
50 struct tree *tree; 51 struct tree *tree;
51 unsigned char sha1[20]; 52 unsigned char sha1[20];
52 53
53 if (get_sha1_hex(hex, sha1)) { 54 if (get_sha1_hex(hex, sha1)) {
54 cgit_print_error(fmt("Invalid object id: %s", hex)); 55 cgit_print_error(fmt("Invalid object id: %s", hex));
55 return; 56 return;
56 } 57 }
57 tree = parse_tree_indirect(sha1); 58 tree = parse_tree_indirect(sha1);
58 if (!tree) { 59 if (!tree) {
59 cgit_print_error(fmt("Not a tree object: %s", hex)); 60 cgit_print_error(fmt("Not a tree object: %s", hex));
60 return; 61 return;
61 } 62 }
62 63
63 html("<h2>Tree content</h2>\n"); 64 html("<h2>Tree content</h2>\n");
64 html("<table class='list'>\n"); 65 html("<table class='list'>\n");
65 html("<tr><th class='left'>Name</th>"); 66 html("<tr>");
67 html("<th class='left'>Mode</th>");
68 html("<th class='left'>Name</th>");
66 html("<th class='right'>Size</th>"); 69 html("<th class='right'>Size</th>");
67 html("<th class='right'>Mode</th></tr>\n"); 70 html("</tr>\n");
68 read_tree_recursive(tree, "", 0, 1, NULL, print_entry); 71 read_tree_recursive(tree, "", 0, 1, NULL, print_entry);
69 html("</table>\n"); 72 html("</table>\n");
70} 73}