]> git.decadent.org.uk Git - memories.git/blobdiff - templates/photo/view
Rejig the output to cope with cases of lots of tags.
[memories.git] / templates / photo / view
index 0285d7584966b04dc91d1bb8c0131ebb10b0e678..617484c81c13884fa82c532ab5e3d680efc3e8e9 100644 (file)
     </form>
 [% END %]
 </td>
-<td align="right" class="tagbrowse">
-[% FOR tag = photo.tags;
-    "<a href=\""; base;"/tag/view/";tag.name | html | uri;"\">";
-    tag;
-    "</a>&nbsp;(";
-    tag.taggings.size; ")";
-    ", " UNLESS tag == photo.tags.last;
-END %]
-</td>
-</tr>
-<tr>
-<td>
+<td align="right">
 [% IF photo.albums %]
 In albums:
 [% FOR album = photo.albums; %]
 <a href="[%base%]/album/view/[%album.id%]">[%album.name%]</a> ([%album.photos.size%])
 [% ";" UNLESS album == photo.albums.last %]
 [% END %]
+<br>
 [% END %]
-
-</td>
-<td align="right" class="tagbrowse"><small>
+<small>
 <i>Photo shot on [% photo.shot.ymd %] </i> <br>
 Uploaded by <a href="[%base%]/user/view/[%photo.uploader.id%]"> [%
 photo.uploader %] </a>
 </small></td>
 </tr>
 </table>
+
+<div class="tagbrowse smaller">
+[% SET tagset = {}; FOR tag = photo.tags;
+    SET name = tag.name; tagset.$name = tag.taggings.size;
+  END;
+  SET sorted = tagset.nsort.reverse;
+%]
+[% SET counter = 0;
+  FOR tag = sorted;
+    counter = counter + 1;
+    IF tagset.$tag > 1; 
+        "<a href=\""; base;"/tag/view/";tag | html | uri;"\">";
+        tag;
+        "</a>&nbsp;(";
+        tagset.$tag; ")";
+    ELSE; 
+        tag; 
+        IF counter > 20; "..."; LAST; END;
+    END;
+    ", " UNLESS tag == sorted.last;
+END %]
+</div>
+
 <div class="photoview">
     [% SET sizes = request.config.sizes %]
     [% IF request.params.exists("scale") %]