diff options
author | Lars Hjemli | 2008-12-06 11:37:37 +0100 |
---|---|---|
committer | Lars Hjemli | 2008-12-06 11:37:37 +0100 |
commit | 3c32fe07717f27fc891b66ccd06057fb810d03ad (patch) | |
tree | 04897b3eac6432c43284e7da79161e47856d078b | |
parent | Merge branch 'lh/sort-repolist' (diff) | |
parent | ui-log: use css to make full-log prettier (diff) | |
download | cgit-3c32fe07717f27fc891b66ccd06057fb810d03ad.tar.gz cgit-3c32fe07717f27fc891b66ccd06057fb810d03ad.zip |
Merge branch 'full-log'
Conflicts: cgit.c cgit.h
-rw-r--r-- | cgit.c | 2 | ||||
-rw-r--r-- | cgit.css | 15 | ||||
-rw-r--r-- | cgit.h | 1 | ||||
-rw-r--r-- | ui-log.c | 35 | ||||
-rw-r--r-- | ui-refs.c | 3 | ||||
-rw-r--r-- | ui-repolist.c | 2 | ||||
-rw-r--r-- | ui-shared.c | 12 | ||||
-rw-r--r-- | ui-shared.h | 2 | ||||
-rw-r--r-- | ui-tree.c | 2 |
9 files changed, 61 insertions, 13 deletions
diff --git a/cgit.c b/cgit.c index e09c86e..166fbc6 100644 --- a/cgit.c +++ b/cgit.c | |||
@@ -156,6 +156,8 @@ static void querystring_cb(const char *name, const char *value) | |||
156 | ctx.qry.mimetype = xstrdup(value); | 156 | ctx.qry.mimetype = xstrdup(value); |
157 | } else if (!strcmp(name, "s")){ | 157 | } else if (!strcmp(name, "s")){ |
158 | ctx.qry.sort = xstrdup(value); | 158 | ctx.qry.sort = xstrdup(value); |
159 | } else if (!strcmp(name, "showmsg")) { | ||
160 | ctx.qry.showmsg = atoi(value); | ||
159 | } | 161 | } |
160 | } | 162 | } |
161 | 163 | ||
diff --git a/cgit.css b/cgit.css index a37d218..7928c2f 100644 --- a/cgit.css +++ b/cgit.css | |||
@@ -120,6 +120,10 @@ table.list tr { | |||
120 | background: white; | 120 | background: white; |
121 | } | 121 | } |
122 | 122 | ||
123 | table.list tr.logheader { | ||
124 | background: #eee; | ||
125 | } | ||
126 | |||
123 | table.list tr:hover { | 127 | table.list tr:hover { |
124 | background: #eee; | 128 | background: #eee; |
125 | } | 129 | } |
@@ -143,6 +147,17 @@ table.list td { | |||
143 | padding: 0.1em 0.5em 0.1em 0.5em; | 147 | padding: 0.1em 0.5em 0.1em 0.5em; |
144 | } | 148 | } |
145 | 149 | ||
150 | table.list td.logsubject { | ||
151 | font-family: monospace; | ||
152 | font-weight: bold; | ||
153 | } | ||
154 | |||
155 | table.list td.logmsg { | ||
156 | font-family: monospace; | ||
157 | white-space: pre; | ||
158 | padding: 1em 0em 2em 0em; | ||
159 | } | ||
160 | |||
146 | table.list td a { | 161 | table.list td a { |
147 | color: black; | 162 | color: black; |
148 | } | 163 | } |
diff --git a/cgit.h b/cgit.h index f1fbeca..cb2f176 100644 --- a/cgit.h +++ b/cgit.h | |||
@@ -123,6 +123,7 @@ struct cgit_query { | |||
123 | int ofs; | 123 | int ofs; |
124 | int nohead; | 124 | int nohead; |
125 | char *sort; | 125 | char *sort; |
126 | int showmsg; | ||
126 | }; | 127 | }; |
127 | 128 | ||
128 | struct cgit_config { | 129 | struct cgit_config { |
diff --git a/ui-log.c b/ui-log.c index d212984..2f90778 100644 --- a/ui-log.c +++ b/ui-log.c | |||
@@ -35,15 +35,18 @@ void print_commit(struct commit *commit) | |||
35 | { | 35 | { |
36 | struct commitinfo *info; | 36 | struct commitinfo *info; |
37 | char *tmp; | 37 | char *tmp; |
38 | int cols = 2; | ||
38 | 39 | ||
39 | info = cgit_parse_commit(commit); | 40 | info = cgit_parse_commit(commit); |
40 | html("<tr><td>"); | 41 | htmlf("<tr%s><td>", |
42 | ctx.qry.showmsg ? " class='logheader'" : ""); | ||
41 | tmp = fmt("id=%s", sha1_to_hex(commit->object.sha1)); | 43 | tmp = fmt("id=%s", sha1_to_hex(commit->object.sha1)); |
42 | tmp = cgit_pageurl(ctx.repo->url, "commit", tmp); | 44 | tmp = cgit_pageurl(ctx.repo->url, "commit", tmp); |
43 | html_link_open(tmp, NULL, NULL); | 45 | html_link_open(tmp, NULL, NULL); |
44 | cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE); | 46 | cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE); |
45 | html_link_close(); | 47 | html_link_close(); |
46 | html("</td><td>"); | 48 | htmlf("</td><td%s>", |
49 | ctx.qry.showmsg ? " class='logsubject'" : ""); | ||
47 | cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, | 50 | cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, |
48 | sha1_to_hex(commit->object.sha1)); | 51 | sha1_to_hex(commit->object.sha1)); |
49 | html("</td><td>"); | 52 | html("</td><td>"); |
@@ -61,6 +64,17 @@ void print_commit(struct commit *commit) | |||
61 | } | 64 | } |
62 | } | 65 | } |
63 | html("</td></tr>\n"); | 66 | html("</td></tr>\n"); |
67 | if (ctx.qry.showmsg) { | ||
68 | if (ctx.repo->enable_log_filecount) { | ||
69 | cols++; | ||
70 | if (ctx.repo->enable_log_linecount) | ||
71 | cols++; | ||
72 | } | ||
73 | htmlf("<tr class='nohover'><td/><td colspan='%d' class='logmsg'>", | ||
74 | cols); | ||
75 | html_txt(info->msg); | ||
76 | html("</td></tr>\n"); | ||
77 | } | ||
64 | cgit_free_commitinfo(info); | 78 | cgit_free_commitinfo(info); |
65 | } | 79 | } |
66 | 80 | ||
@@ -113,8 +127,15 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern | |||
113 | html("<table class='list nowrap'>"); | 127 | html("<table class='list nowrap'>"); |
114 | 128 | ||
115 | html("<tr class='nohover'><th class='left'>Age</th>" | 129 | html("<tr class='nohover'><th class='left'>Age</th>" |
116 | "<th class='left'>Commit message</th>" | 130 | "<th class='left'>Commit message"); |
117 | "<th class='left'>Author</th>"); | 131 | if (pager) { |
132 | html(" ("); | ||
133 | cgit_log_link("toggle", NULL, NULL, ctx.qry.head, ctx.qry.sha1, | ||
134 | ctx.qry.path, ctx.qry.ofs, ctx.qry.grep, | ||
135 | ctx.qry.search, ctx.qry.showmsg ? 0 : 1); | ||
136 | html(")"); | ||
137 | } | ||
138 | html("</th><th class='left'>Author</th>"); | ||
118 | if (ctx.repo->enable_log_filecount) { | 139 | if (ctx.repo->enable_log_filecount) { |
119 | html("<th class='left'>Files</th>"); | 140 | html("<th class='left'>Files</th>"); |
120 | columns++; | 141 | columns++; |
@@ -149,20 +170,20 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern | |||
149 | cgit_log_link("[prev]", NULL, NULL, ctx.qry.head, | 170 | cgit_log_link("[prev]", NULL, NULL, ctx.qry.head, |
150 | ctx.qry.sha1, ctx.qry.path, | 171 | ctx.qry.sha1, ctx.qry.path, |
151 | ofs - cnt, ctx.qry.grep, | 172 | ofs - cnt, ctx.qry.grep, |
152 | ctx.qry.search); | 173 | ctx.qry.search, ctx.qry.showmsg); |
153 | html(" "); | 174 | html(" "); |
154 | } | 175 | } |
155 | if ((commit = get_revision(&rev)) != NULL) { | 176 | if ((commit = get_revision(&rev)) != NULL) { |
156 | cgit_log_link("[next]", NULL, NULL, ctx.qry.head, | 177 | cgit_log_link("[next]", NULL, NULL, ctx.qry.head, |
157 | ctx.qry.sha1, ctx.qry.path, | 178 | ctx.qry.sha1, ctx.qry.path, |
158 | ofs + cnt, ctx.qry.grep, | 179 | ofs + cnt, ctx.qry.grep, |
159 | ctx.qry.search); | 180 | ctx.qry.search, ctx.qry.showmsg); |
160 | } | 181 | } |
161 | html("</div>"); | 182 | html("</div>"); |
162 | } else if ((commit = get_revision(&rev)) != NULL) { | 183 | } else if ((commit = get_revision(&rev)) != NULL) { |
163 | html("<tr class='nohover'><td colspan='3'>"); | 184 | html("<tr class='nohover'><td colspan='3'>"); |
164 | cgit_log_link("[...]", NULL, NULL, ctx.qry.head, NULL, NULL, 0, | 185 | cgit_log_link("[...]", NULL, NULL, ctx.qry.head, NULL, NULL, 0, |
165 | NULL, NULL); | 186 | NULL, NULL, ctx.qry.showmsg); |
166 | html("</td></tr>\n"); | 187 | html("</td></tr>\n"); |
167 | } | 188 | } |
168 | } | 189 | } |
diff --git a/ui-refs.c b/ui-refs.c index 0805fc8..d61ee7c 100644 --- a/ui-refs.c +++ b/ui-refs.c | |||
@@ -58,7 +58,8 @@ static int print_branch(struct refinfo *ref) | |||
58 | if (!info) | 58 | if (!info) |
59 | return 1; | 59 | return 1; |
60 | html("<tr><td>"); | 60 | html("<tr><td>"); |
61 | cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0, NULL, NULL); | 61 | cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0, NULL, NULL, |
62 | ctx.qry.showmsg); | ||
62 | html("</td><td>"); | 63 | html("</td><td>"); |
63 | 64 | ||
64 | if (ref->object->type == OBJ_COMMIT) { | 65 | if (ref->object->type == OBJ_COMMIT) { |
diff --git a/ui-repolist.c b/ui-repolist.c index 87196f0..2c13d50 100644 --- a/ui-repolist.c +++ b/ui-repolist.c | |||
@@ -257,7 +257,7 @@ void cgit_print_repolist() | |||
257 | html("<td>"); | 257 | html("<td>"); |
258 | cgit_summary_link("summary", NULL, "button", NULL); | 258 | cgit_summary_link("summary", NULL, "button", NULL); |
259 | cgit_log_link("log", NULL, "button", NULL, NULL, NULL, | 259 | cgit_log_link("log", NULL, "button", NULL, NULL, NULL, |
260 | 0, NULL, NULL); | 260 | 0, NULL, NULL, ctx.qry.showmsg); |
261 | cgit_tree_link("tree", NULL, "button", NULL, NULL, NULL); | 261 | cgit_tree_link("tree", NULL, "button", NULL, NULL, NULL); |
262 | html("</td>"); | 262 | html("</td>"); |
263 | } | 263 | } |
diff --git a/ui-shared.c b/ui-shared.c index 9319881..95dfeb4 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -281,7 +281,8 @@ void cgit_plain_link(char *name, char *title, char *class, char *head, | |||
281 | } | 281 | } |
282 | 282 | ||
283 | void cgit_log_link(char *name, char *title, char *class, char *head, | 283 | void cgit_log_link(char *name, char *title, char *class, char *head, |
284 | char *rev, char *path, int ofs, char *grep, char *pattern) | 284 | char *rev, char *path, int ofs, char *grep, char *pattern, |
285 | int showmsg) | ||
285 | { | 286 | { |
286 | char *delim; | 287 | char *delim; |
287 | 288 | ||
@@ -305,6 +306,11 @@ void cgit_log_link(char *name, char *title, char *class, char *head, | |||
305 | html(delim); | 306 | html(delim); |
306 | html("ofs="); | 307 | html("ofs="); |
307 | htmlf("%d", ofs); | 308 | htmlf("%d", ofs); |
309 | delim = "&"; | ||
310 | } | ||
311 | if (showmsg) { | ||
312 | html(delim); | ||
313 | html("showmsg=1"); | ||
308 | } | 314 | } |
309 | html("'>"); | 315 | html("'>"); |
310 | html_txt(name); | 316 | html_txt(name); |
@@ -570,6 +576,8 @@ void add_hidden_formfields(int incl_head, int incl_search, char *page) | |||
570 | html_hidden("id", ctx.qry.sha1); | 576 | html_hidden("id", ctx.qry.sha1); |
571 | if (ctx.qry.sha2) | 577 | if (ctx.qry.sha2) |
572 | html_hidden("id2", ctx.qry.sha2); | 578 | html_hidden("id2", ctx.qry.sha2); |
579 | if (ctx.qry.showmsg) | ||
580 | html_hidden("showmsg", "1"); | ||
573 | 581 | ||
574 | if (incl_search) { | 582 | if (incl_search) { |
575 | if (ctx.qry.grep) | 583 | if (ctx.qry.grep) |
@@ -636,7 +644,7 @@ void cgit_print_pageheader(struct cgit_context *ctx) | |||
636 | cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head, | 644 | cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head, |
637 | ctx->qry.sha1, NULL); | 645 | ctx->qry.sha1, NULL); |
638 | cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head, | 646 | cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head, |
639 | NULL, NULL, 0, NULL, NULL); | 647 | NULL, NULL, 0, NULL, NULL, ctx->qry.showmsg); |
640 | cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head, | 648 | cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head, |
641 | ctx->qry.sha1, NULL); | 649 | ctx->qry.sha1, NULL); |
642 | cgit_commit_link("commit", NULL, hc(cmd, "commit"), | 650 | cgit_commit_link("commit", NULL, hc(cmd, "commit"), |
diff --git a/ui-shared.h b/ui-shared.h index 3c8a6d0..2ab53ae 100644 --- a/ui-shared.h +++ b/ui-shared.h | |||
@@ -19,7 +19,7 @@ extern void cgit_plain_link(char *name, char *title, char *class, char *head, | |||
19 | char *rev, char *path); | 19 | char *rev, char *path); |
20 | extern void cgit_log_link(char *name, char *title, char *class, char *head, | 20 | extern void cgit_log_link(char *name, char *title, char *class, char *head, |
21 | char *rev, char *path, int ofs, char *grep, | 21 | char *rev, char *path, int ofs, char *grep, |
22 | char *pattern); | 22 | char *pattern, int showmsg); |
23 | extern void cgit_commit_link(char *name, char *title, char *class, char *head, | 23 | extern void cgit_commit_link(char *name, char *title, char *class, char *head, |
24 | char *rev); | 24 | char *rev); |
25 | extern void cgit_patch_link(char *name, char *title, char *class, char *head, | 25 | extern void cgit_patch_link(char *name, char *title, char *class, char *head, |
diff --git a/ui-tree.c b/ui-tree.c index 79332fc..051db7c 100644 --- a/ui-tree.c +++ b/ui-tree.c | |||
@@ -106,7 +106,7 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen, | |||
106 | 106 | ||
107 | html("<td>"); | 107 | html("<td>"); |
108 | cgit_log_link("log", NULL, "button", ctx.qry.head, curr_rev, | 108 | cgit_log_link("log", NULL, "button", ctx.qry.head, curr_rev, |
109 | fullpath, 0, NULL, NULL); | 109 | fullpath, 0, NULL, NULL, ctx.qry.showmsg); |
110 | html("</td></tr>\n"); | 110 | html("</td></tr>\n"); |
111 | free(name); | 111 | free(name); |
112 | return 0; | 112 | return 0; |