author | Lars Hjemli <hjemli@gmail.com> | 2007-05-15 23:16:56 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-05-15 23:16:56 (UTC) |
commit | dff894d12953a8a3cd7cdca2357771212a2f57d6 (patch) (unidiff) | |
tree | 042f1fbc0594d61d97721167197506760847ce2a | |
parent | f9ff7df613b4ee86fe5914c4ae3400650882c03d (diff) | |
download | cgit-dff894d12953a8a3cd7cdca2357771212a2f57d6.zip cgit-dff894d12953a8a3cd7cdca2357771212a2f57d6.tar.gz cgit-dff894d12953a8a3cd7cdca2357771212a2f57d6.tar.bz2 |
Add link to commitdiff below diffstat
This link is a lot easier to locate than the links to the right of the
parent entries.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | cgit.css | 6 | ||||
-rw-r--r-- | ui-commit.c | 6 |
2 files changed, 10 insertions, 2 deletions
@@ -207,67 +207,71 @@ td.blob { | |||
207 | table.nowrap td { | 207 | table.nowrap td { |
208 | white-space: nowrap; | 208 | white-space: nowrap; |
209 | } | 209 | } |
210 | 210 | ||
211 | table.commit-info { | 211 | table.commit-info { |
212 | border-collapse: collapse; | 212 | border-collapse: collapse; |
213 | margin-top: 1.5em; | 213 | margin-top: 1.5em; |
214 | } | 214 | } |
215 | 215 | ||
216 | table.commit-info th { | 216 | table.commit-info th { |
217 | text-align: left; | 217 | text-align: left; |
218 | font-weight: normal; | 218 | font-weight: normal; |
219 | padding: 0.1em 1em 0.1em 0.1em; | 219 | padding: 0.1em 1em 0.1em 0.1em; |
220 | } | 220 | } |
221 | 221 | ||
222 | table.commit-info td { | 222 | table.commit-info td { |
223 | font-weight: normal; | 223 | font-weight: normal; |
224 | padding: 0.1em 1em 0.1em 0.1em; | 224 | padding: 0.1em 1em 0.1em 0.1em; |
225 | } | 225 | } |
226 | 226 | ||
227 | div.commit-subject { | 227 | div.commit-subject { |
228 | font-weight: bold; | 228 | font-weight: bold; |
229 | font-size: 125%; | 229 | font-size: 125%; |
230 | margin: 1.5em 0em 0.5em 0em; | 230 | margin: 1.5em 0em 0.5em 0em; |
231 | padding: 0em; | 231 | padding: 0em; |
232 | } | 232 | } |
233 | 233 | ||
234 | div.commit-msg { | 234 | div.commit-msg { |
235 | white-space: pre; | 235 | white-space: pre; |
236 | font-family: monospace; | 236 | font-family: monospace; |
237 | } | 237 | } |
238 | 238 | ||
239 | div.diffstat-header { | ||
240 | font-weight: bold; | ||
241 | padding-top: 1.5em; | ||
242 | } | ||
243 | |||
239 | table.diffstat { | 244 | table.diffstat { |
240 | border-collapse: collapse; | 245 | border-collapse: collapse; |
241 | margin-top: 1.5em; | ||
242 | width: 100%; | 246 | width: 100%; |
243 | border: solid 1px #aaa; | 247 | border: solid 1px #aaa; |
244 | background-color: #eee; | 248 | background-color: #eee; |
245 | } | 249 | } |
246 | 250 | ||
247 | table.diffstat tr:hover { | 251 | table.diffstat tr:hover { |
248 | background-color: #ccc; | 252 | background-color: #ccc; |
249 | } | 253 | } |
250 | 254 | ||
251 | table.diffstat th { | 255 | table.diffstat th { |
252 | font-weight: normal; | 256 | font-weight: normal; |
253 | text-align: left; | 257 | text-align: left; |
254 | text-decoration: underline; | 258 | text-decoration: underline; |
255 | padding: 0.1em 1em 0.1em 0.1em; | 259 | padding: 0.1em 1em 0.1em 0.1em; |
256 | font-size: 100%; | 260 | font-size: 100%; |
257 | } | 261 | } |
258 | 262 | ||
259 | table.diffstat td { | 263 | table.diffstat td { |
260 | padding: 0.2em 0.2em 0.1em 0.1em; | 264 | padding: 0.2em 0.2em 0.1em 0.1em; |
261 | font-size: 100%; | 265 | font-size: 100%; |
262 | border: none; | 266 | border: none; |
263 | } | 267 | } |
264 | 268 | ||
265 | table.diffstat td span.modechange { | 269 | table.diffstat td span.modechange { |
266 | padding-left: 1em; | 270 | padding-left: 1em; |
267 | color: red; | 271 | color: red; |
268 | } | 272 | } |
269 | 273 | ||
270 | table.diffstat td.add a { | 274 | table.diffstat td.add a { |
271 | color: green; | 275 | color: green; |
272 | } | 276 | } |
273 | 277 | ||
diff --git a/ui-commit.c b/ui-commit.c index 93eb8fd..ff1fad3 100644 --- a/ui-commit.c +++ b/ui-commit.c | |||
@@ -192,45 +192,49 @@ void cgit_print_commit(const char *hex) | |||
192 | html("<tr><td colspan='3'>"); | 192 | html("<tr><td colspan='3'>"); |
193 | cgit_print_error("Error reading parent commit"); | 193 | cgit_print_error("Error reading parent commit"); |
194 | html("</td></tr>"); | 194 | html("</td></tr>"); |
195 | continue; | 195 | continue; |
196 | } | 196 | } |
197 | html("<tr><th>parent</th>" | 197 | html("<tr><th>parent</th>" |
198 | "<td colspan='2' class='sha1'>" | 198 | "<td colspan='2' class='sha1'>" |
199 | "<a href='"); | 199 | "<a href='"); |
200 | query = fmt("h=%s", sha1_to_hex(p->item->object.sha1)); | 200 | query = fmt("h=%s", sha1_to_hex(p->item->object.sha1)); |
201 | html_attr(cgit_pageurl(cgit_query_repo, "commit", query)); | 201 | html_attr(cgit_pageurl(cgit_query_repo, "commit", query)); |
202 | htmlf("'>%s</a> (<a href='", | 202 | htmlf("'>%s</a> (<a href='", |
203 | sha1_to_hex(p->item->object.sha1)); | 203 | sha1_to_hex(p->item->object.sha1)); |
204 | query = fmt("id=%s&id2=%s", sha1_to_hex(parent->tree->object.sha1), | 204 | query = fmt("id=%s&id2=%s", sha1_to_hex(parent->tree->object.sha1), |
205 | sha1_to_hex(commit->tree->object.sha1)); | 205 | sha1_to_hex(commit->tree->object.sha1)); |
206 | html_attr(cgit_pageurl(cgit_query_repo, "diff", query)); | 206 | html_attr(cgit_pageurl(cgit_query_repo, "diff", query)); |
207 | html("'>diff</a>)</td></tr>"); | 207 | html("'>diff</a>)</td></tr>"); |
208 | } | 208 | } |
209 | if (cgit_repo->snapshots) { | 209 | if (cgit_repo->snapshots) { |
210 | htmlf("<tr><th>download</th><td colspan='2' class='sha1'><a href='"); | 210 | htmlf("<tr><th>download</th><td colspan='2' class='sha1'><a href='"); |
211 | filename = fmt("%s-%s.zip", cgit_query_repo, hex); | 211 | filename = fmt("%s-%s.zip", cgit_query_repo, hex); |
212 | html_attr(cgit_pageurl(cgit_query_repo, "snapshot", | 212 | html_attr(cgit_pageurl(cgit_query_repo, "snapshot", |
213 | fmt("id=%s&name=%s", hex, filename))); | 213 | fmt("id=%s&name=%s", hex, filename))); |
214 | htmlf("'>%s</a></td></tr>", filename); | 214 | htmlf("'>%s</a></td></tr>", filename); |
215 | } | 215 | } |
216 | html("</table>\n"); | 216 | html("</table>\n"); |
217 | html("<div class='commit-subject'>"); | 217 | html("<div class='commit-subject'>"); |
218 | html_txt(info->subject); | 218 | html_txt(info->subject); |
219 | html("</div>"); | 219 | html("</div>"); |
220 | html("<div class='commit-msg'>"); | 220 | html("<div class='commit-msg'>"); |
221 | html_txt(info->msg); | 221 | html_txt(info->msg); |
222 | html("</div>"); | 222 | html("</div>"); |
223 | if (!(commit->parents && commit->parents->next && commit->parents->next->next)) { | 223 | if (!(commit->parents && commit->parents->next && commit->parents->next->next)) { |
224 | html("<div class='diffstat-header'>Diffstat</div>"); | ||
224 | html("<table class='diffstat'>"); | 225 | html("<table class='diffstat'>"); |
225 | max_changes = 0; | 226 | max_changes = 0; |
226 | cgit_diff_commit(commit, inspect_filepair); | 227 | cgit_diff_commit(commit, inspect_filepair); |
227 | for(i = 0; i<files; i++) | 228 | for(i = 0; i<files; i++) |
228 | print_fileinfo(&items[i]); | 229 | print_fileinfo(&items[i]); |
229 | html("</table>"); | 230 | html("</table>"); |
230 | html("<div class='diffstat-summary'>"); | 231 | html("<div class='diffstat-summary'>"); |
231 | htmlf("%d files changed, %d insertions, %d deletions\n", | 232 | htmlf("%d files changed, %d insertions, %d deletions (", |
232 | files, total_adds, total_rems); | 233 | files, total_adds, total_rems); |
234 | query = fmt("h=%s", hex); | ||
235 | html_link_open(cgit_pageurl(cgit_query_repo, "diff", query), NULL, NULL); | ||
236 | html("show diff</a>)"); | ||
233 | html("</div>"); | 237 | html("</div>"); |
234 | } | 238 | } |
235 | cgit_free_commitinfo(info); | 239 | cgit_free_commitinfo(info); |
236 | } | 240 | } |