-rw-r--r-- | cgit.css | 3 | ||||
-rw-r--r-- | ui-shared.c | 4 |
2 files changed, 5 insertions, 2 deletions
@@ -1,158 +1,161 @@ | |||
1 | body, table, form { | 1 | body, table, form { |
2 | padding: 0em; | 2 | padding: 0em; |
3 | margin: 0em; | 3 | margin: 0em; |
4 | } | 4 | } |
5 | 5 | ||
6 | body { | 6 | body { |
7 | font-family: sans-serif; | 7 | font-family: sans-serif; |
8 | font-size: 10pt; | 8 | font-size: 10pt; |
9 | color: #333; | 9 | color: #333; |
10 | background: white; | 10 | background: white; |
11 | padding: 4px; | 11 | padding: 4px; |
12 | } | 12 | } |
13 | 13 | ||
14 | a { | 14 | a { |
15 | color: blue; | 15 | color: blue; |
16 | text-decoration: none; | 16 | text-decoration: none; |
17 | } | 17 | } |
18 | 18 | ||
19 | a:hover { | 19 | a:hover { |
20 | text-decoration: underline; | 20 | text-decoration: underline; |
21 | } | 21 | } |
22 | 22 | ||
23 | table { | 23 | table { |
24 | border-collapse: collapse; | 24 | border-collapse: collapse; |
25 | } | 25 | } |
26 | 26 | ||
27 | table#header { | 27 | table#header { |
28 | width: 100%; | 28 | width: 100%; |
29 | margin-bottom: 1em; | 29 | margin-bottom: 1em; |
30 | } | 30 | } |
31 | 31 | ||
32 | table#header td.logo { | 32 | table#header td.logo { |
33 | width: 96px; | 33 | width: 96px; |
34 | } | 34 | } |
35 | 35 | ||
36 | table#header td.main { | 36 | table#header td.main { |
37 | font-size: 250%; | 37 | font-size: 250%; |
38 | padding-left: 10px; | 38 | padding-left: 10px; |
39 | white-space: nowrap; | ||
39 | } | 40 | } |
40 | 41 | ||
41 | table#header td.main a { | 42 | table#header td.main a { |
42 | color: #000; | 43 | color: #000; |
43 | } | 44 | } |
44 | 45 | ||
45 | table#header td.form { | 46 | table#header td.form { |
46 | text-align: right; | 47 | text-align: right; |
47 | vertical-align: bottom; | 48 | vertical-align: bottom; |
48 | padding-right: 1em; | 49 | padding-right: 1em; |
49 | padding-bottom: 2px; | 50 | padding-bottom: 2px; |
51 | white-space: nowrap; | ||
50 | } | 52 | } |
51 | 53 | ||
52 | table#header td.form form, | 54 | table#header td.form form, |
53 | table#header td.form input, | 55 | table#header td.form input, |
54 | table#header td.form select { | 56 | table#header td.form select { |
55 | font-size: 90%; | 57 | font-size: 90%; |
56 | } | 58 | } |
57 | 59 | ||
58 | table#header td.sub { | 60 | table#header td.sub { |
59 | color: #777; | 61 | color: #777; |
60 | border-top: solid 1px #ccc; | 62 | border-top: solid 1px #ccc; |
61 | padding-left: 10px; | 63 | padding-left: 10px; |
62 | } | 64 | } |
63 | 65 | ||
64 | table.tabs { | 66 | table.tabs { |
65 | /* border-bottom: solid 2px #ccc; */ | 67 | /* border-bottom: solid 2px #ccc; */ |
66 | border-collapse: collapse; | 68 | border-collapse: collapse; |
67 | margin-top: 2em; | 69 | margin-top: 2em; |
68 | margin-bottom: 0px; | 70 | margin-bottom: 0px; |
69 | width: 100%; | 71 | width: 100%; |
70 | } | 72 | } |
71 | 73 | ||
72 | table.tabs td { | 74 | table.tabs td { |
73 | padding: 0px 1em; | 75 | padding: 0px 1em; |
74 | vertical-align: bottom; | 76 | vertical-align: bottom; |
75 | } | 77 | } |
76 | 78 | ||
77 | table.tabs td a { | 79 | table.tabs td a { |
78 | padding: 2px 0.75em; | 80 | padding: 2px 0.75em; |
79 | color: #777; | 81 | color: #777; |
80 | font-size: 110%; | 82 | font-size: 110%; |
81 | } | 83 | } |
82 | 84 | ||
83 | table.tabs td a.active { | 85 | table.tabs td a.active { |
84 | color: #000; | 86 | color: #000; |
85 | background-color: #ccc; | 87 | background-color: #ccc; |
86 | } | 88 | } |
87 | 89 | ||
88 | table.tabs td.form { | 90 | table.tabs td.form { |
89 | text-align: right; | 91 | text-align: right; |
90 | } | 92 | } |
91 | 93 | ||
92 | table.tabs td.form form { | 94 | table.tabs td.form form { |
93 | padding-bottom: 2px; | 95 | padding-bottom: 2px; |
94 | font-size: 90%; | 96 | font-size: 90%; |
97 | white-space: nowrap; | ||
95 | } | 98 | } |
96 | 99 | ||
97 | table.tabs td.form input, | 100 | table.tabs td.form input, |
98 | table.tabs td.form select { | 101 | table.tabs td.form select { |
99 | font-size: 90%; | 102 | font-size: 90%; |
100 | } | 103 | } |
101 | 104 | ||
102 | div.content { | 105 | div.content { |
103 | margin: 0px; | 106 | margin: 0px; |
104 | padding: 2em; | 107 | padding: 2em; |
105 | border-top: solid 3px #ccc; | 108 | border-top: solid 3px #ccc; |
106 | border-bottom: solid 3px #ccc; | 109 | border-bottom: solid 3px #ccc; |
107 | } | 110 | } |
108 | 111 | ||
109 | 112 | ||
110 | table.list { | 113 | table.list { |
111 | width: 100%; | 114 | width: 100%; |
112 | border: none; | 115 | border: none; |
113 | border-collapse: collapse; | 116 | border-collapse: collapse; |
114 | } | 117 | } |
115 | 118 | ||
116 | table.list tr { | 119 | table.list tr { |
117 | background: white; | 120 | background: white; |
118 | } | 121 | } |
119 | 122 | ||
120 | table.list tr:hover { | 123 | table.list tr:hover { |
121 | background: #eee; | 124 | background: #eee; |
122 | } | 125 | } |
123 | 126 | ||
124 | table.list tr.nohover:hover { | 127 | table.list tr.nohover:hover { |
125 | background: white; | 128 | background: white; |
126 | } | 129 | } |
127 | 130 | ||
128 | table.list th { | 131 | table.list th { |
129 | font-weight: bold; | 132 | font-weight: bold; |
130 | /* color: #888; | 133 | /* color: #888; |
131 | border-top: dashed 1px #888; | 134 | border-top: dashed 1px #888; |
132 | border-bottom: dashed 1px #888; | 135 | border-bottom: dashed 1px #888; |
133 | */ | 136 | */ |
134 | padding: 0.1em 0.5em 0.05em 0.5em; | 137 | padding: 0.1em 0.5em 0.05em 0.5em; |
135 | vertical-align: baseline; | 138 | vertical-align: baseline; |
136 | } | 139 | } |
137 | 140 | ||
138 | table.list td { | 141 | table.list td { |
139 | border: none; | 142 | border: none; |
140 | padding: 0.1em 0.5em 0.1em 0.5em; | 143 | padding: 0.1em 0.5em 0.1em 0.5em; |
141 | } | 144 | } |
142 | 145 | ||
143 | table.list td a { | 146 | table.list td a { |
144 | color: black; | 147 | color: black; |
145 | } | 148 | } |
146 | 149 | ||
147 | table.list td a:hover { | 150 | table.list td a:hover { |
148 | color: #00f; | 151 | color: #00f; |
149 | } | 152 | } |
150 | 153 | ||
151 | img { | 154 | img { |
152 | border: none; | 155 | border: none; |
153 | } | 156 | } |
154 | 157 | ||
155 | input#switch-btn { | 158 | input#switch-btn { |
156 | margin: 2px 0px 0px 0px; | 159 | margin: 2px 0px 0px 0px; |
157 | } | 160 | } |
158 | 161 | ||
diff --git a/ui-shared.c b/ui-shared.c index 44269a7..cd98387 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -484,132 +484,132 @@ int print_archive_ref(const char *refname, const unsigned char *sha1, | |||
484 | hashcpy(fileid, sha1); | 484 | hashcpy(fileid, sha1); |
485 | } | 485 | } |
486 | if (!*header) { | 486 | if (!*header) { |
487 | html("<h1>download</h1>\n"); | 487 | html("<h1>download</h1>\n"); |
488 | *header = 1; | 488 | *header = 1; |
489 | } | 489 | } |
490 | url = cgit_pageurl(ctx.qry.repo, "blob", | 490 | url = cgit_pageurl(ctx.qry.repo, "blob", |
491 | fmt("id=%s&path=%s", sha1_to_hex(fileid), | 491 | fmt("id=%s&path=%s", sha1_to_hex(fileid), |
492 | buf)); | 492 | buf)); |
493 | html_link_open(url, NULL, "menu"); | 493 | html_link_open(url, NULL, "menu"); |
494 | html_txt(strlpart(buf, 20)); | 494 | html_txt(strlpart(buf, 20)); |
495 | html_link_close(); | 495 | html_link_close(); |
496 | return 0; | 496 | return 0; |
497 | } | 497 | } |
498 | 498 | ||
499 | void add_hidden_formfields(int incl_head, int incl_search, char *page) | 499 | void add_hidden_formfields(int incl_head, int incl_search, char *page) |
500 | { | 500 | { |
501 | char *url; | 501 | char *url; |
502 | 502 | ||
503 | if (!ctx.cfg.virtual_root) { | 503 | if (!ctx.cfg.virtual_root) { |
504 | url = fmt("%s/%s", ctx.qry.repo, page); | 504 | url = fmt("%s/%s", ctx.qry.repo, page); |
505 | if (ctx.qry.path) | 505 | if (ctx.qry.path) |
506 | url = fmt("%s/%s", url, ctx.qry.path); | 506 | url = fmt("%s/%s", url, ctx.qry.path); |
507 | html_hidden("url", url); | 507 | html_hidden("url", url); |
508 | } | 508 | } |
509 | 509 | ||
510 | if (incl_head && strcmp(ctx.qry.head, ctx.repo->defbranch)) | 510 | if (incl_head && strcmp(ctx.qry.head, ctx.repo->defbranch)) |
511 | html_hidden("h", ctx.qry.head); | 511 | html_hidden("h", ctx.qry.head); |
512 | 512 | ||
513 | if (ctx.qry.sha1) | 513 | if (ctx.qry.sha1) |
514 | html_hidden("id", ctx.qry.sha1); | 514 | html_hidden("id", ctx.qry.sha1); |
515 | if (ctx.qry.sha2) | 515 | if (ctx.qry.sha2) |
516 | html_hidden("id2", ctx.qry.sha2); | 516 | html_hidden("id2", ctx.qry.sha2); |
517 | 517 | ||
518 | if (incl_search) { | 518 | if (incl_search) { |
519 | if (ctx.qry.grep) | 519 | if (ctx.qry.grep) |
520 | html_hidden("qt", ctx.qry.grep); | 520 | html_hidden("qt", ctx.qry.grep); |
521 | if (ctx.qry.search) | 521 | if (ctx.qry.search) |
522 | html_hidden("q", ctx.qry.search); | 522 | html_hidden("q", ctx.qry.search); |
523 | } | 523 | } |
524 | } | 524 | } |
525 | 525 | ||
526 | char *hc(struct cgit_cmd *cmd, const char *page) | 526 | char *hc(struct cgit_cmd *cmd, const char *page) |
527 | { | 527 | { |
528 | return (strcmp(cmd->name, page) ? NULL : "active"); | 528 | return (strcmp(cmd->name, page) ? NULL : "active"); |
529 | } | 529 | } |
530 | 530 | ||
531 | void cgit_print_pageheader(struct cgit_context *ctx) | 531 | void cgit_print_pageheader(struct cgit_context *ctx) |
532 | { | 532 | { |
533 | struct cgit_cmd *cmd = cgit_get_cmd(ctx); | 533 | struct cgit_cmd *cmd = cgit_get_cmd(ctx); |
534 | 534 | ||
535 | html("<table id='header'>\n"); | 535 | html("<table id='header'>\n"); |
536 | html("<tr>\n"); | 536 | html("<tr>\n"); |
537 | html("<td class='logo' rowspan='2'><a href='"); | 537 | html("<td class='logo' rowspan='2'><a href='"); |
538 | if (ctx->cfg.logo_link) | 538 | if (ctx->cfg.logo_link) |
539 | html_attr(ctx->cfg.logo_link); | 539 | html_attr(ctx->cfg.logo_link); |
540 | else | 540 | else |
541 | html_attr(cgit_rooturl()); | 541 | html_attr(cgit_rooturl()); |
542 | html("'><img src='"); | 542 | html("'><img src='"); |
543 | html_attr(ctx->cfg.logo); | 543 | html_attr(ctx->cfg.logo); |
544 | html("' alt='cgit logo'/></a></td>\n"); | 544 | html("' alt='cgit logo'/></a></td>\n"); |
545 | 545 | ||
546 | html("<td class='main'>"); | 546 | html("<td class='main'>"); |
547 | if (ctx->repo) { | 547 | if (ctx->repo) { |
548 | cgit_index_link("index", NULL, NULL, NULL, 0); | ||
549 | html(" : "); | ||
548 | reporevlink(NULL, ctx->repo->name, NULL, hc(cmd, "summary"), | 550 | reporevlink(NULL, ctx->repo->name, NULL, hc(cmd, "summary"), |
549 | ctx->qry.head, NULL, NULL); | 551 | ctx->qry.head, NULL, NULL); |
550 | html(" : "); | ||
551 | html_txt(ctx->qry.page); | ||
552 | html("</td><td class='form'>"); | 552 | html("</td><td class='form'>"); |
553 | html("<form method='get' action=''>\n"); | 553 | html("<form method='get' action=''>\n"); |
554 | add_hidden_formfields(0, 1, ctx->qry.page); | 554 | add_hidden_formfields(0, 1, ctx->qry.page); |
555 | html("<select name='h' onchange='this.form.submit();'>\n"); | 555 | html("<select name='h' onchange='this.form.submit();'>\n"); |
556 | for_each_branch_ref(print_branch_option, ctx->qry.head); | 556 | for_each_branch_ref(print_branch_option, ctx->qry.head); |
557 | html("</select> "); | 557 | html("</select> "); |
558 | html("<input type='submit' name='' value='switch'/>"); | 558 | html("<input type='submit' name='' value='switch'/>"); |
559 | html("</form>"); | 559 | html("</form>"); |
560 | } else | 560 | } else |
561 | html_txt(ctx->cfg.root_title); | 561 | html_txt(ctx->cfg.root_title); |
562 | html("</td></tr>\n"); | 562 | html("</td></tr>\n"); |
563 | 563 | ||
564 | html("<tr><td class='sub'"); | 564 | html("<tr><td class='sub'"); |
565 | if (ctx->repo) { | 565 | if (ctx->repo) { |
566 | html(" colspan='2'>"); | 566 | html(" colspan='2'>"); |
567 | html_txt(ctx->repo->desc); | 567 | html_txt(ctx->repo->desc); |
568 | } else { | 568 | } else { |
569 | html(">"); | 569 | html(">"); |
570 | if (ctx->cfg.root_desc) | 570 | if (ctx->cfg.root_desc) |
571 | html_txt(ctx->cfg.root_desc); | 571 | html_txt(ctx->cfg.root_desc); |
572 | else if (ctx->cfg.index_info) | 572 | else if (ctx->cfg.index_info) |
573 | html_include(ctx->cfg.index_info); | 573 | html_include(ctx->cfg.index_info); |
574 | } | 574 | } |
575 | html("</td></tr></table>\n"); | 575 | html("</td></tr></table>\n"); |
576 | 576 | ||
577 | html("<table class='tabs'><tr><td>\n"); | 577 | html("<table class='tabs'><tr><td>\n"); |
578 | if (ctx->repo) { | 578 | if (ctx->repo) { |
579 | reporevlink(NULL, "summary", NULL, hc(cmd, "summary"), | 579 | reporevlink(NULL, "summary", NULL, hc(cmd, "summary"), |
580 | ctx->qry.head, NULL, NULL); | 580 | ctx->qry.head, NULL, NULL); |
581 | cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head, | 581 | cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head, |
582 | ctx->qry.sha1, NULL); | 582 | ctx->qry.sha1, NULL); |
583 | cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head, | 583 | cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head, |
584 | NULL, NULL, 0, NULL, NULL); | 584 | NULL, NULL, 0, NULL, NULL); |
585 | cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head, | 585 | cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head, |
586 | ctx->qry.sha1, NULL); | 586 | ctx->qry.sha1, NULL); |
587 | cgit_commit_link("commit", NULL, hc(cmd, "commit"), | 587 | cgit_commit_link("commit", NULL, hc(cmd, "commit"), |
588 | ctx->qry.head, ctx->qry.sha1); | 588 | ctx->qry.head, ctx->qry.sha1); |
589 | cgit_diff_link("diff", NULL, hc(cmd, "diff"), ctx->qry.head, | 589 | cgit_diff_link("diff", NULL, hc(cmd, "diff"), ctx->qry.head, |
590 | ctx->qry.sha1, ctx->qry.sha2, NULL); | 590 | ctx->qry.sha1, ctx->qry.sha2, NULL); |
591 | if (ctx->repo->readme) | 591 | if (ctx->repo->readme) |
592 | reporevlink("about", "about", NULL, | 592 | reporevlink("about", "about", NULL, |
593 | hc(cmd, "about"), ctx->qry.head, NULL, | 593 | hc(cmd, "about"), ctx->qry.head, NULL, |
594 | NULL); | 594 | NULL); |
595 | html("</td><td class='form'>"); | 595 | html("</td><td class='form'>"); |
596 | html("<form class='right' method='get' action='"); | 596 | html("<form class='right' method='get' action='"); |
597 | if (ctx->cfg.virtual_root) | 597 | if (ctx->cfg.virtual_root) |
598 | html_attr(cgit_fileurl(ctx->qry.repo, "log", | 598 | html_attr(cgit_fileurl(ctx->qry.repo, "log", |
599 | ctx->qry.path, NULL)); | 599 | ctx->qry.path, NULL)); |
600 | html("'>\n"); | 600 | html("'>\n"); |
601 | add_hidden_formfields(1, 0, "log"); | 601 | add_hidden_formfields(1, 0, "log"); |
602 | html("<select name='qt'>\n"); | 602 | html("<select name='qt'>\n"); |
603 | html_option("grep", "log msg", ctx->qry.grep); | 603 | html_option("grep", "log msg", ctx->qry.grep); |
604 | html_option("author", "author", ctx->qry.grep); | 604 | html_option("author", "author", ctx->qry.grep); |
605 | html_option("committer", "committer", ctx->qry.grep); | 605 | html_option("committer", "committer", ctx->qry.grep); |
606 | html("</select>\n"); | 606 | html("</select>\n"); |
607 | html("<input class='txt' type='text' size='10' name='q' value='"); | 607 | html("<input class='txt' type='text' size='10' name='q' value='"); |
608 | html_attr(ctx->qry.search); | 608 | html_attr(ctx->qry.search); |
609 | html("'/>\n"); | 609 | html("'/>\n"); |
610 | html("<input type='submit' value='search'/>\n"); | 610 | html("<input type='submit' value='search'/>\n"); |
611 | html("</form>\n"); | 611 | html("</form>\n"); |
612 | } else { | 612 | } else { |
613 | site_link(NULL, "index", NULL, hc(cmd, "repolist"), NULL, 0); | 613 | site_link(NULL, "index", NULL, hc(cmd, "repolist"), NULL, 0); |
614 | if (ctx->cfg.root_readme) | 614 | if (ctx->cfg.root_readme) |
615 | site_link("about", "about", NULL, hc(cmd, "about"), | 615 | site_link("about", "about", NULL, hc(cmd, "about"), |