diff options
-rw-r--r-- | cgit.css | 190 | ||||
-rw-r--r-- | cgit.h | 7 | ||||
-rw-r--r-- | cgit.png | bin | 5406 -> 1840 bytes | |||
-rw-r--r-- | ui-commit.c | 14 | ||||
-rw-r--r-- | ui-repolist.c | 51 | ||||
-rw-r--r-- | ui-shared.c | 154 | ||||
-rw-r--r-- | ui-shared.h | 2 |
7 files changed, 238 insertions, 180 deletions
diff --git a/cgit.css b/cgit.css index 17c2712..8f3d00c 100644 --- a/cgit.css +++ b/cgit.css | |||
@@ -11,142 +11,141 @@ body { | |||
11 | padding: 4px; | 11 | padding: 4px; |
12 | } | 12 | } |
13 | 13 | ||
14 | a { | ||
15 | color: blue; | ||
16 | text-decoration: none; | ||
17 | } | ||
18 | |||
19 | a:hover { | ||
20 | text-decoration: underline; | ||
21 | } | ||
22 | |||
14 | table { | 23 | table { |
15 | border-collapse: collapse; | 24 | border-collapse: collapse; |
16 | } | 25 | } |
17 | 26 | ||
18 | h2 { | 27 | table#header { |
19 | font-size: 120%; | 28 | width: 100%; |
20 | font-weight: bold; | 29 | margin-bottom: 1em; |
21 | margin-top: 0em; | ||
22 | margin-bottom: 0.25em; | ||
23 | } | 30 | } |
24 | 31 | ||
25 | h3 { | 32 | table#header td.logo { |
26 | margin-top: 0em; | 33 | width: 96px; |
27 | font-size: 100%; | ||
28 | font-weight: normal; | ||
29 | } | 34 | } |
30 | 35 | ||
31 | h4 { | 36 | table#header td.main { |
32 | margin-top: 1.5em; | 37 | font-size: 250%; |
33 | margin-bottom: 0.1em; | 38 | padding-left: 10px; |
34 | font-size: 100%; | ||
35 | font-weight: bold; | ||
36 | } | 39 | } |
37 | 40 | ||
38 | a { | 41 | table#header td.main a { |
39 | color: #600; | 42 | color: #000; |
40 | text-decoration: none; | ||
41 | } | 43 | } |
42 | 44 | ||
43 | a:hover { | 45 | table#header td.form { |
44 | background-color: #ddd; | 46 | text-align: right; |
45 | text-decoration: none; | 47 | vertical-align: bottom; |
48 | padding-right: 1em; | ||
49 | padding-bottom: 2px; | ||
46 | } | 50 | } |
47 | 51 | ||
48 | table.list { | 52 | table#header td.form form, |
49 | border: none; | 53 | table#header td.form input, |
50 | border-collapse: collapse; | 54 | table#header td.form select { |
55 | font-size: 90%; | ||
51 | } | 56 | } |
52 | 57 | ||
53 | table.list tr { | 58 | table#header td.sub { |
54 | background: white; | 59 | color: #777; |
60 | border-top: solid 1px #ccc; | ||
61 | padding-left: 10px; | ||
55 | } | 62 | } |
56 | 63 | ||
57 | table.list tr:hover { | 64 | table.tabs { |
58 | background: #f8f8f8; | 65 | /* border-bottom: solid 2px #ccc; */ |
66 | border-collapse: collapse; | ||
67 | margin-top: 2em; | ||
68 | margin-bottom: 0px; | ||
69 | width: 100%; | ||
59 | } | 70 | } |
60 | 71 | ||
61 | table.list tr.nohover:hover { | 72 | table.tabs td { |
62 | background: white; | 73 | padding: 0px 1em; |
74 | vertical-align: bottom; | ||
63 | } | 75 | } |
64 | 76 | ||
65 | table.list th { | 77 | table.tabs td a { |
66 | font-weight: bold; | 78 | padding: 2px 0.75em; |
67 | border-bottom: solid 1px #777; | 79 | color: #777; |
68 | padding: 0.1em 0.5em 0.1em 0.5em; | 80 | font-size: 110%; |
69 | vertical-align: baseline; | ||
70 | } | 81 | } |
71 | 82 | ||
72 | table.list td { | 83 | table.tabs td a.active { |
73 | border: none; | 84 | color: #000; |
74 | padding: 0.1em 0.5em 0.1em 0.5em; | 85 | background-color: #ccc; |
75 | } | 86 | } |
76 | 87 | ||
77 | img { | 88 | table.tabs td.form { |
78 | border: none; | 89 | text-align: right; |
79 | } | 90 | } |
80 | 91 | ||
81 | table#layout { | 92 | table.tabs td.form form { |
82 | border-collapse: collapse; | 93 | padding-bottom: 2px; |
83 | border: none; | 94 | font-size: 90%; |
84 | margin: 0px; | ||
85 | } | 95 | } |
86 | 96 | ||
87 | td#sidebar { | 97 | table.tabs td.form input, |
88 | vertical-align: top; | 98 | table.tabs td.form select { |
89 | width: 162px; | 99 | font-size: 90%; |
90 | padding: 0px 0px 0px 0px; | ||
91 | margin: 0px; | ||
92 | } | 100 | } |
93 | 101 | ||
94 | td#sidebar table { | 102 | div.content { |
95 | border-collapse: separate; | ||
96 | border-spacing: 0px; | ||
97 | margin: 0px; | 103 | margin: 0px; |
98 | padding: 0px; | 104 | padding: 2em; |
99 | background-color: #ccc; | 105 | border-top: solid 3px #ccc; |
106 | border-bottom: solid 3px #ccc; | ||
100 | } | 107 | } |
101 | 108 | ||
102 | td#sidebar table.sidebar td.sidebar { | 109 | |
103 | padding: 4px; | 110 | table.list { |
104 | border-top: solid 1px #eee; | 111 | width: 100%; |
105 | border-left: solid 1px #eee; | 112 | border: none; |
106 | border-right: solid 1px #aaa; | 113 | border-collapse: collapse; |
107 | border-bottom: solid 1px #aaa; | ||
108 | } | 114 | } |
109 | 115 | ||
110 | div#logo { | 116 | table.list tr { |
111 | margin: 0px; | 117 | background: white; |
112 | padding: 4px 0px 4px 0px; | ||
113 | text-align: center; | ||
114 | background-color: #ccc; | ||
115 | border-top: solid 1px #eee; | ||
116 | border-left: solid 1px #eee; | ||
117 | border-right: solid 1px #aaa; | ||
118 | border-bottom: solid 1px #aaa; | ||
119 | } | 118 | } |
120 | 119 | ||
121 | td#sidebar h1 { | 120 | table.list tr:hover { |
122 | font-size: 10pt; | 121 | background: #eee; |
123 | font-weight: bold; | ||
124 | margin: 8px 0px 0px 0px; | ||
125 | } | 122 | } |
126 | 123 | ||
127 | td#sidebar h1.first { | 124 | table.list tr.nohover:hover { |
128 | margin-top: 0px; | 125 | background: white; |
129 | } | 126 | } |
130 | 127 | ||
131 | td#sidebar a.menu { | 128 | table.list th { |
132 | display: block; | 129 | font-weight: bold; |
133 | background-color: #ccc; | 130 | /* color: #888; |
134 | padding: 0.1em 0.5em; | 131 | border-top: dashed 1px #888; |
135 | text-decoration: none; | 132 | border-bottom: dashed 1px #888; |
133 | */ | ||
134 | padding: 0.1em 0.5em 0.05em 0.5em; | ||
135 | vertical-align: baseline; | ||
136 | } | 136 | } |
137 | 137 | ||
138 | td#sidebar a.menu:hover { | 138 | table.list td { |
139 | background-color: #bbb; | 139 | border: none; |
140 | text-decoration: none; | 140 | padding: 0.1em 0.5em 0.1em 0.5em; |
141 | } | 141 | } |
142 | 142 | ||
143 | td#sidebar select { | 143 | table.list td a { |
144 | width: 100%; | 144 | color: black; |
145 | margin: 2px 0px 0px 0px; | ||
146 | } | 145 | } |
147 | 146 | ||
148 | td#sidebar form { | 147 | img { |
149 | text-align: right; | 148 | border: none; |
150 | } | 149 | } |
151 | 150 | ||
152 | input#switch-btn { | 151 | input#switch-btn { |
@@ -201,14 +200,13 @@ a.ls-blob, a.ls-dir, a.ls-mod { | |||
201 | 200 | ||
202 | td.ls-size { | 201 | td.ls-size { |
203 | text-align: right; | 202 | text-align: right; |
204 | } | ||
205 | |||
206 | td.ls-size { | ||
207 | font-family: monospace; | 203 | font-family: monospace; |
204 | width: 10em; | ||
208 | } | 205 | } |
209 | 206 | ||
210 | td.ls-mode { | 207 | td.ls-mode { |
211 | font-family: monospace; | 208 | font-family: monospace; |
209 | width: 10em; | ||
212 | } | 210 | } |
213 | 211 | ||
214 | table.blob { | 212 | table.blob { |
@@ -357,7 +355,7 @@ table.diff td { | |||
357 | table.diff td div.head { | 355 | table.diff td div.head { |
358 | font-weight: bold; | 356 | font-weight: bold; |
359 | margin-top: 1em; | 357 | margin-top: 1em; |
360 | background-color: #eee; | 358 | color: black; |
361 | } | 359 | } |
362 | 360 | ||
363 | table.diff td div.hunk { | 361 | table.diff td div.hunk { |
@@ -392,17 +390,17 @@ table.list td.repogroup { | |||
392 | 390 | ||
393 | a.button { | 391 | a.button { |
394 | font-size: 80%; | 392 | font-size: 80%; |
395 | color: #aaa; | 393 | color: #33c; |
394 | /* | ||
396 | background-color: #eee; | 395 | background-color: #eee; |
397 | border: solid 1px #aaa; | 396 | border: solid 1px #aaa; |
398 | padding: 0em 0.5em; | ||
399 | margin: 0.1em 0.25em; | 397 | margin: 0.1em 0.25em; |
398 | */ | ||
399 | padding: 0em 0.5em; | ||
400 | } | 400 | } |
401 | 401 | ||
402 | a.button:hover { | 402 | a.button:hover { |
403 | text-decoration: none; | 403 | text-decoration: underline; |
404 | color: #333; | ||
405 | background-color: #ccc; | ||
406 | } | 404 | } |
407 | 405 | ||
408 | a.primary { | 406 | a.primary { |
diff --git a/cgit.h b/cgit.h index ee8c716..a3b6535 100644 --- a/cgit.h +++ b/cgit.h | |||
@@ -221,4 +221,11 @@ extern const char *cgit_repobasename(const char *reponame); | |||
221 | 221 | ||
222 | extern int cgit_parse_snapshots_mask(const char *str); | 222 | extern int cgit_parse_snapshots_mask(const char *str); |
223 | 223 | ||
224 | /* libgit.a either links against or compiles its own implementation of | ||
225 | * strcasestr(), and we'd like to reuse it. Simply re-declaring it | ||
226 | * seems to do the trick. | ||
227 | */ | ||
228 | extern char *strcasestr(const char *haystack, const char *needle); | ||
229 | |||
230 | |||
224 | #endif /* CGIT_H */ | 231 | #endif /* CGIT_H */ |
diff --git a/cgit.png b/cgit.png index 22f7e95..d7f70bc 100644 --- a/cgit.png +++ b/cgit.png | |||
Binary files differ | |||
diff --git a/ui-commit.c b/ui-commit.c index 8019e36..dd36cc0 100644 --- a/ui-commit.c +++ b/ui-commit.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include "cgit.h" | 9 | #include "cgit.h" |
10 | #include "html.h" | 10 | #include "html.h" |
11 | #include "ui-shared.h" | 11 | #include "ui-shared.h" |
12 | #include "ui-diff.h" | ||
12 | 13 | ||
13 | static int files, slots; | 14 | static int files, slots; |
14 | static int total_adds, total_rems, max_changes; | 15 | static int total_adds, total_rems, max_changes; |
@@ -174,6 +175,12 @@ void cgit_print_commit(char *hex) | |||
174 | html("</td><td class='right'>"); | 175 | html("</td><td class='right'>"); |
175 | cgit_print_date(info->committer_date, FMT_LONGDATE); | 176 | cgit_print_date(info->committer_date, FMT_LONGDATE); |
176 | html("</td></tr>\n"); | 177 | html("</td></tr>\n"); |
178 | html("<tr><th>commit</th><td colspan='2' class='sha1'>"); | ||
179 | tmp = sha1_to_hex(commit->object.sha1); | ||
180 | cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp); | ||
181 | html(" ("); | ||
182 | cgit_patch_link("patch", NULL, NULL, NULL, tmp); | ||
183 | html(")</td></tr>\n"); | ||
177 | html("<tr><th>tree</th><td colspan='2' class='sha1'>"); | 184 | html("<tr><th>tree</th><td colspan='2' class='sha1'>"); |
178 | tmp = xstrdup(hex); | 185 | tmp = xstrdup(hex); |
179 | cgit_tree_link(sha1_to_hex(commit->tree->object.sha1), NULL, NULL, | 186 | cgit_tree_link(sha1_to_hex(commit->tree->object.sha1), NULL, NULL, |
@@ -218,10 +225,11 @@ void cgit_print_commit(char *hex) | |||
218 | print_fileinfo(&items[i]); | 225 | print_fileinfo(&items[i]); |
219 | html("</table>"); | 226 | html("</table>"); |
220 | html("<div class='diffstat-summary'>"); | 227 | html("<div class='diffstat-summary'>"); |
221 | htmlf("%d files changed, %d insertions, %d deletions (", | 228 | htmlf("%d files changed, %d insertions, %d deletions", |
222 | files, total_adds, total_rems); | 229 | files, total_adds, total_rems); |
223 | cgit_diff_link("show diff", NULL, NULL, ctx.qry.head, hex, | 230 | cgit_print_diff(ctx.qry.sha1, |
224 | NULL, NULL); | 231 | sha1_to_hex(commit->parents->item->object.sha1), |
232 | NULL); | ||
225 | html(")</div>"); | 233 | html(")</div>"); |
226 | } | 234 | } |
227 | cgit_free_commitinfo(info); | 235 | cgit_free_commitinfo(info); |
diff --git a/ui-repolist.c b/ui-repolist.c index eeeaf3d..7a7e95a 100644 --- a/ui-repolist.c +++ b/ui-repolist.c | |||
@@ -44,20 +44,23 @@ static void print_modtime(struct cgit_repo *repo) | |||
44 | cgit_print_age(s.st_mtime, -1, NULL); | 44 | cgit_print_age(s.st_mtime, -1, NULL); |
45 | } | 45 | } |
46 | 46 | ||
47 | void cgit_print_repolist() | 47 | int is_match(struct cgit_repo *repo) |
48 | { | 48 | { |
49 | int i, columns = 4; | 49 | if (!ctx.qry.search) |
50 | char *last_group = NULL; | 50 | return 1; |
51 | 51 | if (repo->url && strcasestr(repo->url, ctx.qry.search)) | |
52 | if (ctx.cfg.enable_index_links) | 52 | return 1; |
53 | columns++; | 53 | if (repo->name && strcasestr(repo->name, ctx.qry.search)) |
54 | 54 | return 1; | |
55 | ctx.page.title = ctx.cfg.root_title; | 55 | if (repo->desc && strcasestr(repo->desc, ctx.qry.search)) |
56 | cgit_print_http_headers(&ctx); | 56 | return 1; |
57 | cgit_print_docstart(&ctx); | 57 | if (repo->owner && strcasestr(repo->owner, ctx.qry.search)) |
58 | cgit_print_pageheader(&ctx); | 58 | return 1; |
59 | return 0; | ||
60 | } | ||
59 | 61 | ||
60 | html("<table summary='repository list' class='list nowrap'>"); | 62 | void print_header(int columns) |
63 | { | ||
61 | if (ctx.cfg.index_header) { | 64 | if (ctx.cfg.index_header) { |
62 | htmlf("<tr class='nohover'><td colspan='%d' class='include-block'>", | 65 | htmlf("<tr class='nohover'><td colspan='%d' class='include-block'>", |
63 | columns); | 66 | columns); |
@@ -70,11 +73,31 @@ void cgit_print_repolist() | |||
70 | "<th class='left'>Owner</th>" | 73 | "<th class='left'>Owner</th>" |
71 | "<th class='left'>Idle</th>"); | 74 | "<th class='left'>Idle</th>"); |
72 | if (ctx.cfg.enable_index_links) | 75 | if (ctx.cfg.enable_index_links) |
73 | html("<th>Links</th>"); | 76 | html("<th class='left'>Links</th>"); |
74 | html("</tr>\n"); | 77 | html("</tr>\n"); |
78 | } | ||
75 | 79 | ||
80 | void cgit_print_repolist() | ||
81 | { | ||
82 | int i, columns = 4, hits = 0, header = 0; | ||
83 | char *last_group = NULL; | ||
84 | |||
85 | if (ctx.cfg.enable_index_links) | ||
86 | columns++; | ||
87 | |||
88 | ctx.page.title = ctx.cfg.root_title; | ||
89 | cgit_print_http_headers(&ctx); | ||
90 | cgit_print_docstart(&ctx); | ||
91 | cgit_print_pageheader(&ctx); | ||
92 | |||
93 | html("<table summary='repository list' class='list nowrap'>"); | ||
76 | for (i=0; i<cgit_repolist.count; i++) { | 94 | for (i=0; i<cgit_repolist.count; i++) { |
77 | ctx.repo = &cgit_repolist.repos[i]; | 95 | ctx.repo = &cgit_repolist.repos[i]; |
96 | if (!is_match(ctx.repo)) | ||
97 | continue; | ||
98 | if (!header++) | ||
99 | print_header(columns); | ||
100 | hits++; | ||
78 | if ((last_group == NULL && ctx.repo->group != NULL) || | 101 | if ((last_group == NULL && ctx.repo->group != NULL) || |
79 | (last_group != NULL && ctx.repo->group == NULL) || | 102 | (last_group != NULL && ctx.repo->group == NULL) || |
80 | (last_group != NULL && ctx.repo->group != NULL && | 103 | (last_group != NULL && ctx.repo->group != NULL && |
@@ -110,5 +133,7 @@ void cgit_print_repolist() | |||
110 | html("</tr>\n"); | 133 | html("</tr>\n"); |
111 | } | 134 | } |
112 | html("</table>"); | 135 | html("</table>"); |
136 | if (!hits) | ||
137 | cgit_print_error("No repositories found"); | ||
113 | cgit_print_docend(); | 138 | cgit_print_docend(); |
114 | } | 139 | } |
diff --git a/ui-shared.c b/ui-shared.c index aa65988..bb08c4a 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -7,6 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include "cgit.h" | 9 | #include "cgit.h" |
10 | #include "cmd.h" | ||
10 | #include "html.h" | 11 | #include "html.h" |
11 | 12 | ||
12 | const char cgit_doctype[] = | 13 | const char cgit_doctype[] = |
@@ -388,7 +389,7 @@ void cgit_print_docstart(struct cgit_context *ctx) | |||
388 | 389 | ||
389 | void cgit_print_docend() | 390 | void cgit_print_docend() |
390 | { | 391 | { |
391 | html("</td>\n</tr>\n</table>\n</body>\n</html>\n"); | 392 | html("</div>\n</body>\n</html>\n"); |
392 | } | 393 | } |
393 | 394 | ||
394 | int print_branch_option(const char *refname, const unsigned char *sha1, | 395 | int print_branch_option(const char *refname, const unsigned char *sha1, |
@@ -465,75 +466,83 @@ void add_hidden_formfields(int incl_head, int incl_search, char *page) | |||
465 | } | 466 | } |
466 | } | 467 | } |
467 | 468 | ||
469 | char *hc(struct cgit_cmd *cmd, const char *page) | ||
470 | { | ||
471 | return (strcmp(cmd->name, page) ? NULL : "active"); | ||
472 | } | ||
473 | |||
468 | void cgit_print_pageheader(struct cgit_context *ctx) | 474 | void cgit_print_pageheader(struct cgit_context *ctx) |
469 | { | 475 | { |
470 | static const char *default_info = "This is cgit, a fast webinterface for git repositories"; | 476 | struct cgit_cmd *cmd = cgit_get_cmd(ctx); |
471 | int header = 0; | ||
472 | char *url; | ||
473 | 477 | ||
474 | html("<table id='layout' summary=''>\n"); | 478 | html("<table id='header'>\n"); |
475 | html("<tr><td id='sidebar'>\n"); | 479 | html("<tr>\n"); |
476 | html("<table class='sidebar' cellspacing='0' summary=''>\n"); | 480 | html("<td class='logo' rowspan='2'><a href='"); |
477 | html("<tr><td class='sidebar'>\n<a href='"); | 481 | if (ctx->cfg.logo_link) |
478 | html_attr(cgit_rooturl()); | 482 | html_attr(ctx->cfg.logo_link); |
479 | htmlf("'><img src='%s' alt='cgit'/></a>\n", | 483 | else |
480 | ctx->cfg.logo); | 484 | html_attr(cgit_rooturl()); |
481 | html("</td></tr>\n<tr><td class='sidebar'>\n"); | 485 | html("'><img src='"); |
482 | if (ctx->repo) { | 486 | html_attr(ctx->cfg.logo); |
483 | html("<h1 class='first'>"); | 487 | html("'/></a></td>\n"); |
484 | html_txt(strrpart(ctx->repo->name, 20)); | ||
485 | html("</h1>\n"); | ||
486 | html_txt(ctx->repo->desc); | ||
487 | if (ctx->repo->owner) { | ||
488 | html("<h1>owner</h1>\n"); | ||
489 | html_txt(ctx->repo->owner); | ||
490 | } | ||
491 | html("<h1>navigate</h1>\n"); | ||
492 | reporevlink(NULL, "summary", NULL, "menu", ctx->qry.head, | ||
493 | NULL, NULL); | ||
494 | cgit_log_link("log", NULL, "menu", ctx->qry.head, NULL, NULL, | ||
495 | 0, NULL, NULL); | ||
496 | cgit_tree_link("tree", NULL, "menu", ctx->qry.head, | ||
497 | ctx->qry.sha1, NULL); | ||
498 | cgit_commit_link("commit", NULL, "menu", ctx->qry.head, | ||
499 | ctx->qry.sha1); | ||
500 | cgit_diff_link("diff", NULL, "menu", ctx->qry.head, | ||
501 | ctx->qry.sha1, ctx->qry.sha2, NULL); | ||
502 | cgit_patch_link("patch", NULL, "menu", ctx->qry.head, | ||
503 | ctx->qry.sha1); | ||
504 | |||
505 | for_each_ref(print_archive_ref, &header); | ||
506 | |||
507 | if (ctx->repo->clone_url || ctx->cfg.clone_prefix) { | ||
508 | html("<h1>clone</h1>\n"); | ||
509 | if (ctx->repo->clone_url) | ||
510 | url = ctx->repo->clone_url; | ||
511 | else | ||
512 | url = fmt("%s%s", ctx->cfg.clone_prefix, | ||
513 | ctx->repo->url); | ||
514 | html("<a class='menu' href='"); | ||
515 | html_attr(url); | ||
516 | html("' title='"); | ||
517 | html_attr(url); | ||
518 | html("'>\n"); | ||
519 | html_txt(strrpart(url, 20)); | ||
520 | html("</a>\n"); | ||
521 | } | ||
522 | 488 | ||
523 | html("<h1>branch</h1>\n"); | 489 | html("<td class='main'>"); |
490 | if (ctx->repo) { | ||
491 | /* | ||
492 | html("<a href='"); | ||
493 | html_attr(cgit_rooturl()); | ||
494 | html("'>index</a> : "); | ||
495 | */ | ||
496 | reporevlink(NULL, ctx->repo->name, NULL, hc(cmd, "summary"), | ||
497 | ctx->qry.head, NULL, NULL); | ||
498 | html(" : "); | ||
499 | html_txt(ctx->qry.page); | ||
500 | html("</td><td class='form'>"); | ||
524 | html("<form method='get' action=''>\n"); | 501 | html("<form method='get' action=''>\n"); |
525 | add_hidden_formfields(0, 1, ctx->qry.page); | 502 | add_hidden_formfields(0, 1, ctx->qry.page); |
526 | // html("<table summary='branch selector' class='grid'><tr><td id='branch-dropdown-cell'>"); | ||
527 | html("<select name='h' onchange='this.form.submit();'>\n"); | 503 | html("<select name='h' onchange='this.form.submit();'>\n"); |
528 | for_each_branch_ref(print_branch_option, ctx->qry.head); | 504 | for_each_branch_ref(print_branch_option, ctx->qry.head); |
529 | html("</select>\n"); | 505 | html("</select> "); |
530 | // html("</td><td>"); | 506 | html("<input type='submit' name='' value='switch'/>"); |
531 | html("<noscript><input type='submit' id='switch-btn' value='switch'/></noscript>\n"); | 507 | html("</form>"); |
532 | // html("</td></tr></table>"); | 508 | } else |
533 | html("</form>\n"); | 509 | html_txt(ctx->cfg.root_title); |
510 | html("</td>\n"); | ||
511 | |||
512 | html("<tr><td class='sub'"); | ||
513 | if (ctx->repo) { | ||
514 | html(" colspan='2'>"); | ||
515 | html_txt(ctx->repo->desc); | ||
516 | } | ||
517 | /* | ||
518 | else if (ctx->cfg.root_subtitle) | ||
519 | html_txt(ctx->cfg.root_subtitle); | ||
520 | */ | ||
521 | else { | ||
522 | html(">"); | ||
523 | html_txt("a fast webinterface for the git dscm"); | ||
524 | } | ||
525 | html("</td></tr>\n"); | ||
534 | 526 | ||
535 | html("<h1>search</h1>\n"); | 527 | html("</tr>\n"); |
536 | html("<form method='get' action='"); | 528 | html("</table>\n"); |
529 | |||
530 | html("<table class='tabs'><tr><td>\n"); | ||
531 | if (ctx->repo) { | ||
532 | reporevlink(NULL, "summary", NULL, hc(cmd, "summary"), | ||
533 | ctx->qry.head, NULL, NULL); | ||
534 | cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head, | ||
535 | ctx->qry.sha1, NULL); | ||
536 | cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head, | ||
537 | NULL, NULL, 0, NULL, NULL); | ||
538 | cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head, | ||
539 | ctx->qry.sha1, NULL); | ||
540 | cgit_commit_link("commit", NULL, hc(cmd, "commit"), | ||
541 | ctx->qry.head, ctx->qry.sha1); | ||
542 | cgit_diff_link("diff", NULL, hc(cmd, "diff"), ctx->qry.head, | ||
543 | ctx->qry.sha1, ctx->qry.sha2, NULL); | ||
544 | html("</td><td class='form'>"); | ||
545 | html("<form class='right' method='get' action='"); | ||
537 | if (ctx->cfg.virtual_root) | 546 | if (ctx->cfg.virtual_root) |
538 | html_attr(cgit_fileurl(ctx->qry.repo, "log", | 547 | html_attr(cgit_fileurl(ctx->qry.repo, "log", |
539 | ctx->qry.path, NULL)); | 548 | ctx->qry.path, NULL)); |
@@ -544,18 +553,27 @@ void cgit_print_pageheader(struct cgit_context *ctx) | |||
544 | html_option("author", "author", ctx->qry.grep); | 553 | html_option("author", "author", ctx->qry.grep); |
545 | html_option("committer", "committer", ctx->qry.grep); | 554 | html_option("committer", "committer", ctx->qry.grep); |
546 | html("</select>\n"); | 555 | html("</select>\n"); |
547 | html("<input class='txt' type='text' name='q' value='"); | 556 | html("<input class='txt' type='text' size='10' name='q' value='"); |
548 | html_attr(ctx->qry.search); | 557 | html_attr(ctx->qry.search); |
549 | html("'/>\n"); | 558 | html("'/>\n"); |
559 | html("<input type='submit' value='search'/>\n"); | ||
550 | html("</form>\n"); | 560 | html("</form>\n"); |
551 | } else { | 561 | } else { |
552 | if (!ctx->cfg.index_info || html_include(ctx->cfg.index_info)) | 562 | html("<a class='active' href='"); |
553 | html(default_info); | 563 | html_attr(cgit_rooturl()); |
564 | html("'>index</a>\n"); | ||
565 | html("</td><td class='form'>"); | ||
566 | html("<form method='get' action='"); | ||
567 | html_attr(cgit_rooturl()); | ||
568 | html("'>\n"); | ||
569 | html("<input type='text' name='q' size='10' value='"); | ||
570 | html_attr(ctx->qry.search); | ||
571 | html("'/>\n"); | ||
572 | html("<input type='submit' value='search'/>\n"); | ||
573 | html("</form>"); | ||
554 | } | 574 | } |
555 | 575 | html("</td></tr></table>\n"); | |
556 | html("</td></tr></table></td>\n"); | 576 | html("<div class='content'>"); |
557 | |||
558 | html("<td id='content'>\n"); | ||
559 | } | 577 | } |
560 | 578 | ||
561 | void cgit_print_filemode(unsigned short mode) | 579 | void cgit_print_filemode(unsigned short mode) |
diff --git a/ui-shared.h b/ui-shared.h index 94de884..76c2b1f 100644 --- a/ui-shared.h +++ b/ui-shared.h | |||
@@ -14,6 +14,8 @@ extern void cgit_log_link(char *name, char *title, char *class, char *head, | |||
14 | char *pattern); | 14 | char *pattern); |
15 | extern void cgit_commit_link(char *name, char *title, char *class, char *head, | 15 | extern void cgit_commit_link(char *name, char *title, char *class, char *head, |
16 | char *rev); | 16 | char *rev); |
17 | extern void cgit_patch_link(char *name, char *title, char *class, char *head, | ||
18 | char *rev); | ||
17 | extern void cgit_refs_link(char *name, char *title, char *class, char *head, | 19 | extern void cgit_refs_link(char *name, char *title, char *class, char *head, |
18 | char *rev, char *path); | 20 | char *rev, char *path); |
19 | extern void cgit_snapshot_link(char *name, char *title, char *class, | 21 | extern void cgit_snapshot_link(char *name, char *title, char *class, |