From 0274b57d55a12ed38259757dbfae96b79cfa2e0b Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Sat, 29 Nov 2008 18:39:41 +0100 Subject: 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 --- ui-log.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) (limited to 'ui-log.c') diff --git a/ui-log.c b/ui-log.c index 8dd8b89..631e46d 100644 --- a/ui-log.c +++ b/ui-log.c @@ -44,8 +44,12 @@ void print_commit(struct commit *commit) cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE); html_link_close(); html(""); + if (ctx.qry.showmsg) + html(""); cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, sha1_to_hex(commit->object.sha1)); + if (ctx.qry.showmsg) + html(""); html(""); html_txt(info->author); if (ctx.repo->enable_log_filecount) { @@ -61,6 +65,17 @@ void print_commit(struct commit *commit) } } html("\n"); + if (ctx.qry.showmsg) { + html("
"); + html_txt(info->msg); + html("

"); + if (ctx.repo->enable_log_filecount) { + html(""); + if (ctx.repo->enable_log_linecount) + html(""); + } + html("\n"); + } cgit_free_commitinfo(info); } @@ -100,8 +115,15 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern html(""); html("" - "" - ""); + ""); if (ctx.repo->enable_log_filecount) { html(""); columns++; @@ -136,20 +158,20 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern cgit_log_link("[prev]", NULL, NULL, ctx.qry.head, ctx.qry.sha1, ctx.qry.path, ofs - cnt, ctx.qry.grep, - ctx.qry.search); + ctx.qry.search, ctx.qry.showmsg); html(" "); } if ((commit = get_revision(&rev)) != NULL) { cgit_log_link("[next]", NULL, NULL, ctx.qry.head, ctx.qry.sha1, ctx.qry.path, ofs + cnt, ctx.qry.grep, - ctx.qry.search); + ctx.qry.search, ctx.qry.showmsg); } html(""); } else if ((commit = get_revision(&rev)) != NULL) { html("\n"); } } -- cgit From 951f550b60befeacd7334aebd64c891e72be5ac4 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Sat, 29 Nov 2008 18:58:31 +0100 Subject: ui-log: (ab)use extra columns for commit message when showmsg=1 If the commit message has extra long lines it's better to use the author/ files/lines columns to show those lines than to push the columns of screen and force the users to hscroll. Signed-off-by: Lars Hjemli --- ui-log.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'ui-log.c') diff --git a/ui-log.c b/ui-log.c index 631e46d..adc9a66 100644 --- a/ui-log.c +++ b/ui-log.c @@ -35,6 +35,7 @@ void print_commit(struct commit *commit) { struct commitinfo *info; char *tmp; + int cols = 2; info = cgit_parse_commit(commit); html("\n"); if (ctx.qry.showmsg) { - html(""); if (ctx.repo->enable_log_filecount) { - html(""); + cols++; if (ctx.repo->enable_log_linecount) - html(""); + cols++; } - html("\n"); + htmlf("\n"); } cgit_free_commitinfo(info); } -- cgit From ab67164d6217fcda5ef3e07aefa3dd6eee6b65a3 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Sat, 29 Nov 2008 19:11:26 +0100 Subject: ui-log: use css to make full-log prettier Signed-off-by: Lars Hjemli --- cgit.css | 15 +++++++++++++++ ui-log.c | 14 ++++++-------- 2 files changed, 21 insertions(+), 8 deletions(-) (limited to 'ui-log.c') 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 { background: white; } +table.list tr.logheader { + background: #eee; +} + table.list tr:hover { background: #eee; } @@ -143,6 +147,17 @@ table.list td { padding: 0.1em 0.5em 0.1em 0.5em; } +table.list td.logsubject { + font-family: monospace; + font-weight: bold; +} + +table.list td.logmsg { + font-family: monospace; + white-space: pre; + padding: 1em 0em 2em 0em; +} + table.list td a { color: black; } diff --git a/ui-log.c b/ui-log.c index adc9a66..00ecd4e 100644 --- a/ui-log.c +++ b/ui-log.c @@ -38,19 +38,17 @@ void print_commit(struct commit *commit) int cols = 2; info = cgit_parse_commit(commit); - html("", + ctx.qry.showmsg ? " class='logsubject'" : ""); cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, sha1_to_hex(commit->object.sha1)); - if (ctx.qry.showmsg) - html(""); html("\n"); + html("\n"); } cgit_free_commitinfo(info); } -- cgit
AgeCommit messageAuthorCommit message"); + if (pager) { + html(" ("); + cgit_log_link("toggle", NULL, NULL, ctx.qry.head, ctx.qry.sha1, + ctx.qry.path, ctx.qry.ofs, ctx.qry.grep, + ctx.qry.search, ctx.qry.showmsg ? 0 : 1); + html(")"); + } + html("AuthorFiles
"); cgit_log_link("[...]", NULL, NULL, ctx.qry.head, NULL, NULL, 0, - NULL, NULL); + NULL, NULL, ctx.qry.showmsg); html("
"); @@ -66,15 +67,15 @@ void print_commit(struct commit *commit) } html("
"); - html_txt(info->msg); - html("

", + cols); + html_txt(info->msg); + html("

"); + htmlf("", + ctx.qry.showmsg ? " class='logheader'" : ""); tmp = fmt("id=%s", sha1_to_hex(commit->object.sha1)); tmp = cgit_pageurl(ctx.repo->url, "commit", tmp); html_link_open(tmp, NULL, NULL); cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE); html_link_close(); - html(""); - if (ctx.qry.showmsg) - html(""); + htmlf(""); html_txt(info->author); if (ctx.repo->enable_log_filecount) { @@ -72,10 +70,10 @@ void print_commit(struct commit *commit) if (ctx.repo->enable_log_linecount) cols++; } - htmlf("
", + htmlf("
", cols); html_txt(info->msg); - html("