Hide all forms initially, show on click.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 21 Sep 2011 20:04:06 +0000 (22:04 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 21 Sep 2011 20:04:06 +0000 (22:04 +0200)
src/main/resources/static/css/sone.css
src/main/resources/templates/imageBrowser.html

index 7324899..e345261 100644 (file)
@@ -97,6 +97,10 @@ textarea {
        border: none;
 }
 
+#sone .small-link {
+       font-size: 85%;
+}
+
 #sone .parsed {
        white-space: pre-wrap;
 }
index e9b3c06..6adb3dd 100644 (file)
                                                        });
                                                });
                                                $("#edit-album label").hide();
+
+                                               /* hide all those forms. */
+                                               hideBlock = function(blockElement, clickElement) {
+                                                       $(blockElement).hide();
+                                                       $(clickElement).removeClass("hidden").click(function() {
+                                                               $(blockElement).slideDown();
+                                                               $(this).slideUp();
+                                                               return false;
+                                                       });
+                                               };
+
+                                               hideBlock(".edit-album", ".show-edit-album");
+                                               hideBlock(".create-album", ".show-create-album");
+                                               hideBlock(".upload-image", ".show-upload-image");
                                        });
                                </script>
                        <%/if>
                        <p id="description"><% album.description|html></p>
 
                        <%if album.sone.local>
-                               <h2><%= Page.ImageBrowser.Album.Edit.Title|l10n|html></h2>
+                               <p><a class="show-edit-album hidden small-link">» <%= Page.ImageBrowser.Album.Edit.Title|l10n|html></a></p>
+                               <div class="edit-album">
+                                       <h2><%= Page.ImageBrowser.Album.Edit.Title|l10n|html></h2>
 
-                               <form id="edit-album" action="editAlbum.html" method="post">
-                                       <input type="hidden" name="formPassword" value="<%formPassword|html>" />
-                                       <input type="hidden" name="album" value="<%album.id|html>" />
+                                       <form id="edit-album" action="editAlbum.html" method="post">
+                                               <input type="hidden" name="formPassword" value="<%formPassword|html>" />
+                                               <input type="hidden" name="album" value="<%album.id|html>" />
 
-                                       <div>
-                                               <label for="title"><%= Page.ImageBrowser.Album.Label.Title|l10n|html></label>
-                                               <input type="text" name="title" value="<%album.title|html>" />
-                                       </div>
-                                       <div>
-                                               <label for="description"><%= Page.ImageBrowser.Album.Label.Description|l10n|html></label>
-                                               <textarea name="description"><%album.description|html></textarea>
-                                       </div>
-                                       <button type="submit"><%= Page.ImageBrowser.Album.Button.Save|l10n|html></button>
-                               </form>
+                                               <div>
+                                                       <label for="title"><%= Page.ImageBrowser.Album.Label.Title|l10n|html></label>
+                                                       <input type="text" name="title" value="<%album.title|html>" />
+                                               </div>
+                                               <div>
+                                                       <label for="description"><%= Page.ImageBrowser.Album.Label.Description|l10n|html></label>
+                                                       <textarea name="description"><%album.description|html></textarea>
+                                               </div>
+                                               <button type="submit"><%= Page.ImageBrowser.Album.Button.Save|l10n|html></button>
+                                       </form>
+                               </div>
                        <%/if>
 
                        <%foreach album.albums album>
                        <%/foreach>
 
                        <%if album.sone.local>
-                               <%include include/createAlbum.html>
+                               <p><a class="show-create-album hidden small-link">» <%= View.CreateAlbum.Title|l10n|html></a></p>
+                               <div class="create-album">
+                                       <%include include/createAlbum.html>
+                               </div>
                        <%/if>
 
                        <%foreach album.images image>
                        <%/foreach>
 
                        <%if album.sone.local>
-                               <%include include/uploadImage.html>
+                               <p><a class="show-upload-image hidden small-link">» <%= View.UploadImage.Title|l10n|html></a></p>
+                               <div class="upload-image">
+                                       <%include include/uploadImage.html>
+                               </div>
 
                                <%if album.empty>
                                        <form id="delete-album" action="deleteAlbum.html" method="get">
                                                        });
                                                });
                                                $("#edit-image label").hide();
+
+                                               /* hide all those forms. */
+                                               hideBlock = function(blockElement, clickElement) {
+                                                       $(blockElement).hide();
+                                                       $(clickElement).removeClass("hidden").click(function() {
+                                                               $(blockElement).slideDown();
+                                                               $(this).slideUp();
+                                                               return false;
+                                                       });
+                                               };
+
+                                               hideBlock(".edit-image", ".show-edit-image");
+                                               hideBlock(".delete-image", ".show-delete-image");
                                        });
                                </script>
                        <%/if>
 
                        <%if image.sone.local>
 
-                               <h2><%= Page.ImageBrowser.Image.Edit.Title|l10n|html></h2>
-
-                               <form id="edit-image" action="editImage.html" method="post">
-                                       <input type="hidden" name="formPassword" value="<%formPassword|html>" />
-                                       <input type="hidden" name="image" value="<%image.id|html>" />
-
-                                       <div>
-                                               <label for="title"><%= Page.ImageBrowser.Image.Title.Label|l10n|html></label>
-                                               <input type="text" name="title" value="<%image.title|html>" />
-                                       </div>
-                                       <div>
-                                               <label for="description"><%= Page.ImageBrowser.Image.Description.Label|l10n|html></label>
-                                               <textarea name="description"><%image.description|html></textarea>
-                                       </div>
-                                       <div>
-                                               <button type="submit"><%= Page.ImageBrowser.Image.Button.Save|l10n|html></button>
-                                       </div>
-                               </form>
+                               <p><a class="show-edit-image hidden small-link">» <%= Page.ImageBrowser.Image.Edit.Title|l10n|html></a></p>
+                               <div class="edit-image">
+                                       <h2><%= Page.ImageBrowser.Image.Edit.Title|l10n|html></h2>
+
+                                       <form id="edit-image" action="editImage.html" method="post">
+                                               <input type="hidden" name="formPassword" value="<%formPassword|html>" />
+                                               <input type="hidden" name="image" value="<%image.id|html>" />
+
+                                               <div>
+                                                       <label for="title"><%= Page.ImageBrowser.Image.Title.Label|l10n|html></label>
+                                                       <input type="text" name="title" value="<%image.title|html>" />
+                                               </div>
+                                               <div>
+                                                       <label for="description"><%= Page.ImageBrowser.Image.Description.Label|l10n|html></label>
+                                                       <textarea name="description"><%image.description|html></textarea>
+                                               </div>
+                                               <div>
+                                                       <button type="submit"><%= Page.ImageBrowser.Image.Button.Save|l10n|html></button>
+                                               </div>
+                                       </form>
+                               </div>
 
-                               <h2><%= Page.ImageBrowser.Image.Delete.Title|l10n|html></h2>
+                               <p><a class="show-delete-image hidden small-link">» <%= Page.ImageBrowser.Image.Delete.Title|l10n|html></a></p>
+                               <div class="delete-image">
+                                       <h2><%= Page.ImageBrowser.Image.Delete.Title|l10n|html></h2>
 
-                               <form id="delete-image" action="deleteImage.html" method="get">
-                                       <input type="hidden" name="image" value="<%image.id|html>" />
-                                       <button type="submit"><%= Page.ImageBrowser.Image.Button.Delete|l10n|html></button>
-                               </form>
+                                       <form id="delete-image" action="deleteImage.html" method="get">
+                                               <input type="hidden" name="image" value="<%image.id|html>" />
+                                               <button type="submit"><%= Page.ImageBrowser.Image.Button.Delete|l10n|html></button>
+                                       </form>
+                               </div>
 
                        <%/if>
 
                                                });
                                        });
                                        $("#create-album label").hide();
+
+                                       /* hide all those forms. */
+                                       hideBlock = function(blockElement, clickElement) {
+                                               $(blockElement).hide();
+                                               $(clickElement).removeClass("hidden").click(function() {
+                                                       $(blockElement).slideDown();
+                                                       $(this).slideUp();
+                                                       return false;
+                                               });
+                                       };
+
+                                       hideBlock(".create-album", ".show-create-album");
                                });
                        </script>
                <%/if>
                        <%/foreach>
 
                        <%if sone.local>
-                               <%include include/createAlbum.html>
+                               <p><a class="show-create-album hidden small-link">» <%= View.CreateAlbum.Title|l10n|html></a></p>
+                               <div class="create-album">
+                                       <%include include/createAlbum.html>
+                               </div>
                        <%/if>
 
                <%/if>