]> git.decadent.org.uk Git - memories.git/commitdiff
Rejig the output to cope with cases of lots of tags.
authorSimon Cozens <simon@simon-cozens.org>
Thu, 8 Feb 2007 20:28:42 +0000 (20:28 +0000)
committerSimon Cozens <simon@simon-cozens.org>
Thu, 8 Feb 2007 20:28:42 +0000 (20:28 +0000)
git-svn-id: http://svn.simon-cozens.org/memories/trunk@13 041978f6-d955-411f-a9d7-1d8545c9c3c7

templates/photo/view
templates/static/memories.css

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") %]
index 372811166dcab92731adecfaa32add0d0c1eef42..61099a73ea1264cac524ee5b03dccc162933c9ef 100644 (file)
@@ -91,6 +91,7 @@ p { font-family: sans-serif; }
 .photodesc { background: #fff; padding: 10px; margin: 5px 15px 5px 15px; text-align: center; }
 .photorights { font-size: 90%; padding: 10px; text-align: right; font-weight: bold; }
 .photolicense { font-size: 80%; padding: 10px; }
+.smaller { font-size: 80%  }
 
 span.tagcloud0 { font-size: 9px;}
 span.tagcloud1 { font-size: 10px;}