author | Lars Hjemli <hjemli@gmail.com> | 2008-11-29 17:39:41 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2008-11-29 17:39:41 (UTC) |
commit | 0274b57d55a12ed38259757dbfae96b79cfa2e0b (patch) (unidiff) | |
tree | 34c7204f88168f791ef48f603bb8ab66e9df523c /ui-shared.c | |
parent | 7b5cee65fd9cf31e4f19ce4ff613778cb95512a9 (diff) | |
download | cgit-0274b57d55a12ed38259757dbfae96b79cfa2e0b.zip cgit-0274b57d55a12ed38259757dbfae96b79cfa2e0b.tar.gz cgit-0274b57d55a12ed38259757dbfae96b79cfa2e0b.tar.bz2 |
ui-log: add support for showing the full commit message
Some users prefer to see the full message, so to make these users happy
the new querystring parameter "showmsg" can be used to print the full
commit message per log entry.
A link is provided in the log heading to make this function accessible,
and all links and forms tries to preserve the users preference.
Note: the new link is not displayed on the summary page since the point
of the summary page is to be a summary, but it is still obeyed if specified
manually.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-shared.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/ui-shared.c b/ui-shared.c index 224e5f3..dc39e64 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -272,48 +272,54 @@ void cgit_tree_link(char *name, char *title, char *class, char *head, | |||
272 | char *rev, char *path) | 272 | char *rev, char *path) |
273 | { | 273 | { |
274 | reporevlink("tree", name, title, class, head, rev, path); | 274 | reporevlink("tree", name, title, class, head, rev, path); |
275 | } | 275 | } |
276 | 276 | ||
277 | void cgit_plain_link(char *name, char *title, char *class, char *head, | 277 | void cgit_plain_link(char *name, char *title, char *class, char *head, |
278 | char *rev, char *path) | 278 | char *rev, char *path) |
279 | { | 279 | { |
280 | reporevlink("plain", name, title, class, head, rev, path); | 280 | reporevlink("plain", name, title, class, head, rev, path); |
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 | ||
288 | delim = repolink(title, class, "log", head, path); | 289 | delim = repolink(title, class, "log", head, path); |
289 | if (rev && strcmp(rev, ctx.qry.head)) { | 290 | if (rev && strcmp(rev, ctx.qry.head)) { |
290 | html(delim); | 291 | html(delim); |
291 | html("id="); | 292 | html("id="); |
292 | html_url_arg(rev); | 293 | html_url_arg(rev); |
293 | delim = "&"; | 294 | delim = "&"; |
294 | } | 295 | } |
295 | if (grep && pattern) { | 296 | if (grep && pattern) { |
296 | html(delim); | 297 | html(delim); |
297 | html("qt="); | 298 | html("qt="); |
298 | html_url_arg(grep); | 299 | html_url_arg(grep); |
299 | delim = "&"; | 300 | delim = "&"; |
300 | html(delim); | 301 | html(delim); |
301 | html("q="); | 302 | html("q="); |
302 | html_url_arg(pattern); | 303 | html_url_arg(pattern); |
303 | } | 304 | } |
304 | if (ofs > 0) { | 305 | if (ofs > 0) { |
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); |
311 | html("</a>"); | 317 | html("</a>"); |
312 | } | 318 | } |
313 | 319 | ||
314 | void cgit_commit_link(char *name, char *title, char *class, char *head, | 320 | void cgit_commit_link(char *name, char *title, char *class, char *head, |
315 | char *rev) | 321 | char *rev) |
316 | { | 322 | { |
317 | if (strlen(name) > ctx.cfg.max_msg_len && ctx.cfg.max_msg_len >= 15) { | 323 | if (strlen(name) > ctx.cfg.max_msg_len && ctx.cfg.max_msg_len >= 15) { |
318 | name[ctx.cfg.max_msg_len] = '\0'; | 324 | name[ctx.cfg.max_msg_len] = '\0'; |
319 | name[ctx.cfg.max_msg_len - 1] = '.'; | 325 | name[ctx.cfg.max_msg_len - 1] = '.'; |
@@ -559,24 +565,26 @@ void add_hidden_formfields(int incl_head, int incl_search, char *page) | |||
559 | url = fmt("%s/%s", url, ctx.qry.path); | 565 | url = fmt("%s/%s", url, ctx.qry.path); |
560 | html_hidden("url", url); | 566 | html_hidden("url", url); |
561 | } | 567 | } |
562 | 568 | ||
563 | if (incl_head && ctx.qry.head && ctx.repo->defbranch && | 569 | if (incl_head && ctx.qry.head && ctx.repo->defbranch && |
564 | strcmp(ctx.qry.head, ctx.repo->defbranch)) | 570 | strcmp(ctx.qry.head, ctx.repo->defbranch)) |
565 | html_hidden("h", ctx.qry.head); | 571 | html_hidden("h", ctx.qry.head); |
566 | 572 | ||
567 | if (ctx.qry.sha1) | 573 | if (ctx.qry.sha1) |
568 | html_hidden("id", ctx.qry.sha1); | 574 | html_hidden("id", ctx.qry.sha1); |
569 | if (ctx.qry.sha2) | 575 | if (ctx.qry.sha2) |
570 | html_hidden("id2", ctx.qry.sha2); | 576 | html_hidden("id2", ctx.qry.sha2); |
577 | if (ctx.qry.showmsg) | ||
578 | html_hidden("showmsg", "1"); | ||
571 | 579 | ||
572 | if (incl_search) { | 580 | if (incl_search) { |
573 | if (ctx.qry.grep) | 581 | if (ctx.qry.grep) |
574 | html_hidden("qt", ctx.qry.grep); | 582 | html_hidden("qt", ctx.qry.grep); |
575 | if (ctx.qry.search) | 583 | if (ctx.qry.search) |
576 | html_hidden("q", ctx.qry.search); | 584 | html_hidden("q", ctx.qry.search); |
577 | } | 585 | } |
578 | } | 586 | } |
579 | 587 | ||
580 | char *hc(struct cgit_cmd *cmd, const char *page) | 588 | char *hc(struct cgit_cmd *cmd, const char *page) |
581 | { | 589 | { |
582 | return (strcmp(cmd->name, page) ? NULL : "active"); | 590 | return (strcmp(cmd->name, page) ? NULL : "active"); |
@@ -625,25 +633,25 @@ void cgit_print_pageheader(struct cgit_context *ctx) | |||
625 | else if (ctx->cfg.index_info) | 633 | else if (ctx->cfg.index_info) |
626 | html_include(ctx->cfg.index_info); | 634 | html_include(ctx->cfg.index_info); |
627 | } | 635 | } |
628 | html("</td></tr></table>\n"); | 636 | html("</td></tr></table>\n"); |
629 | 637 | ||
630 | html("<table class='tabs'><tr><td>\n"); | 638 | html("<table class='tabs'><tr><td>\n"); |
631 | if (ctx->repo) { | 639 | if (ctx->repo) { |
632 | cgit_summary_link("summary", NULL, hc(cmd, "summary"), | 640 | cgit_summary_link("summary", NULL, hc(cmd, "summary"), |
633 | ctx->qry.head); | 641 | ctx->qry.head); |
634 | cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head, | 642 | cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head, |
635 | ctx->qry.sha1, NULL); | 643 | ctx->qry.sha1, NULL); |
636 | cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head, | 644 | cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head, |
637 | NULL, NULL, 0, NULL, NULL); | 645 | NULL, NULL, 0, NULL, NULL, ctx->qry.showmsg); |
638 | cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head, | 646 | cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head, |
639 | ctx->qry.sha1, NULL); | 647 | ctx->qry.sha1, NULL); |
640 | cgit_commit_link("commit", NULL, hc(cmd, "commit"), | 648 | cgit_commit_link("commit", NULL, hc(cmd, "commit"), |
641 | ctx->qry.head, ctx->qry.sha1); | 649 | ctx->qry.head, ctx->qry.sha1); |
642 | cgit_diff_link("diff", NULL, hc(cmd, "diff"), ctx->qry.head, | 650 | cgit_diff_link("diff", NULL, hc(cmd, "diff"), ctx->qry.head, |
643 | ctx->qry.sha1, ctx->qry.sha2, NULL); | 651 | ctx->qry.sha1, ctx->qry.sha2, NULL); |
644 | if (ctx->repo->readme) | 652 | if (ctx->repo->readme) |
645 | reporevlink("about", "about", NULL, | 653 | reporevlink("about", "about", NULL, |
646 | hc(cmd, "about"), ctx->qry.head, NULL, | 654 | hc(cmd, "about"), ctx->qry.head, NULL, |
647 | NULL); | 655 | NULL); |
648 | html("</td><td class='form'>"); | 656 | html("</td><td class='form'>"); |
649 | html("<form class='right' method='get' action='"); | 657 | html("<form class='right' method='get' action='"); |