Move description to top of page.
[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 class="backlink"><%= 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                         <p id="description"><% album.description|html></p>
71
72                         <%foreach album.albums album>
73                                 <div class="album image">
74                                         <a href="imageBrowser.html?album=<% album.id|html>" title="<% album.title|html>">
75                                                 <%ifnull album.albumImage>
76                                                         <img src="images/unknown-image-0.png" width="200" height="150" alt="<% album.title|html>" title="<% album.title|html>" />
77                                                 <%else><!-- TODO -->
78                                                         <% album.albumImage|image-link max-width=200 max-height=150 title==album.title>
79                                                 <%/if>
80                                                 <br/>
81                                                 <% album.title|html>
82                                         </a>
83                                 </div>
84                         <%/foreach>
85
86                         <%foreach album.images image>
87                                 <div class="image">
88                                         <a href="imageBrowser.html?image=<%image.id|html>"><% image|image-link max-width=200 max-height=150></a>
89                                 </div>
90                         <%/foreach>
91
92
93                         <%if album.sone.local>
94                                 <%include include/uploadImage.html>
95                                 <%include include/createAlbum.html>
96
97                                 <h2><%= Page.ImageBrowser.Album.Edit.Title|l10n|html></h2>
98
99                                 <form id="edit-album" action="editAlbum.html" method="post">
100                                         <input type="hidden" name="formPassword" value="<%formPassword|html>" />
101                                         <input type="hidden" name="album" value="<%album.id|html>" />
102
103                                         <div>
104                                                 <label for="title"><%= Page.ImageBrowser.Album.Label.Title|l10n|html></label>
105                                                 <input type="text" name="title" value="<%album.title|html>" />
106                                         </div>
107                                         <div>
108                                                 <label for="description"><%= Page.ImageBrowser.Album.Label.Description|l10n|html></label>
109                                                 <textarea name="description"><%album.description|html></textarea>
110                                         </div>
111                                         <button type="submit"><%= Page.ImageBrowser.Album.Button.Save|l10n|html></button>
112                                 </form>
113
114                                 <%if album.empty>
115                                         <form id="delete-album" action="deleteAlbum.html" method="get">
116                                                 <input type="hidden" name="album" value="<%album.id|html>" />
117                                                 <button type="submit"><%= Page.ImageBrowser.Album.Button.Delete|l10n|html></button>
118                                         </form>
119                                 <%/if>
120
121                         <%/if>
122
123                 <%/if>
124
125         <%elseif imageRequested>
126
127                 <h1 class="backlink"><%image.title|html></h1>
128
129                 <div class="backlinks">
130                         <%foreach image.album.backlinks backlink backlinks>
131                                 <div class="backlink">
132                                         <a href="<% backlink.target|html>"><% backlink.name|html></a>
133                                 </div>
134                                 <%if ! backlinks.last>
135                                         <div class="separator">&gt;</div>
136                                 <%/if>
137                         <%/foreach>
138                 </div>
139
140                 <%ifnull image>
141
142                 <%else>
143
144                         <%if image.sone.local>
145                                 <script language="javascript">
146                                         $(function() {
147                                                 getTranslation("WebInterface.DefaultText.EditImage.Title", function(text) {
148                                                         $("#edit-image input[name='title']").each(function() {
149                                                                 registerInputTextareaSwap(this, text, "title", false, true);
150                                                         });
151                                                 });
152                                                 getTranslation("WebInterface.DefaultText.EditImage.Description", function(text) {
153                                                         $("#edit-image :input[name='description']").each(function() {
154                                                                 registerInputTextareaSwap(this, text, "description", true, false);
155                                                         });
156                                                 });
157                                                 $("#edit-image label").hide();
158                                         });
159                                 </script>
160                         <%/if>
161
162                         <div class="single-image">
163                                 <%ifnull !image.key>
164                                         <a href="/<%image.key|html>"><% image|image-link max-width=640 max-height=480></a>
165                                 <%else>
166                                         <a href="imageBrowser.html?image=<%image.id|html>"><% image|image-link max-width=640 max-height=480></a>
167                                 <%/if>
168                         </div>
169
170                         <p class="parsed"><%image.description|parse sone=image.sone></p>
171
172                         <%if image.sone.local>
173
174                                 <h2><%= Page.ImageBrowser.Image.Edit.Title|l10n|html></h2>
175
176                                 <form id="edit-image" action="editImage.html" method="post">
177                                         <input type="hidden" name="formPassword" value="<%formPassword|html>" />
178                                         <input type="hidden" name="image" value="<%image.id|html>" />
179
180                                         <div>
181                                                 <label for="title"><%= Page.ImageBrowser.Image.Title.Label|l10n|html></label>
182                                                 <input type="text" name="title" value="<%image.title|html>" />
183                                         </div>
184                                         <div>
185                                                 <label for="description"><%= Page.ImageBrowser.Image.Description.Label|l10n|html></label>
186                                                 <textarea name="description"><%image.description|html></textarea>
187                                         </div>
188                                         <div>
189                                                 <button type="submit"><%= Page.ImageBrowser.Image.Button.Save|l10n|html></button>
190                                         </div>
191                                 </form>
192
193                                 <h2><%= Page.ImageBrowser.Image.Delete.Title|l10n|html></h2>
194
195                                 <form id="delete-image" action="deleteImage.html" method="get">
196                                         <input type="hidden" name="image" value="<%image.id|html>" />
197                                         <button type="submit"><%= Page.ImageBrowser.Image.Button.Delete|l10n|html></button>
198                                 </form>
199
200                         <%/if>
201
202                 <%/if>
203
204         <%elseif soneRequested>
205
206                 <%if sone.local>
207                         <script language="javascript">
208                                 $(function() {
209                                         getTranslation("WebInterface.DefaultText.CreateAlbum.Name", function(text) {
210                                                 $("#create-album input[name='name']").each(function() {
211                                                         registerInputTextareaSwap(this, text, "name", false, true);
212                                                 });
213                                         });
214                                         getTranslation("WebInterface.DefaultText.CreateAlbum.Description", function(text) {
215                                                 $("#create-album input[name='description']").each(function() {
216                                                         registerInputTextareaSwap(this, text, "description", true, true);
217                                                 });
218                                         });
219                                         $("#create-album label").hide();
220                                 });
221                         </script>
222                 <%/if>
223
224                 <%ifnull sone>
225
226                         <p><%= Page.ImageBrowser.Sone.Error.NotFound.Text|l10n|html></p>
227
228                 <%else>
229
230                         <h1><%= Page.ImageBrowser.Sone.Title|l10n|replace needle='{sone}' replacementKey=sone.niceName|html></h1>
231
232                         <%foreach sone.albums album>
233                                 <div class="album image">
234                                         <a href="imageBrowser.html?album=<% album.id|html>" title="<% album.title|html>">
235                                                 <%ifnull album.albumImage>
236                                                         <img src="images/unknown-image-0.png" width="200" height="150" alt="<% album.title|html>" title="<% album.title|html>" />
237                                                 <%else><!-- TODO -->
238                                                         <% album.albumImage|image-link max-width=200 max-height=150 title==album.title>
239                                                 <%/if>
240                                                 <br/>
241                                                 <% album.title|html>
242                                         </a>
243                                 </div>
244                         <%/foreach>
245
246                         <%if sone.local>
247                                 <%include include/createAlbum.html>
248                         <%/if>
249
250                 <%/if>
251
252         <%/if>
253
254 <%include include/tail.html>