]> git.decadent.org.uk Git - memories.git/blob - templates/macros
My God, it's full of stars.
[memories.git] / templates / macros
1 [% MACRO ministar(rating, photo) BLOCK;
2 IF photo.rated > 0; %]
3 <span class="inline-rating"><ul class="star-rating small-star">
4 <li class="current-rating" style="width:[%rating * 20 %]%">Currently [%rating%]/5 Stars.</li>
5 </ul></span>
6 [% END; END %]
7 [% MACRO minithumb(photo) BLOCK %]
8         <a href="[%base%]/photo/view/[%photo.id%]">
9         <img src="[% photo.thumb_url |uri%]" alt="[%photo.title|html%]"/>
10         </a>
11 [% END; MACRO thumb(photo, album) BLOCK %]
12 <table class="thumb">
13     <tr><td>
14         [% minithumb(photo) %]
15         </td> </tr>
16     <tr><td> 
17         <a href="[%base%]/photo/view/[%photo.id%]">
18         <b>[% photo.title |html%] </b>
19         </a>
20         
21         <br>
22         <small>[% FOR tag = photo.tags %] <a
23         href="[%base%]/tag/view/[%tag%]">[%tag %]</a> [% END %]</small>
24         </td></tr>
25     <tr><td style="background:#fff"> Uploaded by 
26         <a href="[%base%]/user/view/[%photo.uploader.id%]">
27             [% photo.uploader.name |html%]
28         </a><br/> at [% photo.uploaded %] 
29         [% SET r = photo.approx_rating %]
30         <br/>
31 [% IF r > 0 OR photo.hit_count > 0 %]
32     [% photo.hit_count %] views
33     [% IF r > 0 %] <br> [% ministar(r, photo) %] in [%photo.rated %] ratings [% END %]
34 [% END %]
35     </td></tr>
36         [% IF request.user %]
37     [% IF album == 1 %]
38         <tr><td> Add to album: <input type="checkbox" name="add[%photo.id%]" value="[%photo.id%]"> </td></tr>
39     [% ELSIF album == 2 %]
40         <tr><td> Delete from album: <input type="checkbox" name="delete[%photo.id%]" value="[%photo.id%]"> </td></tr>
41     [% END %]
42     [% END %]
43 </table>
44 [% END %]
45
46 [% MACRO view_page_of(photos) BLOCK; %]
47 [% IF request.table == "album" AND request.template == "view" %]
48 [% SET editing_album = 1%]
49 [% END %]
50 [% IF editing_album %]
51 <form action="[%base%]/album/edit/[%album.id%]" method="post">
52 [% ELSE %]
53 <form action="[%base%]/album/edit" method="post">
54 [% END %]
55 [% IF !photos OR ! photos.size %]
56 <div class="warning">
57     This [% request.table %] is empty!
58 </div>
59 [% ELSE %]
60 <table class="userlist">
61 [% WHILE photos.size > 0 %]
62 [% SET triple = photos.splice(0,3) %]
63     <tr>
64         [% FOR photo = triple %]
65         <td>
66         [% IF editing_album; thumb(photo, 2); ELSE; thumb(photo, 1); END %]
67         </td>
68         [% END %]
69     </tr>
70 [% END %]
71 </table>
72 [% END %]
73 [% IF editing_album %]
74 <input type="submit" name="Delete" value="Delete">
75 [% ELSE %]
76 [% INCLUDE album_adder %]
77 [% END %]
78 [% INCLUDE pager %]
79 </form>
80 [% END %]