Extract display of an album into its own template
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 27 Jul 2015 04:21:07 +0000 (06:21 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 27 Jul 2015 04:21:14 +0000 (06:21 +0200)
src/main/resources/static/css/sone.css
src/main/resources/templates/include/browseAlbums.html
src/main/resources/templates/include/viewAlbum.html [new file with mode: 0644]

index 8b588b8..557ea46 100644 (file)
@@ -738,6 +738,9 @@ textarea {
        height: 250px;
        overflow: hidden;
        padding: -1px;
+}
+
+#sone .image-container {
        border: solid 1px #000;
 }
 
@@ -761,6 +764,26 @@ textarea {
        width: 95%;
 }
 
+#sone .album-container .image-container {
+       position: absolute;
+}
+
+#sone .album-container .link-to-album {
+       display: none;
+}
+
+#sone .album-container:hover .link-to-album {
+       display: block;
+       float: right;
+       z-index: 1;
+       padding: 0.5ex;
+       background-color: #eee;
+       position: relative;
+       top: 250px;
+       right: 0.5ex;
+       margin-top: -2em;
+}
+
 #sone .image .album-sone {
        font-size: 80%;
 }
index 7c8c490..74bf714 100644 (file)
@@ -1,48 +1,7 @@
 <%foreach albums album>
        <%first><h2><%= Page.ImageBrowser.Header.Albums|l10n|html></h2><%/first>
        <%if loop.count|mod divisor==3><div class="album-row"><%/if>
-       <div id="album-<% album.id|html>" class="album">
-               <div class="album-id hidden"><% album.id|html></div>
-               <div class="album-container">
-                       <a href="imageBrowser.html?album=<% album.id|html>" title="<% album.title|html>">
-                               <%ifnull album.albumImage>
-                                       <img src="images/unknown-image-0.png" width="333" height="250" alt="<% album.title|html>" title="<% album.title|html>" style="position: relative; top: 0px; left: -41px;" />
-                               <%else><!-- TODO -->
-                                       <% album.albumImage|image-link max-width==250 max-height==250 mode==enlarge title=album.title>
-                               <%/if>
-                       </a>
-               </div>
-               <div class="show-data">
-                       <div class="album-title"><% album.title|html> (<%= View.Sone.Stats.Images|l10n 0=album.images.size>)</div>
-                       <div class="album-description"><% album.description|parse sone=album.sone|render></div>
-               </div>
-               <%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 <%first>class="hidden" <%/first>type="submit" name="moveLeft" value="true"><%= Page.ImageBrowser.Image.Button.MoveLeft|l10n|html></button>
-                                               <button <%last>class="hidden" <%/last>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 <%first>class="hidden" <%/first>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 <%last>class="hidden" <%/last>type="submit" name="moveRight" value="true"><%= Page.ImageBrowser.Image.Button.MoveRight|l10n|html></button>
-                                       </div>
-                               </div>
-                       </form>
-               <%/if>
-       </div>
+       <%include include/viewAlbum.html>
        <%= false|store key==endRow>
        <%if loop.count|mod divisor==3 offset==1><%= true|store key==endRow><%/if>
        <%last><%= true|store key==endRow><%/last>
diff --git a/src/main/resources/templates/include/viewAlbum.html b/src/main/resources/templates/include/viewAlbum.html
new file mode 100644 (file)
index 0000000..0821909
--- /dev/null
@@ -0,0 +1,45 @@
+<div id="album-<% album.id|html>" class="album">
+       <div class="album-id hidden"><% album.id|html></div>
+       <div class="album-container">
+               <a href="imageBrowser.html?album=<% album.id|html>" title="<% album.title|html>">
+                       <%ifnull album.albumImage>
+                       <img src="images/unknown-image-0.png" width="333" height="250" alt="<% album.title|html>" title="<% album.title|html>" style="position: relative; top: 0px; left: -41px;" />
+                       <%else><!-- TODO -->
+                       <div class="image-container">
+                               <% album.albumImage|image-link class==album-image max-width==250 max-height==250 mode==enlarge title=album.title>
+                       </div>
+                       <div class="link-to-album"><a href="album://<% album.id|html>">[link album]</a></div>
+                       <%/if>
+               </a>
+       </div>
+       <div class="show-data">
+               <div class="album-title"><% album.title|html> (<%= View.Sone.Stats.Images|l10n 0=album.images.size>)</div>
+               <div class="album-description"><% album.description|parse sone=album.sone|render></div>
+       </div>
+       <%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>
+</div>