diff options
| author | 2008-04-15 05:13:38 (JST) | |
|---|---|---|
| committer | 2008-04-15 05:13:38 (JST) | |
| commit | 5764fe95469f65fdee285467f0f87d188fc1a780 (patch) | |
| tree | 0dc9e9545bd8b43fbf1a571f3ef239ff3aea771c | |
| parent | 35d19bbb641aa56a21fb2c238994716c272e154f (diff) | |
| download | cgit-5764fe95469f65fdee285467f0f87d188fc1a780.zip cgit-5764fe95469f65fdee285467f0f87d188fc1a780.tar.gz | |
Make branches, tags and log play better together in the summary view
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
| -rw-r--r-- | ui-log.c | 42 | ||||
| -rw-r--r-- | ui-refs.c | 25 | ||||
| -rw-r--r-- | ui-summary.c | 10 |
3 files changed, 43 insertions, 34 deletions
| @@ -41,32 +41,33 @@ void print_commit(struct commit *commit) | |||
| 41 | html("</td><td>"); | 41 | html("</td><td>"); |
| 42 | cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, | 42 | cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, |
| 43 | sha1_to_hex(commit->object.sha1)); | 43 | sha1_to_hex(commit->object.sha1)); |
| 44 | html("</td><td>"); | ||
| 45 | html_txt(info->author); | ||
| 44 | if (ctx.repo->enable_log_filecount) { | 46 | if (ctx.repo->enable_log_filecount) { |
| 45 | files = 0; | 47 | files = 0; |
| 46 | add_lines = 0; | 48 | add_lines = 0; |
| 47 | rem_lines = 0; | 49 | rem_lines = 0; |
| 48 | cgit_diff_commit(commit, inspect_files); | 50 | cgit_diff_commit(commit, inspect_files); |
| 49 | html("</td><td class='right'>"); | 51 | html("</td><td>"); |
| 50 | htmlf("%d", files); | 52 | htmlf("%d", files); |
| 51 | if (ctx.repo->enable_log_linecount) { | 53 | if (ctx.repo->enable_log_linecount) { |
| 52 | html("</td><td class='right'>"); | 54 | html("</td><td>"); |
| 53 | htmlf("-%d/+%d", rem_lines, add_lines); | 55 | htmlf("-%d/+%d", rem_lines, add_lines); |
| 54 | } | 56 | } |
| 55 | } | 57 | } |
| 56 | html("</td><td>"); | ||
| 57 | html_txt(info->author); | ||
| 58 | html("</td></tr>\n"); | 58 | html("</td></tr>\n"); |
| 59 | cgit_free_commitinfo(info); | 59 | cgit_free_commitinfo(info); |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | 62 | ||
| 63 | void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern, char *path, int pager) | 63 | void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern, |
| 64 | char *path, int pager) | ||
| 64 | { | 65 | { |
| 65 | struct rev_info rev; | 66 | struct rev_info rev; |
| 66 | struct commit *commit; | 67 | struct commit *commit; |
| 67 | const char *argv[] = {NULL, tip, NULL, NULL, NULL}; | 68 | const char *argv[] = {NULL, tip, NULL, NULL, NULL}; |
| 68 | int argc = 2; | 69 | int argc = 2; |
| 69 | int i; | 70 | int i, columns = 3; |
| 70 | 71 | ||
| 71 | if (!tip) | 72 | if (!tip) |
| 72 | argv[1] = ctx.qry.head; | 73 | argv[1] = ctx.qry.head; |
| @@ -92,16 +93,21 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern | |||
| 92 | } | 93 | } |
| 93 | prepare_revision_walk(&rev); | 94 | prepare_revision_walk(&rev); |
| 94 | 95 | ||
| 95 | html("<table summary='log' class='list nowrap'>"); | 96 | if (pager) |
| 96 | html("<tr class='nohover'><th class='left'>Age</th>" | 97 | html("<table class='list nowrap'>"); |
| 97 | "<th class='left'>Message</th>"); | ||
| 98 | 98 | ||
| 99 | html("<tr class='nohover'><th class='left'>Age</th>" | ||
| 100 | "<th class='left'>Commit message</th>" | ||
| 101 | "<th class='left'>Author</th>"); | ||
| 99 | if (ctx.repo->enable_log_filecount) { | 102 | if (ctx.repo->enable_log_filecount) { |
| 100 | html("<th class='right'>Files</th>"); | 103 | html("<th class='left'>Files</th>"); |
| 101 | if (ctx.repo->enable_log_linecount) | 104 | columns++; |
| 102 | html("<th class='right'>Lines</th>"); | 105 | if (ctx.repo->enable_log_linecount) { |
| 106 | html("<th class='left'>Lines</th>"); | ||
| 107 | columns++; | ||
| 108 | } | ||
| 103 | } | 109 | } |
| 104 | html("<th class='left'>Author</th></tr>\n"); | 110 | html("</tr>\n"); |
| 105 | 111 | ||
| 106 | if (ofs<0) | 112 | if (ofs<0) |
| 107 | ofs = 0; | 113 | ofs = 0; |
| @@ -120,10 +126,9 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern | |||
| 120 | free_commit_list(commit->parents); | 126 | free_commit_list(commit->parents); |
| 121 | commit->parents = NULL; | 127 | commit->parents = NULL; |
| 122 | } | 128 | } |
| 123 | html("</table>\n"); | ||
| 124 | |||
| 125 | if (pager) { | 129 | if (pager) { |
| 126 | html("<div class='pager'>"); | 130 | htmlf("</table><div class='pager'>", |
| 131 | columns); | ||
| 127 | if (ofs > 0) { | 132 | if (ofs > 0) { |
| 128 | cgit_log_link("[prev]", NULL, NULL, ctx.qry.head, | 133 | cgit_log_link("[prev]", NULL, NULL, ctx.qry.head, |
| 129 | ctx.qry.sha1, ctx.qry.path, | 134 | ctx.qry.sha1, ctx.qry.path, |
| @@ -138,5 +143,10 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern | |||
| 138 | ctx.qry.search); | 143 | ctx.qry.search); |
| 139 | } | 144 | } |
| 140 | html("</div>"); | 145 | html("</div>"); |
| 146 | } else if ((commit = get_revision(&rev)) != NULL) { | ||
| 147 | html("<tr class='nohover'><td colspan='3'>"); | ||
| 148 | cgit_log_link("[...]", NULL, NULL, ctx.qry.head, NULL, NULL, 0, | ||
| 149 | NULL, NULL); | ||
| 150 | html("</td></tr>\n"); | ||
| 141 | } | 151 | } |
| 142 | } | 152 | } |
| @@ -62,11 +62,11 @@ static int print_branch(struct refinfo *ref) | |||
| 62 | html("</td><td>"); | 62 | html("</td><td>"); |
| 63 | 63 | ||
| 64 | if (ref->object->type == OBJ_COMMIT) { | 64 | if (ref->object->type == OBJ_COMMIT) { |
| 65 | cgit_print_age(info->commit->date, -1, NULL); | 65 | cgit_commit_link(info->subject, NULL, NULL, name, NULL); |
| 66 | html("</td><td>"); | 66 | html("</td><td>"); |
| 67 | html_txt(info->author); | 67 | html_txt(info->author); |
| 68 | html("</td><td>"); | 68 | html("</td><td colspan='2'>"); |
| 69 | cgit_commit_link(info->subject, NULL, NULL, name, NULL); | 69 | cgit_print_age(info->commit->date, -1, NULL); |
| 70 | } else { | 70 | } else { |
| 71 | html("</td><td></td><td>"); | 71 | html("</td><td></td><td>"); |
| 72 | cgit_object_link(ref->object); | 72 | cgit_object_link(ref->object); |
| @@ -78,9 +78,9 @@ static int print_branch(struct refinfo *ref) | |||
| 78 | static void print_tag_header() | 78 | static void print_tag_header() |
| 79 | { | 79 | { |
| 80 | html("<tr class='nohover'><th class='left'>Tag</th>" | 80 | html("<tr class='nohover'><th class='left'>Tag</th>" |
| 81 | "<th class='left'>Age</th>" | 81 | "<th class='left'>Reference</th>" |
| 82 | "<th class='left'>Author</th>" | 82 | "<th class='left'>Author</th>" |
| 83 | "<th class='left'>Reference</th></tr>\n"); | 83 | "<th class='left' colspan='2'>Age</th></tr>\n"); |
| 84 | header = 1; | 84 | header = 1; |
| 85 | } | 85 | } |
| 86 | 86 | ||
| @@ -102,20 +102,20 @@ static int print_tag(struct refinfo *ref) | |||
| 102 | html_txt(name); | 102 | html_txt(name); |
| 103 | html_link_close(); | 103 | html_link_close(); |
| 104 | html("</td><td>"); | 104 | html("</td><td>"); |
| 105 | if (info->tagger_date > 0) | 105 | cgit_object_link(tag->tagged); |
| 106 | cgit_print_age(info->tagger_date, -1, NULL); | ||
| 107 | html("</td><td>"); | 106 | html("</td><td>"); |
| 108 | if (info->tagger) | 107 | if (info->tagger) |
| 109 | html(info->tagger); | 108 | html(info->tagger); |
| 110 | html("</td><td>"); | 109 | html("</td><td colspan='2'>"); |
| 111 | cgit_object_link(tag->tagged); | 110 | if (info->tagger_date > 0) |
| 111 | cgit_print_age(info->tagger_date, -1, NULL); | ||
| 112 | html("</td></tr>\n"); | 112 | html("</td></tr>\n"); |
| 113 | } else { | 113 | } else { |
| 114 | if (!header) | 114 | if (!header) |
| 115 | print_tag_header(); | 115 | print_tag_header(); |
| 116 | html("<tr><td>"); | 116 | html("<tr><td>"); |
| 117 | html_txt(name); | 117 | html_txt(name); |
| 118 | html("</td><td colspan='2'/><td>"); | 118 | html("</td><td>"); |
| 119 | cgit_object_link(ref->object); | 119 | cgit_object_link(ref->object); |
| 120 | html("</td></tr>\n"); | 120 | html("</td></tr>\n"); |
| 121 | } | 121 | } |
| @@ -135,9 +135,9 @@ void cgit_print_branches(int maxcount) | |||
| 135 | int i; | 135 | int i; |
| 136 | 136 | ||
| 137 | html("<tr class='nohover'><th class='left'>Branch</th>" | 137 | html("<tr class='nohover'><th class='left'>Branch</th>" |
| 138 | "<th class='left'>Idle</th>" | 138 | "<th class='left'>Commit message</th>" |
| 139 | "<th class='left'>Author</th>" | 139 | "<th class='left'>Author</th>" |
| 140 | "<th class='left'>Head commit</th></tr>\n"); | 140 | "<th class='left' colspan='2'>Age</th></tr>\n"); |
| 141 | 141 | ||
| 142 | list.refs = NULL; | 142 | list.refs = NULL; |
| 143 | list.alloc = list.count = 0; | 143 | list.alloc = list.count = 0; |
| @@ -196,6 +196,5 @@ void cgit_print_refs() | |||
| 196 | html("<tr class='nohover'><td colspan='4'> </td></tr>"); | 196 | html("<tr class='nohover'><td colspan='4'> </td></tr>"); |
| 197 | cgit_print_tags(0); | 197 | cgit_print_tags(0); |
| 198 | } | 198 | } |
| 199 | |||
| 200 | html("</table>"); | 199 | html("</table>"); |
| 201 | } | 200 | } |
diff --git a/ui-summary.c b/ui-summary.c index 0b66b52..318148a 100644 --- a/ui-summary.c +++ b/ui-summary.c | |||
| @@ -18,14 +18,14 @@ void cgit_print_summary() | |||
| 18 | html_include(ctx.repo->readme); | 18 | html_include(ctx.repo->readme); |
| 19 | html("</div>"); | 19 | html("</div>"); |
| 20 | } | 20 | } |
| 21 | if (ctx.cfg.summary_log > 0) | ||
| 22 | cgit_print_log(ctx.qry.head, 0, ctx.cfg.summary_log, NULL, | ||
| 23 | NULL, NULL, 0); | ||
| 24 | html("<table summary='repository info' class='list nowrap'>"); | 21 | html("<table summary='repository info' class='list nowrap'>"); |
| 25 | if (ctx.cfg.summary_log > 0) | ||
| 26 | html("<tr class='nohover'><td colspan='4'> </td></tr>"); | ||
| 27 | cgit_print_branches(ctx.cfg.summary_branches); | 22 | cgit_print_branches(ctx.cfg.summary_branches); |
| 28 | html("<tr class='nohover'><td colspan='4'> </td></tr>"); | 23 | html("<tr class='nohover'><td colspan='4'> </td></tr>"); |
| 29 | cgit_print_tags(ctx.cfg.summary_tags); | 24 | cgit_print_tags(ctx.cfg.summary_tags); |
| 25 | if (ctx.cfg.summary_log > 0) { | ||
| 26 | html("<tr class='nohover'><td colspan='4'> </td></tr>"); | ||
| 27 | cgit_print_log(ctx.qry.head, 0, ctx.cfg.summary_log, NULL, | ||
| 28 | NULL, NULL, 0); | ||
| 29 | } | ||
| 30 | html("</table>"); | 30 | html("</table>"); |
| 31 | } | 31 | } |
