Mercurial > hg > montage
comparison montage/templates/sequence.html @ 27:e5336ec2ee02
make sequence template better and more error resistant
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Sun, 30 Oct 2011 14:45:35 -0700 |
parents | ee74cf1e444b |
children | 4a81659a17f7 |
comparison
equal
deleted
inserted
replaced
26:ee74cf1e444b | 27:e5336ec2ee02 |
---|---|
9 </head> | 9 </head> |
10 <body> | 10 <body> |
11 <xi:include py:if="include" href="${include}"/> | 11 <xi:include py:if="include" href="${include}"/> |
12 | 12 |
13 <center py:if="files" py:with="index = int(request.GET.get('index', 0))"> | 13 <center py:if="files" py:with="index = int(request.GET.get('index', 0))"> |
14 <div py:with="image = files[index]" class="image"> | 14 <div py:if="index in range(len(files))" py:with="image = files[index]" class="image"> |
15 <a name="${image['path']}"></a> | 15 <a name="${image['path']}"></a> |
16 <a href="${image['link']}"> | 16 <a href="${image['link']}"> |
17 <img src="${image['path']}" width="${width or None}" height="${height or None}"/> | 17 <img src="${image['path']}" width="${width or None}" height="${height or None}"/> |
18 </a> | 18 </a> |
19 <br/> | 19 <br/> |
20 ${image.get('title', image['description'])} | 20 ${image.get('title', image['description'])} |
21 </div> | 21 </div> |
22 <py:if test="index > 0"> | 22 <py:if test="(index - 1) in range(len(files))"> |
23 <a href="?index=${index - 1}" | 23 <a href="?index=${index - 1}" py:with="image=files[index - 1]"> |
24 py:with="image=files[index - 1]"> | 24 ${image.get('title') or image.get('description') or '««'} |
25 ${image.get("title", image.get("description", "»»"))} | |
26 </a> | 25 </a> |
27 </py:if> | 26 </py:if> |
28 <py:if test="index < len(files)"> | 27 <py:if test="(index + 1) in range(len(files))"> |
29 <a href="?index=${index + 1}" py:with="image=files[index + 1]">${image.get('title', image.get('description', '««'))}</a> | 28 <a href="?index=${index + 1}" py:with="image=files[index + 1]"> |
29 ${image.get('title') or image.get('description') or '»»'} | |
30 </a> | |
30 </py:if> | 31 </py:if> |
31 </center> | 32 </center> |
32 | 33 |
33 </body> | 34 </body> |
34 </html> | 35 </html> |