changeset 14:6a33dc59e4a6

fix layout of grid for uneven number of images
author k0s <k0scist@gmail.com>
date Sat, 26 Dec 2009 19:45:41 -0500
parents ca43a7f71985
children 5a088a1fc197
files montage/templates/grid.html
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/montage/templates/grid.html	Fri Dec 25 22:21:10 2009 -0500
+++ b/montage/templates/grid.html	Sat Dec 26 19:45:41 2009 -0500
@@ -25,9 +25,12 @@
         </td>
       </tr>
       <tr py:if="len(files) % columns" py:with="row = len(files) / columns">
-        <td py:for="col in range(columns)" py:with="image = files[row*columns + col]">
+        <td py:for="col in range(len(files) % columns)" py:with="image = files[row*columns + col]">
           <center>
-            <img src="${image['path']}" width="${width or None}" height="${height or None}"/><br/>
+            <a href="${image['link']}">
+              <img src="${image['path']}" width="${width or None}" height="${height or None}"/>
+              </a>
+            <br/>
             ${image.get('title', image['description'])}            
           </center>
         </td>