author | Justin Waters <justin.waters@timesys.com> | 2009-01-09 22:35:10 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2009-01-11 11:52:38 (UTC) |
commit | 1383fe3fa60b4c207d103a49943a59de71a36fe1 (patch) (unidiff) | |
tree | d967bb5589949a4ff7862bc99efec88fa6437b51 | |
parent | aa60ae12cb3db965b3fe7239424cab92175b8343 (diff) | |
download | cgit-1383fe3fa60b4c207d103a49943a59de71a36fe1.zip cgit-1383fe3fa60b4c207d103a49943a59de71a36fe1.tar.gz cgit-1383fe3fa60b4c207d103a49943a59de71a36fe1.tar.bz2 |
Change toggle to more meaningful term
In the log interface, there is a toggle link at the top, but it isn't clear
what's being toggled. I've changed it to "Expand" and "Collapse" to make it
clear that you are getting more and less information, respectively.
Signed-off-by: Justin Waters <justin.waters@timesys.com>
-rw-r--r-- | ui-log.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -40,185 +40,186 @@ void show_commit_decorations(struct commit *commit) | |||
40 | deco = lookup_decoration(&name_decoration, &commit->object); | 40 | deco = lookup_decoration(&name_decoration, &commit->object); |
41 | while (deco) { | 41 | while (deco) { |
42 | if (!prefixcmp(deco->name, "refs/heads/")) { | 42 | if (!prefixcmp(deco->name, "refs/heads/")) { |
43 | strncpy(buf, deco->name + 11, sizeof(buf) - 1); | 43 | strncpy(buf, deco->name + 11, sizeof(buf) - 1); |
44 | cgit_log_link(buf, NULL, "branch-deco", buf, NULL, NULL, | 44 | cgit_log_link(buf, NULL, "branch-deco", buf, NULL, NULL, |
45 | 0, NULL, NULL, ctx.qry.showmsg); | 45 | 0, NULL, NULL, ctx.qry.showmsg); |
46 | } | 46 | } |
47 | else if (!prefixcmp(deco->name, "tag: refs/tags/")) { | 47 | else if (!prefixcmp(deco->name, "tag: refs/tags/")) { |
48 | strncpy(buf, deco->name + 15, sizeof(buf) - 1); | 48 | strncpy(buf, deco->name + 15, sizeof(buf) - 1); |
49 | cgit_tag_link(buf, NULL, "tag-deco", ctx.qry.head, buf); | 49 | cgit_tag_link(buf, NULL, "tag-deco", ctx.qry.head, buf); |
50 | } | 50 | } |
51 | else if (!prefixcmp(deco->name, "refs/remotes/")) { | 51 | else if (!prefixcmp(deco->name, "refs/remotes/")) { |
52 | strncpy(buf, deco->name + 13, sizeof(buf) - 1); | 52 | strncpy(buf, deco->name + 13, sizeof(buf) - 1); |
53 | cgit_log_link(buf, NULL, "remote-deco", NULL, | 53 | cgit_log_link(buf, NULL, "remote-deco", NULL, |
54 | sha1_to_hex(commit->object.sha1), NULL, | 54 | sha1_to_hex(commit->object.sha1), NULL, |
55 | 0, NULL, NULL, ctx.qry.showmsg); | 55 | 0, NULL, NULL, ctx.qry.showmsg); |
56 | } | 56 | } |
57 | else { | 57 | else { |
58 | strncpy(buf, deco->name, sizeof(buf) - 1); | 58 | strncpy(buf, deco->name, sizeof(buf) - 1); |
59 | cgit_commit_link(buf, NULL, "deco", ctx.qry.head, | 59 | cgit_commit_link(buf, NULL, "deco", ctx.qry.head, |
60 | sha1_to_hex(commit->object.sha1)); | 60 | sha1_to_hex(commit->object.sha1)); |
61 | } | 61 | } |
62 | deco = deco->next; | 62 | deco = deco->next; |
63 | } | 63 | } |
64 | } | 64 | } |
65 | 65 | ||
66 | void print_commit(struct commit *commit) | 66 | void print_commit(struct commit *commit) |
67 | { | 67 | { |
68 | struct commitinfo *info; | 68 | struct commitinfo *info; |
69 | char *tmp; | 69 | char *tmp; |
70 | int cols = 2; | 70 | int cols = 2; |
71 | 71 | ||
72 | info = cgit_parse_commit(commit); | 72 | info = cgit_parse_commit(commit); |
73 | htmlf("<tr%s><td>", | 73 | htmlf("<tr%s><td>", |
74 | ctx.qry.showmsg ? " class='logheader'" : ""); | 74 | ctx.qry.showmsg ? " class='logheader'" : ""); |
75 | tmp = fmt("id=%s", sha1_to_hex(commit->object.sha1)); | 75 | tmp = fmt("id=%s", sha1_to_hex(commit->object.sha1)); |
76 | tmp = cgit_pageurl(ctx.repo->url, "commit", tmp); | 76 | tmp = cgit_pageurl(ctx.repo->url, "commit", tmp); |
77 | html_link_open(tmp, NULL, NULL); | 77 | html_link_open(tmp, NULL, NULL); |
78 | cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE); | 78 | cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE); |
79 | html_link_close(); | 79 | html_link_close(); |
80 | htmlf("</td><td%s>", | 80 | htmlf("</td><td%s>", |
81 | ctx.qry.showmsg ? " class='logsubject'" : ""); | 81 | ctx.qry.showmsg ? " class='logsubject'" : ""); |
82 | cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, | 82 | cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, |
83 | sha1_to_hex(commit->object.sha1)); | 83 | sha1_to_hex(commit->object.sha1)); |
84 | show_commit_decorations(commit); | 84 | show_commit_decorations(commit); |
85 | html("</td><td>"); | 85 | html("</td><td>"); |
86 | html_txt(info->author); | 86 | html_txt(info->author); |
87 | if (ctx.repo->enable_log_filecount) { | 87 | if (ctx.repo->enable_log_filecount) { |
88 | files = 0; | 88 | files = 0; |
89 | add_lines = 0; | 89 | add_lines = 0; |
90 | rem_lines = 0; | 90 | rem_lines = 0; |
91 | cgit_diff_commit(commit, inspect_files); | 91 | cgit_diff_commit(commit, inspect_files); |
92 | html("</td><td>"); | 92 | html("</td><td>"); |
93 | htmlf("%d", files); | 93 | htmlf("%d", files); |
94 | if (ctx.repo->enable_log_linecount) { | 94 | if (ctx.repo->enable_log_linecount) { |
95 | html("</td><td>"); | 95 | html("</td><td>"); |
96 | htmlf("-%d/+%d", rem_lines, add_lines); | 96 | htmlf("-%d/+%d", rem_lines, add_lines); |
97 | } | 97 | } |
98 | } | 98 | } |
99 | html("</td></tr>\n"); | 99 | html("</td></tr>\n"); |
100 | if (ctx.qry.showmsg) { | 100 | if (ctx.qry.showmsg) { |
101 | if (ctx.repo->enable_log_filecount) { | 101 | if (ctx.repo->enable_log_filecount) { |
102 | cols++; | 102 | cols++; |
103 | if (ctx.repo->enable_log_linecount) | 103 | if (ctx.repo->enable_log_linecount) |
104 | cols++; | 104 | cols++; |
105 | } | 105 | } |
106 | htmlf("<tr class='nohover'><td/><td colspan='%d' class='logmsg'>", | 106 | htmlf("<tr class='nohover'><td/><td colspan='%d' class='logmsg'>", |
107 | cols); | 107 | cols); |
108 | html_txt(info->msg); | 108 | html_txt(info->msg); |
109 | html("</td></tr>\n"); | 109 | html("</td></tr>\n"); |
110 | } | 110 | } |
111 | cgit_free_commitinfo(info); | 111 | cgit_free_commitinfo(info); |
112 | } | 112 | } |
113 | 113 | ||
114 | static const char *disambiguate_ref(const char *ref) | 114 | static const char *disambiguate_ref(const char *ref) |
115 | { | 115 | { |
116 | unsigned char sha1[20]; | 116 | unsigned char sha1[20]; |
117 | const char *longref; | 117 | const char *longref; |
118 | 118 | ||
119 | longref = fmt("refs/heads/%s", ref); | 119 | longref = fmt("refs/heads/%s", ref); |
120 | if (get_sha1(longref, sha1) == 0) | 120 | if (get_sha1(longref, sha1) == 0) |
121 | return longref; | 121 | return longref; |
122 | 122 | ||
123 | return ref; | 123 | return ref; |
124 | } | 124 | } |
125 | 125 | ||
126 | void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern, | 126 | void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern, |
127 | char *path, int pager) | 127 | char *path, int pager) |
128 | { | 128 | { |
129 | struct rev_info rev; | 129 | struct rev_info rev; |
130 | struct commit *commit; | 130 | struct commit *commit; |
131 | const char *argv[] = {NULL, NULL, NULL, NULL, NULL}; | 131 | const char *argv[] = {NULL, NULL, NULL, NULL, NULL}; |
132 | int argc = 2; | 132 | int argc = 2; |
133 | int i, columns = 3; | 133 | int i, columns = 3; |
134 | 134 | ||
135 | if (!tip) | 135 | if (!tip) |
136 | tip = ctx.qry.head; | 136 | tip = ctx.qry.head; |
137 | 137 | ||
138 | argv[1] = disambiguate_ref(tip); | 138 | argv[1] = disambiguate_ref(tip); |
139 | 139 | ||
140 | if (grep && pattern && (!strcmp(grep, "grep") || | 140 | if (grep && pattern && (!strcmp(grep, "grep") || |
141 | !strcmp(grep, "author") || | 141 | !strcmp(grep, "author") || |
142 | !strcmp(grep, "committer"))) | 142 | !strcmp(grep, "committer"))) |
143 | argv[argc++] = fmt("--%s=%s", grep, pattern); | 143 | argv[argc++] = fmt("--%s=%s", grep, pattern); |
144 | 144 | ||
145 | if (path) { | 145 | if (path) { |
146 | argv[argc++] = "--"; | 146 | argv[argc++] = "--"; |
147 | argv[argc++] = path; | 147 | argv[argc++] = path; |
148 | } | 148 | } |
149 | init_revisions(&rev, NULL); | 149 | init_revisions(&rev, NULL); |
150 | rev.abbrev = DEFAULT_ABBREV; | 150 | rev.abbrev = DEFAULT_ABBREV; |
151 | rev.commit_format = CMIT_FMT_DEFAULT; | 151 | rev.commit_format = CMIT_FMT_DEFAULT; |
152 | rev.verbose_header = 1; | 152 | rev.verbose_header = 1; |
153 | rev.show_root_diff = 0; | 153 | rev.show_root_diff = 0; |
154 | setup_revisions(argc, argv, &rev, NULL); | 154 | setup_revisions(argc, argv, &rev, NULL); |
155 | load_ref_decorations(); | 155 | load_ref_decorations(); |
156 | rev.show_decorations = 1; | 156 | rev.show_decorations = 1; |
157 | rev.grep_filter.regflags |= REG_ICASE; | 157 | rev.grep_filter.regflags |= REG_ICASE; |
158 | compile_grep_patterns(&rev.grep_filter); | 158 | compile_grep_patterns(&rev.grep_filter); |
159 | prepare_revision_walk(&rev); | 159 | prepare_revision_walk(&rev); |
160 | 160 | ||
161 | if (pager) | 161 | if (pager) |
162 | html("<table class='list nowrap'>"); | 162 | html("<table class='list nowrap'>"); |
163 | 163 | ||
164 | html("<tr class='nohover'><th class='left'>Age</th>" | 164 | html("<tr class='nohover'><th class='left'>Age</th>" |
165 | "<th class='left'>Commit message"); | 165 | "<th class='left'>Commit message"); |
166 | if (pager) { | 166 | if (pager) { |
167 | html(" ("); | 167 | html(" ("); |
168 | cgit_log_link("toggle", NULL, NULL, ctx.qry.head, ctx.qry.sha1, | 168 | cgit_log_link(ctx.qry.showmsg ? "Collapse" : "Expand", NULL, |
169 | NULL, ctx.qry.head, ctx.qry.sha1, | ||
169 | ctx.qry.path, ctx.qry.ofs, ctx.qry.grep, | 170 | ctx.qry.path, ctx.qry.ofs, ctx.qry.grep, |
170 | ctx.qry.search, ctx.qry.showmsg ? 0 : 1); | 171 | ctx.qry.search, ctx.qry.showmsg ? 0 : 1); |
171 | html(")"); | 172 | html(")"); |
172 | } | 173 | } |
173 | html("</th><th class='left'>Author</th>"); | 174 | html("</th><th class='left'>Author</th>"); |
174 | if (ctx.repo->enable_log_filecount) { | 175 | if (ctx.repo->enable_log_filecount) { |
175 | html("<th class='left'>Files</th>"); | 176 | html("<th class='left'>Files</th>"); |
176 | columns++; | 177 | columns++; |
177 | if (ctx.repo->enable_log_linecount) { | 178 | if (ctx.repo->enable_log_linecount) { |
178 | html("<th class='left'>Lines</th>"); | 179 | html("<th class='left'>Lines</th>"); |
179 | columns++; | 180 | columns++; |
180 | } | 181 | } |
181 | } | 182 | } |
182 | html("</tr>\n"); | 183 | html("</tr>\n"); |
183 | 184 | ||
184 | if (ofs<0) | 185 | if (ofs<0) |
185 | ofs = 0; | 186 | ofs = 0; |
186 | 187 | ||
187 | for (i = 0; i < ofs && (commit = get_revision(&rev)) != NULL; i++) { | 188 | for (i = 0; i < ofs && (commit = get_revision(&rev)) != NULL; i++) { |
188 | free(commit->buffer); | 189 | free(commit->buffer); |
189 | commit->buffer = NULL; | 190 | commit->buffer = NULL; |
190 | free_commit_list(commit->parents); | 191 | free_commit_list(commit->parents); |
191 | commit->parents = NULL; | 192 | commit->parents = NULL; |
192 | } | 193 | } |
193 | 194 | ||
194 | for (i = 0; i < cnt && (commit = get_revision(&rev)) != NULL; i++) { | 195 | for (i = 0; i < cnt && (commit = get_revision(&rev)) != NULL; i++) { |
195 | print_commit(commit); | 196 | print_commit(commit); |
196 | free(commit->buffer); | 197 | free(commit->buffer); |
197 | commit->buffer = NULL; | 198 | commit->buffer = NULL; |
198 | free_commit_list(commit->parents); | 199 | free_commit_list(commit->parents); |
199 | commit->parents = NULL; | 200 | commit->parents = NULL; |
200 | } | 201 | } |
201 | if (pager) { | 202 | if (pager) { |
202 | htmlf("</table><div class='pager'>", | 203 | htmlf("</table><div class='pager'>", |
203 | columns); | 204 | columns); |
204 | if (ofs > 0) { | 205 | if (ofs > 0) { |
205 | cgit_log_link("[prev]", NULL, NULL, ctx.qry.head, | 206 | cgit_log_link("[prev]", NULL, NULL, ctx.qry.head, |
206 | ctx.qry.sha1, ctx.qry.path, | 207 | ctx.qry.sha1, ctx.qry.path, |
207 | ofs - cnt, ctx.qry.grep, | 208 | ofs - cnt, ctx.qry.grep, |
208 | ctx.qry.search, ctx.qry.showmsg); | 209 | ctx.qry.search, ctx.qry.showmsg); |
209 | html(" "); | 210 | html(" "); |
210 | } | 211 | } |
211 | if ((commit = get_revision(&rev)) != NULL) { | 212 | if ((commit = get_revision(&rev)) != NULL) { |
212 | cgit_log_link("[next]", NULL, NULL, ctx.qry.head, | 213 | cgit_log_link("[next]", NULL, NULL, ctx.qry.head, |
213 | ctx.qry.sha1, ctx.qry.path, | 214 | ctx.qry.sha1, ctx.qry.path, |
214 | ofs + cnt, ctx.qry.grep, | 215 | ofs + cnt, ctx.qry.grep, |
215 | ctx.qry.search, ctx.qry.showmsg); | 216 | ctx.qry.search, ctx.qry.showmsg); |
216 | } | 217 | } |
217 | html("</div>"); | 218 | html("</div>"); |
218 | } else if ((commit = get_revision(&rev)) != NULL) { | 219 | } else if ((commit = get_revision(&rev)) != NULL) { |
219 | html("<tr class='nohover'><td colspan='3'>"); | 220 | html("<tr class='nohover'><td colspan='3'>"); |
220 | cgit_log_link("[...]", NULL, NULL, ctx.qry.head, NULL, NULL, 0, | 221 | cgit_log_link("[...]", NULL, NULL, ctx.qry.head, NULL, NULL, 0, |
221 | NULL, NULL, ctx.qry.showmsg); | 222 | NULL, NULL, ctx.qry.showmsg); |
222 | html("</td></tr>\n"); | 223 | html("</td></tr>\n"); |
223 | } | 224 | } |
224 | } | 225 | } |