Add album title below image.
[Sone.git] / src / main / resources / templates / imageBrowser.html
1 <%include include/head.html>
2
3         <div class="page-id hidden">image-browser</div>
4
5         <%if albumRequested>
6
7                 <%ifnull album>
8
9                         <p><%= Page.ImageBrowser.Album.Error.NotFound.Text|l10n|html></p>
10
11                 <%elseifnull album.title>
12
13                         <p><%= Page.ImageBrowser.Album.Error.NotFound.Text|l10n|html></p>
14
15                 <%else>
16
17                         <%if album.sone.local>
18                                 <script language="javascript">
19                                         $(function() {
20                                                 getTranslation("WebInterface.DefaultText.UploadImage.Title", function(text) {
21                                                         $("#upload-image :input[name='title']").each(function() {
22                                                                 registerInputTextareaSwap(this, text, "title", false, true);
23                                                         });
24                                                 });
25                                                 getTranslation("WebInterface.DefaultText.UploadImage.Description", function(text) {
26                                                         $("#upload-image :input[name='description']").each(function() {
27                                                                 registerInputTextareaSwap(this, text, "description", true, false);
28                                                         });
29                                                 });
30                                                 $("#upload-image label").hide();
31                                                 getTranslation("WebInterface.DefaultText.CreateAlbum.Name", function(text) {
32                                                         $("#create-album input[name='name']").each(function() {
33                                                                 registerInputTextareaSwap(this, text, "name", false, true);
34                                                         });
35                                                 });
36                                                 getTranslation("WebInterface.DefaultText.CreateAlbum.Description", function(text) {
37                                                         $("#create-album input[name='description']").each(function() {
38                                                                 registerInputTextareaSwap(this, text, "description", true, true);
39                                                         });
40                                                 });
41                                                 $("#create-album label").hide();
42                                                 getTranslation("WebInterface.DefaultText.EditAlbum.Title", function(text) {
43                                                         $("#edit-album input[name='title']").each(function() {
44                                                                 registerInputTextareaSwap(this, text, "title", false, true);
45                                                         });
46                                                 });
47                                                 getTranslation("WebInterface.DefaultText.EditAlbum.Description", function(text) {
48                                                         $("#edit-album :input[name='description']").each(function() {
49                                                                 registerInputTextareaSwap(this, text, "description", true, false);
50                                                         });
51                                                 });
52                                                 $("#edit-album label").hide();
53                                         });
54                                 </script>
55                         <%/if>
56
57                         <h1><%= Page.ImageBrowser.Album.Title|l10n|replace needle='{album}' replacementKey=album.title|html></h1>
58
59                         <div class="backlinks">
60                                 <%foreach album.backlinks backlink backlinks>
61                                         <div class="backlink">
62                                                 <a href="<% backlink.target|html>"><% backlink.name|html></a>
63                                         </div>
64                                         <%if ! backlinks.last>
65                                                 <div class="separator">&gt;</div>
66                                         <%/if>
67                                 <%/foreach>
68                         </div>
69
70                         <%foreach album.albums album>
71                                 <div class="album image">
72                                         <a href="imageBrowser.html?album=<% album.id|html>">
73                                                 <%ifnull album.image>
74                                                         <img src="images/unknown-image-0.png" width="200" height="150" alt="<% album.title|html>" title="<% album.title|html>" />
75                                                 <%else><!-- TODO -->
76                                                         <% album.albumImage|image-link max-width=200 max-height=150 title==album.title>
77                                                 <%/if>
78                                                 <br/>
79                                                 <% album.title|html>
80                                         </a>
81                                 </div>
82                         <%/foreach>
83
84                         <%foreach album.images image>
85                                 <div class="image">
86                                         <a href="imageBrowser.html?image=<%image.id|html>"><% image|image-link max-width=200 max-height=150></a>
87                                 </div>
88                         <%/foreach>
89
90                         <div id="description">
91                                 <% album.description|html>
92                         </div>
93
94                         <%if album.sone.local>
95                                 <%include include/uploadImage.html>
96                                 <%include include/createAlbum.html>
97
98                                 <h2><%= Page.ImageBrowser.Album.Edit.Title|l10n|html></h2>
99
100                                 <form id="edit-album" action="editAlbum.html" method="post">
101                                         <input type="hidden" name="formPassword" value="<%formPassword|html>" />
102                                         <input type="hidden" name="album" value="<%album.id|html>" />
103
104                                         <div>
105                                                 <label for="title"><%= Page.ImageBrowser.Album.Label.Title|l10n|html></label>
106                                                 <input type="text" name="title" value="<%album.title|html>" />
107                                         </div>
108                                         <div>
109                                                 <label for="description"><%= Page.ImageBrowser.Album.Label.Description|l10n|html></label>
110                                                 <textarea name="description"><%album.description|html></textarea>
111                                         </div>
112                                         <button type="submit"><%= Page.ImageBrowser.Album.Button.Save|l10n|html></button>
113                                 </form>
114
115                                 <%if album.empty>
116                                         <form id="delete-album" action="deleteAlbum.html" method="get">
117                                                 <input type="hidden" name="album" value="<%album.id|html>" />
118                                                 <button type="submit"><%= Page.ImageBrowser.Album.Button.Delete|l10n|html></button>
119                                         </form>
120                                 <%/if>
121
122                         <%/if>
123
124                 <%/if>
125
126         <%elseif imageRequested>
127
128                 <h1><%image.title|html></h1>
129
130                 <div class="backlinks">
131                         <%foreach image.album.backlinks backlink backlinks>
132                                 <div class="backlink">
133                                         <a href="<% backlink.target|html>"><% backlink.name|html></a>
134                                 </div>
135                                 <%if ! backlinks.last>
136                                         <div class="separator">&gt;</div>
137                                 <%/if>
138                         <%/foreach>
139                 </div>
140
141                 <%ifnull image>
142
143                 <%else>
144
145                         <%if image.sone.local>
146                                 <script language="javascript">
147                                         $(function() {
148                                                 getTranslation("WebInterface.DefaultText.EditImage.Title", function(text) {
149                                                         $("#edit-image input[name='title']").each(function() {
150                                                                 registerInputTextareaSwap(this, text, "title", false, true);
151                                                         });
152                                                 });
153                                                 getTranslation("WebInterface.DefaultText.EditImage.Description", function(text) {
154                                                         $("#edit-image :input[name='description']").each(function() {
155                                                                 registerInputTextareaSwap(this, text, "description", true, false);
156                                                         });
157                                                 });
158                                                 $("#edit-image label").hide();
159                                         });
160                                 </script>
161                         <%/if>
162
163                         <div class="single-image">
164                                 <%ifnull !image.key>
165                                         <a href="/<%image.key|html>"><% image|image-link max-width=640 max-height=480></a>
166                                 <%else>
167                                         <a href="imageBrowser.html?image=<%image.id|html>"><% image|image-link max-width=640 max-height=480></a>
168                                 <%/if>
169                         </div>
170
171                         <p class="parsed"><%image.description|parse sone=image.sone></p>
172
173                         <%if image.sone.local>
174
175                                 <h2><%= Page.ImageBrowser.Image.Edit.Title|l10n|html></h2>
176
177                                 <form id="edit-image" action="editImage.html" method="post">
178                                         <input type="hidden" name="formPassword" value="<%formPassword|html>" />
179                                         <input type="hidden" name="image" value="<%image.id|html>" />
180
181                                         <div>
182                                                 <label for="title"><%= Page.ImageBrowser.Image.Title.Label|l10n|html></label>
183                                                 <input type="text" name="title" value="<%image.title|html>" />
184                                         </div>
185                                         <div>
186                                                 <label for="description"><%= Page.ImageBrowser.Image.Description.Label|l10n|html></label>
187                                                 <textarea name="description"><%image.description|html></textarea>
188                                         </div>
189                                         <div>
190                                                 <button type="submit"><%= Page.ImageBrowser.Image.Button.Save|l10n|html></button>
191                                         </div>
192                                 </form>
193
194                                 <h2><%= Page.ImageBrowser.Image.Delete.Title|l10n|html></h2>
195
196                                 <form id="delete-image" action="deleteImage.html" method="get">
197                                         <input type="hidden" name="image" value="<%image.id|html>" />
198                                         <button type="submit"><%= Page.ImageBrowser.Image.Button.Delete|l10n|html></button>
199                                 </form>
200
201                         <%/if>
202
203                 <%/if>
204
205         <%elseif soneRequested>
206
207                 <%if sone.local>
208                         <script language="javascript">
209                                 $(function() {
210                                         getTranslation("WebInterface.DefaultText.CreateAlbum.Name", function(text) {
211                                                 $("#create-album input[name='name']").each(function() {
212                                                         registerInputTextareaSwap(this, text, "name", false, true);
213                                                 });
214                                         });
215                                         getTranslation("WebInterface.DefaultText.CreateAlbum.Description", function(text) {
216                                                 $("#create-album input[name='description']").each(function() {
217                                                         registerInputTextareaSwap(this, text, "description", true, true);
218                                                 });
219                                         });
220                                         $("#create-album label").hide();
221                                 });
222                         </script>
223                 <%/if>
224
225                 <%ifnull sone>
226
227                         <p><%= Page.ImageBrowser.Sone.Error.NotFound.Text|l10n|html></p>
228
229                 <%else>
230
231                         <h1><%= Page.ImageBrowser.Sone.Title|l10n|replace needle='{sone}' replacementKey=sone.niceName|html></h1>
232
233                         <%foreach sone.albums album>
234                                 <div class="album image">
235                                         <a href="imageBrowser.html?album=<% album.id|html>">
236                                                 <%ifnull album.image>
237                                                         <img src="images/unknown-image-0.png" width="200" height="150" alt="<% album.title|html>" title="<% album.title|html>" />
238                                                 <%else><!-- TODO -->
239                                                         <% album.albumImage|image-link max-width=200 max-height=150 title==album.title>
240                                                 <%/if>
241                                                 <br/>
242                                                 <% album.title|html>
243                                         </a>
244                                 </div>
245                         <%/foreach>
246
247                         <%if sone.local>
248                                 <%include include/createAlbum.html>
249                         <%/if>
250
251                 <%/if>
252
253         <%/if>
254
255 <%include include/tail.html>