Revert sorting build products

Sorting the build products list fails if there are fewer than 3 build
products.  This is because of extreme Template Toolkit brain damage:
it treats arrays of 0-2 elements differently in some magic way.  See
e.g.

  http://mail.template-toolkit.org/pipermail/templates/2011-April/011510.html
This commit is contained in:
Eelco Dolstra 2012-04-30 22:17:31 +02:00
parent df71a86183
commit 8f85fe67d4

View file

@ -2,13 +2,9 @@
[% BLOCK renderProductList -%] [% BLOCK renderProductList -%]
[% # Work around a strange bug: build.buildproducts.size returns 3 when the actual size is 1.
nrProducts = 0; FOREACH product IN build.buildproducts; nrProducts = nrProducts + 1; END
%]
<table class="productList layoutTable"> <table class="productList layoutTable">
[% FOREACH product IN build.buildproducts.nsort('productnr') -%] [% FOREACH product IN build.buildproducts -%]
[% uri = "${c.uri_for('/build' build.id 'download' product.productnr)}" [% uri = "${c.uri_for('/build' build.id 'download' product.productnr)}"
_ (product.name ? "/" _ product.name : "") _ (product.name ? "/" _ product.name : "")
@ -143,7 +139,7 @@
<tr> <tr>
<th>Links to latest:</th> <th>Links to latest:</th>
<td> <td>
[% IF nrProducts > 1 %] [% IF build.buildproducts.count > 1 %]
[% uri2 = "${c.uri_for(latestRoot.join('/') 'download-by-type' product.type product.subtype)}" %] [% uri2 = "${c.uri_for(latestRoot.join('/') 'download-by-type' product.type product.subtype)}" %]
<a href="[% uri2 %]"><tt>[% uri2 %]</tt></a> <a href="[% uri2 %]"><tt>[% uri2 %]</tt></a>
<br /> <br />
@ -210,7 +206,7 @@
<tr class="product"> <tr class="product">
<td> <td>
Something of type <tt>[% product.type %]</tt> Something of type <tt>[% product.type %]</tt> [% product %]
</td> </td>
</tr> </tr>