Add links to previous and next images to backlinks.
[Sone.git] / src / main / resources / templates / imageBrowser.html
index d0badcd..d3080f6 100644 (file)
                                                ajaxGet("editImage.ajax", { "formPassword": getFormPassword(), "image": imageId, "title": title, "description": description }, function(data) {
                                                        if (data && data.success) {
                                                                getImage(data.imageId).find(".image-title").text(data.title);
-                                                               getImage(data.imageId).find(".image-description").text(data.description);
+                                                               getImage(data.imageId).find(".image-description").html(data.parsedDescription);
                                                                getImage(data.imageId).find(":input[name='title']").attr("defaultValue", title);
-                                                               getImage(data.imageId).find(":input[name='description']").attr("defaultValue", description);
+                                                               getImage(data.imageId).find(":input[name='description']").attr("defaultValue", data.description);
                                                                cancelImageEditing();
                                                        }
                                                });
                                                });
                                                $("#edit-album label").hide();
 
+                                               /* hide non-js image move buttons. */
+                                               $(".move-buttons").hide();
+
                                                hideAndShowBlock("div.edit-album", ".show-edit-album", ".hide-edit-album");
                                                hideAndShowBlock("div.create-album", ".show-create-album", ".hide-create-album");
                                                hideAndShowBlock("div.upload-image", ".show-upload-image", ".hide-upload-image");
                                <%/foreach>
                        </div>
 
-                       <p id="description"><% album.description|html></p>
+                       <p id="description"><% album.description|parse sone=album.sone></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>
                        <%/if>
 
-                       <%include include/browseAlbums.html>
+                       <%include include/browseAlbums.html albums=album.albums>
 
                        <%if album.sone.local>
                                <div class="show-create-album hidden toggle-link"><a class="small-link">» <%= View.CreateAlbum.Title|l10n|html></a></div>
                                        </div>
                                        <div class="show-data">
                                                <div class="image-title"><% image.title|html></div>
-                                               <div class="image-description"><% image.description|html></div>
+                                               <div class="image-description"><% image.description|parse sone=image.sone></div>
                                        </div>
                                        <%if album.sone.local>
                                                <form class="edit-image" action="editImage.html" method="post">
                                                        <input type="hidden" name="returnPage" value="<%request.uri|html>" />
                                                        <input type="hidden" name="image" value="<%image.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="<%image.title|html>" />
                                        <div class="separator">&gt;</div>
                                <%/if>
                        <%/foreach>
+                       <%ifnull !image.previous><div class="backlink"><a href="imageBrowser.html?image=<%image.previous.id|html>">« <%image.previous.title|html></a></div><%/if>
+                       <%ifnull !image.next><div class="backlink"><a href="imageBrowser.html?image=<%image.next.id|html>">» <%image.next.title|html></a></div><%/if>
                </div>
 
                <%ifnull image>
                                        });
                                        $("#create-album label").hide();
 
+                                       /* hide non-js move buttons. */
+                                       $(".move-buttons").hide();
+
                                        hideAndShowBlock(".create-album", ".show-create-album", ".hide-create-album");
 
                                        prepareAlbums();
 
                        <h1><%= Page.ImageBrowser.Sone.Title|l10n|replace needle='{sone}' replacementKey=sone.niceName|html></h1>
 
-                       <%include include/browseAlbums.html>
+                       <%include include/browseAlbums.html albums=sone.albums>
 
                        <%if sone.local>
                                <div class="show-create-album hidden toggle-link"><a class="small-link">» <%= View.CreateAlbum.Title|l10n|html></a></div>