From e3137c0f9db6fd047945bb327bcd49005a7d6401 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 22 Sep 2011 20:56:08 +0200 Subject: [PATCH] Improve block toggling. --- src/main/resources/i18n/sone.en.properties | 1 + src/main/resources/static/css/sone.css | 4 ++ src/main/resources/templates/imageBrowser.html | 95 +++++++++++++------------- 3 files changed, 54 insertions(+), 46 deletions(-) diff --git a/src/main/resources/i18n/sone.en.properties b/src/main/resources/i18n/sone.en.properties index 229f76e..229d3dd 100644 --- a/src/main/resources/i18n/sone.en.properties +++ b/src/main/resources/i18n/sone.en.properties @@ -191,6 +191,7 @@ Page.ImageBrowser.Header.Albums=Albums Page.ImageBrowser.Header.Images=Images Page.ImageBrowser.CreateAlbum.Button.CreateAlbum=Create Album Page.ImageBrowser.Album.Edit.Title=Edit Album +Page.ImageBrowser.Album.Delete.Title=Delete Album Page.ImageBrowser.Album.Label.Title=Title: Page.ImageBrowser.Album.Label.Description=Description: Page.ImageBrowser.Album.Button.Save=Save Album diff --git a/src/main/resources/static/css/sone.css b/src/main/resources/static/css/sone.css index 81c9f83..1e400fb 100644 --- a/src/main/resources/static/css/sone.css +++ b/src/main/resources/static/css/sone.css @@ -51,6 +51,10 @@ textarea { display: none; } +#sone .toggle-link { + margin-top: 1em; +} + #sone #formPassword { display: none; } diff --git a/src/main/resources/templates/imageBrowser.html b/src/main/resources/templates/imageBrowser.html index a037e12..9c0ef90 100644 --- a/src/main/resources/templates/imageBrowser.html +++ b/src/main/resources/templates/imageBrowser.html @@ -2,6 +2,28 @@ + + <%if albumRequested> <%ifnull album> @@ -51,19 +73,10 @@ }); $("#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"); + hideAndShowBlock(".edit-album", ".show-edit-album", ".hide-edit-album"); + hideAndShowBlock(".create-album", ".show-create-album", ".hide-create-album"); + hideAndShowBlock(".upload-image", ".show-upload-image", ".hide-upload-image"); + hideAndShowBlock(".delete-album", ".show-delete-album", ".hide-delete-album"); }); <%/if> @@ -84,7 +97,8 @@

<% album.description|html>

<%if album.sone.local> -

+ +

<%= Page.ImageBrowser.Album.Edit.Title|l10n|html>

@@ -126,7 +140,8 @@ <%/foreach> <%if album.sone.local> -

+ +
<%include include/createAlbum.html>
@@ -163,16 +178,21 @@ <%/foreach> <%if album.sone.local> -

+ +
<%include include/uploadImage.html>
<%if album.empty> -
- - -
+ + +
+
+ + +
+
<%/if> <%/if> @@ -213,18 +233,8 @@ }); $("#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"); + hideAndShowBlock(".edit-image", ".show-edit-image", ".hide-edit-image"); + hideAndShowBlock(".delete-image", ".show-delete-image", ".hide-delete-image"); }); <%/if> @@ -241,7 +251,8 @@ <%if image.sone.local> -

+ +

<%= Page.ImageBrowser.Image.Edit.Title|l10n|html>

@@ -264,7 +275,8 @@
-

+ +

<%= Page.ImageBrowser.Image.Delete.Title|l10n|html>

@@ -295,17 +307,7 @@ }); $("#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"); + hideAndShowBlock(".create-album", ".show-create-album", ".hide-create-album"); }); <%/if> @@ -338,7 +340,8 @@ <%/foreach> <%if sone.local> -

+ +
<%include include/createAlbum.html>
-- 2.7.4