]> git.decadent.org.uk Git - memories.git/blob - templates/macros
Add new dependencies
[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 %]" 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 %] view[%IF photo.hit_count>1%]s[% END %]
33     [% IF r > 0 %] <br> [% ministar(r, photo) %] in [%photo.rated %]
34     rating[%IF photo.rated > 1%]s[%END%] [% END %]
35 [% END %]
36     </td></tr>
37         [% IF request.user %]
38     [% IF album == 1 %]
39         <tr><td> Add to album: <input type="checkbox" name="add[%photo.id%]" value="[%photo.id%]"> </td></tr>
40     [% ELSIF album == 2 %]
41         <tr><td> Delete from album: <input type="checkbox" name="delete[%photo.id%]" value="[%photo.id%]"> </td></tr>
42     [% END %]
43     [% END %]
44 </table>
45 [% END %]
46
47 [% MACRO view_page_of(photos) BLOCK; %]
48 [% IF request.table == "album" AND request.template == "view" %]
49 [% SET editing_album = 1%]
50 [% END %]
51 [% IF editing_album %]
52 <form action="[%base%]/album/edit/[%album.id%]" method="post">
53 [% ELSE %]
54 <form action="[%base%]/album/edit" method="post">
55 [% END %]
56 [% IF !photos OR ! photos.size %]
57 <div class="warning">
58     This [% request.table %] is empty!
59 </div>
60 [% ELSE %]
61 <table class="userlist">
62 [% WHILE photos.size > 0 %]
63 [% SET triple = photos.splice(0,3) %]
64     <tr>
65         [% FOR photo = triple %]
66         <td>
67         [% IF editing_album; thumb(photo, 2); ELSE; thumb(photo, 1); END %]
68         </td>
69         [% END %]
70     </tr>
71 [% END %]
72 </table>
73 [% END %]
74 [% IF editing_album %]
75 <input type="submit" name="Delete" value="Delete">
76 [% ELSE %]
77 [% INCLUDE album_adder %]
78 [% END %]
79 [% INCLUDE pager %]
80 </form>
81 [% END %]