<div class="page-id hidden">image-browser</div>
+ <script language="javascript">
+ $(function() {
+
+ /* hide all those forms. */
+ hideAndShowBlock = function(blockElement, clickToShowElement, clickToHideElement) {
+ $(blockElement).hide();
+ $(clickToShowElement).removeClass("hidden");
+ $(clickToShowElement).click(function() {
+ $(blockElement).slideDown();
+ $(clickToShowElement).addClass("hidden");
+ $(clickToHideElement).removeClass("hidden");
+ });
+ $(clickToHideElement).click(function() {
+ $(blockElement).slideUp();
+ $(clickToHideElement).addClass("hidden");
+ $(clickToShowElement).removeClass("hidden");
+ });
+ };
+
+ });
+ </script>
+
<%if albumRequested>
<%ifnull album>
});
});
$("#edit-album label").hide();
+
+ 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");
+
+ hideAndShowData = function(activationElements, activeElements, hideElement, showElement) {
+ $(activationElements).click(function() {
+ imageId = $(this).closest(".image").find(".image-id").text();
+ $(hideElement, $("#image-" + imageId)).hide();
+ $(showElement, $("#image-" + imageId)).show();
+ $(document).click(function(event) {
+ if ($(event.target).closest("#image-" + imageId).size() == 0) {
+ $(showElement).hide();
+ $(hideElement).show();
+ }
+ return $(event.target).is("button");
+ });
+ });
+ };
+
+ hideAndShowData(".image-title, .image-description", ".image", ".show-data", ".edit-data");
});
</script>
<%/if>
- <h1><%= Page.ImageBrowser.Album.Title|l10n|replace needle='{album}' replacementKey=album.title|html></h1>
+ <h1 class="backlink"><%= Page.ImageBrowser.Album.Title|l10n|replace needle='{album}' replacementKey=album.title|html></h1>
<div class="backlinks">
<%foreach album.backlinks backlink backlinks>
<%/foreach>
</div>
- <%foreach album.albums album>
- <div class="album image">
- <a href="imageBrowser.html?album=<% album.id|html>">
- <%ifnull album.image>
- <img src="images/unknown-image-0.png" width="200" height="150" alt="<% album.title|html>" title="<% album.title|html>" />
- <%else><!-- TODO -->
- <img src="images/unknown-image-0.png" width="200" height="150" alt="<% album.title|html>" title="<% album.title|html>" />
+ <p id="description"><% album.description|html></p>
+
+ <%if album.sone.local>
+ <div class="show-edit-album hidden toggle-link"><a class="small-link">» <%= Page.ImageBrowser.Album.Edit.Title|l10n|html></a></div>
+ <div class="hide-edit-album hidden toggle-link"><a class="small-link">« <%= Page.ImageBrowser.Album.Edit.Title|l10n|html></a></div>
+ <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>" />
+
+ <%if ! album.images.empty>
+ <div>
+ <label for="album-image"><%= Page.ImageBrowser.Album.Label.AlbumImage|l10n|html></label>
+ <select name="album-image">
+ <option disabled="disabled"><%= Page.ImageBrowser.Album.AlbumImage.Choose|l10n|html></option>
+ <%foreach album.images image>
+ <option value="<% image.id|html>"<%if album.albumImage.id|match key=image.id> selected="selected"<%/if>><% image.title|html></option>
+ <%/foreach>
+ </select>
+ </div>
<%/if>
- </a>
+ <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>
- <%/foreach>
+ <%/if>
- <%foreach album.images image>
- <div class="image">
- <a href="imageBrowser.html?image=<%image.id|html>"><% image|image-link max-width=200 max-height=150></a>
+ <%foreach album.albums album>
+ <%first><h2><%= Page.ImageBrowser.Header.Albums|l10n|html></h2><%/first>
+ <%if loop.count|mod divisor=3><div class="image-row"><%/if>
+ <div class="album image">
+ <div class="image-container">
+ <a href="imageBrowser.html?album=<% album.id|html>" title="<% album.title|html>">
+ <%ifnull album.albumImage>
+ <img src="images/unknown-image-0.png" width="266" height="200" alt="<% album.title|html>" title="<% album.title|html>" style="position: relative; top: 0px; left: -33px;" />
+ <%else><!-- TODO -->
+ <% album.albumImage|image-link max-width=200 max-height=200 mode=enlarge title==album.title>
+ <%/if>
+ </a>
+ </div>
+ <div class="show-data">
+ <div class="album-title"><% album.title|html></div>
+ <div class="album-description"><% album.description|html></div>
+ </div>
</div>
+ <%= false|store key=endRow>
+ <%if loop.count|mod divisor=3 offset=1><%= true|store key=endRow><%/if>
+ <%last><%= true|store key=endRow><%/last>
+ <%if endRow></div><%/if>
<%/foreach>
- <div id="description">
- <% album.description|html>
- </div>
-
- <%if album.sone.current>
- <%include include/uploadImage.html>
- <%include include/createAlbum.html>
-
- <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>" />
+ <%if album.sone.local>
+ <div class="show-create-album hidden toggle-link"><a class="small-link">» <%= View.CreateAlbum.Title|l10n|html></a></div>
+ <div class="hide-create-album hidden toggle-link"><a class="small-link">« <%= View.CreateAlbum.Title|l10n|html></a></div>
+ <div class="create-album">
+ <%include include/createAlbum.html>
+ </div>
+ <%/if>
- <div>
- <label for="title"><%= Page.ImageBrowser.Album.Label.Title|l10n|html></label>
- <input type="text" name="title" value="<%album.title|html>" />
+ <%foreach album.images image>
+ <%first><h2><%= Page.ImageBrowser.Header.Images|l10n|html></h2><%/first>
+ <%if loop.count|mod divisor=3><div class="image-row"><%/if>
+ <div id="image-<% image.id|html>" class="image">
+ <div class="image-id hidden"><% image.id|html></div>
+ <div class="image-container">
+ <a href="imageBrowser.html?image=<%image.id|html>"><% image|image-link max-width=200 max-height=200 mode=enlarge title==image.title></a>
</div>
- <div>
- <label for="description"><%= Page.ImageBrowser.Album.Label.Description|l10n|html></label>
- <textarea name="description"><%album.description|html></textarea>
+ <div class="show-data">
+ <div class="image-title"><% image.title|html></div>
+ <div class="image-description"><% image.description|html></div>
</div>
- <button type="submit"><%= Page.ImageBrowser.Album.Button.Save|l10n|html></button>
- </form>
+ <%if album.sone.local>
+ <form class="edit-image" action="editImage.html" method="post">
+ <input type="hidden" name="formPassword" value="<%formPassword|html>" />
+ <input type="hidden" name="returnPage" value="<%request.uri|html>" />
+ <input type="hidden" name="image" value="<%image.id|html>" />
+
+ <div class="edit-data hidden">
+ <div>
+ <input type="text" name="title" value="<%image.title|html>" />
+ </div>
+ <div>
+ <textarea name="description"><%image.description|html></textarea>
+ </div>
+ <div>
+ <%notfirst><button type="submit" name="moveLeft" value="true"><%= Page.ImageBrowser.Image.Button.MoveLeft|l10n|html></button><%/notfirst>
+ <button type="submit"><%= Page.ImageBrowser.Image.Button.Save|l10n|html></button>
+ <%notlast><button type="submit" name="moveRight" value="true"><%= Page.ImageBrowser.Image.Button.MoveRight|l10n|html></button><%/notlast>
+ </div>
+ </div>
+ </form>
+ <%/if>
+ </div>
+ <%= false|store key=endRow>
+ <%if loop.count|mod divisor=3 offset=1><%= true|store key=endRow><%/if>
+ <%last><%= true|store key=endRow><%/last>
+ <%if endRow></div><%/if>
+ <%/foreach>
+
+ <%if album.sone.local>
+ <div class="show-upload-image hidden toggle-link"><a class="small-link">» <%= View.UploadImage.Title|l10n|html></a></div>
+ <div class="hide-upload-image hidden toggle-link"><a class="small-link">« <%= View.UploadImage.Title|l10n|html></a></div>
+ <div class="upload-image">
+ <%include include/uploadImage.html>
+ </div>
<%if album.empty>
- <form id="delete-album" action="deleteAlbum.html" method="get">
- <input type="hidden" name="album" value="<%album.id|html>" />
- <button type="submit"><%= Page.ImageBrowser.Album.Button.Delete|l10n|html></button>
- </form>
+ <div class="show-delete-album hidden toggle-link"><a class="small-link">» <%= Page.ImageBrowser.Album.Delete.Title|l10n|html></a></div>
+ <div class="hide-delete-album hidden toggle-link"><a class="small-link">« <%= Page.ImageBrowser.Album.Delete.Title|l10n|html></a></div>
+ <div class="delete-album">
+ <form id="delete-album" action="deleteAlbum.html" method="get">
+ <input type="hidden" name="album" value="<%album.id|html>" />
+ <button type="submit"><%= Page.ImageBrowser.Album.Button.Delete|l10n|html></button>
+ </form>
+ </div>
<%/if>
<%/if>
<%elseif imageRequested>
- <h1><%image.title|html></h1>
+ <h1 class="backlink"><%image.title|html></h1>
<div class="backlinks">
<%foreach image.album.backlinks backlink backlinks>
});
});
$("#edit-image label").hide();
+
+ hideAndShowBlock(".edit-image", ".show-edit-image", ".hide-edit-image");
+ hideAndShowBlock(".delete-image", ".show-delete-image", ".hide-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>
+ <div class="show-edit-image hidden toggle-link"><a class="small-link">» <%= Page.ImageBrowser.Image.Edit.Title|l10n|html></a></div>
+ <div class="hide-edit-image hidden toggle-link"><a class="small-link">« <%= Page.ImageBrowser.Image.Edit.Title|l10n|html></a></div>
+ <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="returnPage" value="<%request.uri|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>
+ <div class="show-delete-image hidden toggle-link"><a class="small-link">» <%= Page.ImageBrowser.Image.Delete.Title|l10n|html></a></div>
+ <div class="hide-delete-image hidden toggle-link"><a class="small-link">« <%= Page.ImageBrowser.Image.Delete.Title|l10n|html></a></div>
+ <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();
+
+ hideAndShowBlock(".create-album", ".show-create-album", ".hide-create-album");
});
</script>
<%/if>
<h1><%= Page.ImageBrowser.Sone.Title|l10n|replace needle='{sone}' replacementKey=sone.niceName|html></h1>
<%foreach sone.albums album>
+ <%if loop.count|mod divisor=3><div class="image-row"><%/if>
<div class="album image">
- <a href="imageBrowser.html?album=<% album.id|html>">
- <%ifnull album.image>
- <img src="images/unknown-image-0.png" width="200" height="150" alt="<% album.title|html>" title="<% album.title|html>" />
- <%else><!-- TODO -->
- <img src="images/unknown-image-0.png" width="200" height="150" alt="<% album.title|html>" title="<% album.title|html>" />
- <%/if>
- </a>
+ <div class="image-container">
+ <a href="imageBrowser.html?album=<% album.id|html>" title="<% album.title|html>">
+ <%ifnull album.albumImage>
+ <img src="images/unknown-image-0.png" width="266" height="200" alt="<% album.title|html>" title="<% album.title|html>" style="position: relative; top: 0px; left: -33px;"/>
+ <%else><!-- TODO -->
+ <% album.albumImage|image-link max-width=200 max-height=200 mode=enlarge title==album.title>
+ <%/if>
+ </a>
+ </div>
+ <div class="show-data">
+ <div class="album-title"><% album.title|html></div>
+ <div class="album-description"><% album.description|html></div>
+ </div>
</div>
+ <%= false|store key=endRow>
+ <%if loop.count|mod divisor=3 offset=1><%= true|store key=endRow><%/if>
+ <%last><%= true|store key=endRow><%/last>
+ <%if endRow></div><%/if>
<%/foreach>
- <%if sone.current>
- <%include include/createAlbum.html>
+ <%if sone.local>
+ <div class="show-create-album hidden toggle-link"><a class="small-link">» <%= View.CreateAlbum.Title|l10n|html></a></div>
+ <div class="hide-create-album hidden toggle-link"><a class="small-link">« <%= View.CreateAlbum.Title|l10n|html></a></div>
+ <div class="create-album">
+ <%include include/createAlbum.html>
+ </div>
<%/if>
<%/if>