Rework pretty much all image displaying code
[Sone.git] / src / main / resources / templates / include / browseAlbums.html
index 74bf714..4961e74 100644 (file)
@@ -1,9 +1,47 @@
-<%foreach albums album>
-       <%first><h2><%= Page.ImageBrowser.Header.Albums|l10n|html></h2><%/first>
-       <%if loop.count|mod divisor==3><div class="album-row"><%/if>
-       <%include include/viewAlbum.html>
+<%foreach albums album|paginate pageSize=core.preferences.imagesPerPage page=albumPage>
+       <%first>
+               <h2><%= Page.ImageBrowser.Header.Albums|l10n|html></h2>
+               <%include include/pagination.html pageParameter=="albumPage">
+               <div class="images">
+       <%/first>
+       <%if loop.even><div class="album-row"><%/if>
+               <div id="album-<% album.id|html>" class="album">
+                       <div class="album-id hidden"><% album.id|html></div>
+                       <%include include/viewAlbum.html>
+               </div>
        <%= false|store key==endRow>
-       <%if loop.count|mod divisor==3 offset==1><%= true|store key==endRow><%/if>
+       <%if loop.odd><%= true|store key==endRow><%/if>
        <%last><%= true|store key==endRow><%/last>
        <%if endRow></div><%/if>
+       <%last>
+               </div>
+               <%include include/pagination.html pageParameter=="albumPage">
+       <%/last>
+
+       <%if album.sone.local>
+               <form class="edit-album" action="editAlbum.html" method="post">
+                       <input type="hidden" name="formPassword" value="<%formPassword|html>" />
+                       <input type="hidden" name="returnPage" value="<%request.uri|html>" />
+                       <input type="hidden" name="album" value="<%album.id|html>" />
+
+                       <div class="move-buttons">
+                               <button <%if loop.first>class="hidden" <%/if>type="submit" name="moveLeft" value="true"><%= Page.ImageBrowser.Image.Button.MoveLeft|l10n|html></button>
+                               <button <%if loop.last>class="hidden" <%/if>type="submit" name="moveRight" value="true"><%= Page.ImageBrowser.Image.Button.MoveRight|l10n|html></button>
+                       </div>
+
+                       <div class="edit-data hidden">
+                               <div>
+                                       <input type="text" name="title" value="<%album.title|html>" />
+                               </div>
+                               <div>
+                                       <textarea name="description"><%album.description|html></textarea>
+                               </div>
+                               <div>
+                                       <button <%if loop.first>class="hidden" <%/if>type="submit" name="moveLeft" value="true"><%= Page.ImageBrowser.Image.Button.MoveLeft|l10n|html></button>
+                                       <button type="submit" name="submit"><%= Page.ImageBrowser.Album.Button.Save|l10n|html></button>
+                                       <button <%if loop.last>class="hidden" <%/if>type="submit" name="moveRight" value="true"><%= Page.ImageBrowser.Image.Button.MoveRight|l10n|html></button>
+                               </div>
+                       </div>
+               </form>
+       <%/if>
 <%/foreach>