summaryrefslogtreecommitdiffabout
path: root/ui-summary.c
Unidiff
Diffstat (limited to 'ui-summary.c') (more/less context) (ignore whitespace changes)
-rw-r--r--ui-summary.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/ui-summary.c b/ui-summary.c
index 43582da..3d5eda8 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -133,79 +133,83 @@ static int cgit_print_archive_cb(const char *refname, const unsigned char *sha1,
133 html("<table id='downloads'>"); 133 html("<table id='downloads'>");
134 html("<tr><th>Downloads</th></tr>"); 134 html("<tr><th>Downloads</th></tr>");
135 header = 1; 135 header = 1;
136 } 136 }
137 html("<tr><td>"); 137 html("<tr><td>");
138 url = cgit_pageurl(cgit_query_repo, "blob", 138 url = cgit_pageurl(cgit_query_repo, "blob",
139 fmt("id=%s&amp;path=%s", sha1_to_hex(fileid), 139 fmt("id=%s&amp;path=%s", sha1_to_hex(fileid),
140 buf)); 140 buf));
141 html_link_open(url, NULL, NULL); 141 html_link_open(url, NULL, NULL);
142 html_txt(buf); 142 html_txt(buf);
143 html_link_close(); 143 html_link_close();
144 html("</td></tr>"); 144 html("</td></tr>");
145 return 0; 145 return 0;
146} 146}
147 147
148static void cgit_print_branches() 148static void cgit_print_branches()
149{ 149{
150 struct reflist list; 150 struct reflist list;
151 int i; 151 int i;
152 152
153 html("<tr class='nohover'><th class='left'>Branch</th>" 153 html("<tr class='nohover'><th class='left'>Branch</th>"
154 "<th class='left'>Idle</th>" 154 "<th class='left'>Idle</th>"
155 "<th class='left'>Author</th>" 155 "<th class='left'>Author</th>"
156 "<th class='left'>Head commit</th></tr>\n"); 156 "<th class='left'>Head commit</th></tr>\n");
157 157
158 list.refs = NULL; 158 list.refs = NULL;
159 list.alloc = list.count = 0; 159 list.alloc = list.count = 0;
160 for_each_branch_ref(cgit_refs_cb, &list); 160 for_each_branch_ref(cgit_refs_cb, &list);
161 for(i=0; i<list.count; i++) 161 for(i=0; i<list.count; i++)
162 cgit_print_branch(list.refs[i]); 162 cgit_print_branch(list.refs[i]);
163} 163}
164 164
165static void cgit_print_tags() 165static void cgit_print_tags(int maxcount)
166{ 166{
167 struct reflist list; 167 struct reflist list;
168 int i; 168 int i;
169 169
170 header = 0; 170 header = 0;
171 list.refs = NULL; 171 list.refs = NULL;
172 list.alloc = list.count = 0; 172 list.alloc = list.count = 0;
173 for_each_tag_ref(cgit_refs_cb, &list); 173 for_each_tag_ref(cgit_refs_cb, &list);
174 if (list.count == 0) 174 if (list.count == 0)
175 return; 175 return;
176 qsort(list.refs, list.count, sizeof(*list.refs), cmp_tag_age); 176 qsort(list.refs, list.count, sizeof(*list.refs), cmp_tag_age);
177 if (!maxcount)
178 maxcount = list.count;
179 else if (maxcount > list.count)
180 maxcount = list.count;
177 print_tag_header(); 181 print_tag_header();
178 for(i=0; i<list.count; i++) 182 for(i=0; i<maxcount; i++)
179 print_tag(list.refs[i]); 183 print_tag(list.refs[i]);
180} 184}
181 185
182static void cgit_print_archives() 186static void cgit_print_archives()
183{ 187{
184 header = 0; 188 header = 0;
185 for_each_ref(cgit_print_archive_cb, NULL); 189 for_each_ref(cgit_print_archive_cb, NULL);
186 if (header) 190 if (header)
187 html("</table>"); 191 html("</table>");
188} 192}
189 193
190void cgit_print_summary() 194void cgit_print_summary()
191{ 195{
192 html("<div id='summary'>"); 196 html("<div id='summary'>");
193 cgit_print_archives(); 197 cgit_print_archives();
194 html("<h2>"); 198 html("<h2>");
195 html_txt(cgit_repo->name); 199 html_txt(cgit_repo->name);
196 html(" - "); 200 html(" - ");
197 html_txt(cgit_repo->desc); 201 html_txt(cgit_repo->desc);
198 html("</h2>"); 202 html("</h2>");
199 if (cgit_repo->readme) 203 if (cgit_repo->readme)
200 html_include(cgit_repo->readme); 204 html_include(cgit_repo->readme);
201 html("</div>"); 205 html("</div>");
202 if (cgit_summary_log > 0) 206 if (cgit_summary_log > 0)
203 cgit_print_log(cgit_query_head, 0, cgit_summary_log, NULL, NULL, 0); 207 cgit_print_log(cgit_query_head, 0, cgit_summary_log, NULL, NULL, 0);
204 html("<table class='list nowrap'>"); 208 html("<table class='list nowrap'>");
205 if (cgit_summary_log > 0) 209 if (cgit_summary_log > 0)
206 html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>"); 210 html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>");
207 cgit_print_branches(); 211 cgit_print_branches();
208 html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>"); 212 html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>");
209 cgit_print_tags(); 213 cgit_print_tags(cgit_summary_tags);
210 html("</table>"); 214 html("</table>");
211} 215}