2016-09-18 08:33:46 +00:00
|
|
|
<!DOCTYPE html5>
|
|
|
|
<html>
|
|
|
|
<head>
|
2016-11-07 02:00:30 +00:00
|
|
|
{% import "photo_card.html" as photo_card %}
|
2016-09-18 08:33:46 +00:00
|
|
|
{% import "header.html" as header %}
|
2017-12-16 11:47:54 +00:00
|
|
|
{% import "clipboard_tray.html" as clipboard_tray %}
|
2017-03-11 01:08:38 +00:00
|
|
|
<title>Album {{album.display_name}}</title>
|
2016-09-18 08:33:46 +00:00
|
|
|
<meta charset="UTF-8">
|
2017-07-21 06:10:48 +00:00
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
2018-02-24 20:51:36 +00:00
|
|
|
<link rel="stylesheet" href="/static/css/common.css">
|
2018-02-24 09:06:27 +00:00
|
|
|
<link rel="stylesheet" href="/static/css/clipboard_tray.css">
|
2018-02-24 08:58:43 +00:00
|
|
|
<link rel="stylesheet" href="/static/css/photo_card.css">
|
2018-02-24 20:51:36 +00:00
|
|
|
<script src="/static/js/common.js"></script>
|
2018-03-10 01:38:40 +00:00
|
|
|
<script src="/static/js/albums.js"></script>
|
2018-02-24 08:46:55 +00:00
|
|
|
<script src="/static/js/editor.js"></script>
|
2018-02-24 08:47:44 +00:00
|
|
|
<script src="/static/js/photoclipboard.js"></script>
|
2016-11-27 09:06:11 +00:00
|
|
|
|
2016-09-18 08:33:46 +00:00
|
|
|
<style>
|
2016-12-14 21:26:42 +00:00
|
|
|
p
|
|
|
|
{
|
|
|
|
word-break: break-word;
|
|
|
|
}
|
2016-09-18 08:33:46 +00:00
|
|
|
#content_body
|
|
|
|
{
|
|
|
|
/* overriding common.css here */
|
|
|
|
display: block;
|
|
|
|
}
|
2017-04-23 04:38:23 +00:00
|
|
|
#title_editor,
|
|
|
|
#description_editor
|
|
|
|
{
|
|
|
|
width: 100%;
|
|
|
|
max-width: 800px;
|
|
|
|
}
|
2017-05-13 22:26:34 +00:00
|
|
|
#description_text
|
2017-04-23 04:38:23 +00:00
|
|
|
{
|
2017-07-17 00:28:06 +00:00
|
|
|
font-family: initial;
|
2017-05-13 22:26:34 +00:00
|
|
|
padding: 8px;
|
|
|
|
background-color: rgba(0, 0, 0, 0.1);
|
2017-04-23 04:38:23 +00:00
|
|
|
}
|
2017-05-13 22:26:34 +00:00
|
|
|
#description_editor textarea
|
2017-04-23 04:38:23 +00:00
|
|
|
{
|
2017-05-13 22:26:34 +00:00
|
|
|
width: 100%;
|
2017-04-23 04:38:23 +00:00
|
|
|
}
|
2016-09-18 08:33:46 +00:00
|
|
|
</style>
|
2016-11-27 09:06:11 +00:00
|
|
|
</head>
|
|
|
|
|
2016-09-18 08:33:46 +00:00
|
|
|
|
|
|
|
<body>
|
2016-12-18 13:12:14 +00:00
|
|
|
{{header.make_header(session=session)}}
|
2016-09-18 08:33:46 +00:00
|
|
|
<div id="content_body">
|
2017-07-14 06:28:51 +00:00
|
|
|
<h2>
|
2018-03-11 03:54:56 +00:00
|
|
|
<span data-editor-id="title" data-editor-empty-text="{{album.id}}" data-editor-placeholder="title" id="title_text">{{album.display_name}}</span>
|
2017-04-23 04:38:23 +00:00
|
|
|
</h2>
|
2017-07-17 00:28:06 +00:00
|
|
|
<pre
|
|
|
|
id="description_text"
|
|
|
|
data-editor-id="description"
|
|
|
|
data-editor-placeholder="description"
|
2018-03-23 06:39:11 +00:00
|
|
|
{% if not album.description %}class="hidden"{% endif %}
|
2017-07-17 00:28:06 +00:00
|
|
|
>
|
|
|
|
{{-album.description-}}
|
|
|
|
</pre>
|
2017-04-23 04:38:23 +00:00
|
|
|
|
2016-09-18 08:33:46 +00:00
|
|
|
<ul>
|
2017-11-28 00:00:52 +00:00
|
|
|
{% set viewparam = "?view=list" if view == "list" else "" %}
|
2018-02-17 06:59:34 +00:00
|
|
|
{% set parent = album.get_parent() %}
|
2017-11-28 00:00:52 +00:00
|
|
|
{% if parent %}
|
|
|
|
<li><a href="/album/{{parent.id}}{{viewparam}}">{{parent.display_name}}</a></li>
|
|
|
|
{% else %}
|
|
|
|
<li><a href="/albums">Albums</a></li>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<ul>
|
2018-03-11 03:54:22 +00:00
|
|
|
<li>{{album.display_name}}</li>
|
2017-11-28 00:00:52 +00:00
|
|
|
<ul>
|
2018-02-17 07:00:43 +00:00
|
|
|
{% set sub_albums = album.get_children() %}
|
2017-11-28 00:00:52 +00:00
|
|
|
{% for sub_album in sub_albums|sort(attribute='title') %}
|
|
|
|
<li><a href="/album/{{sub_album.id}}{{viewparam}}">{{sub_album.display_name}}</a></li>
|
|
|
|
{% endfor %}
|
2018-03-10 01:38:40 +00:00
|
|
|
<li>
|
|
|
|
<button id="create_child_prompt_button" class="green_button" onclick="open_creator_prompt(event);">Create child</button>
|
|
|
|
<input type="text" id="create_child_title_entry" class="hidden" placeholder="Album title">
|
|
|
|
<button id="create_child_submit_button" class="green_button hidden" onclick="submit_create_child(event);">Create</button>
|
|
|
|
<button id="create_child_cancel_button" class="red_button hidden" onclick="cancel_create_child(event);">Cancel</button>
|
|
|
|
</li>
|
2017-11-28 00:00:52 +00:00
|
|
|
</ul>
|
|
|
|
</ul>
|
2016-09-18 08:33:46 +00:00
|
|
|
</ul>
|
2017-04-23 04:38:23 +00:00
|
|
|
|
2018-02-17 07:03:54 +00:00
|
|
|
{% set photos = album.get_photos() %}
|
2016-09-18 08:33:46 +00:00
|
|
|
{% if photos %}
|
2018-04-07 04:50:13 +00:00
|
|
|
<h3>{{photos|length}} Photos</h3>
|
2017-03-31 01:56:27 +00:00
|
|
|
{% if view != "list" %}
|
|
|
|
<a href="?view=list">List view</a>
|
|
|
|
{% else %}
|
|
|
|
<a href="?view=grid">Grid view</a>
|
|
|
|
{% endif %}
|
|
|
|
<ul>
|
2016-09-18 08:33:46 +00:00
|
|
|
{% for photo in photos %}
|
2017-03-31 01:56:27 +00:00
|
|
|
{{photo_card.create_photo_card(photo, view=view)}}
|
2016-09-18 08:33:46 +00:00
|
|
|
{% endfor %}
|
2017-03-31 01:56:27 +00:00
|
|
|
</ul>
|
2016-09-18 08:33:46 +00:00
|
|
|
{% endif %}
|
2017-11-12 23:21:53 +00:00
|
|
|
|
2017-05-13 22:25:31 +00:00
|
|
|
<p>
|
2017-11-12 23:21:53 +00:00
|
|
|
{% set has_local_photos = photos|length > 0 %}
|
2018-04-15 09:41:24 +00:00
|
|
|
{% set has_child_photos = album.has_any_subalbum_photo() %}
|
2017-11-12 23:21:53 +00:00
|
|
|
{% if has_local_photos or has_child_photos %}
|
2017-05-13 22:25:31 +00:00
|
|
|
Download:
|
2017-11-12 23:21:53 +00:00
|
|
|
{% if has_local_photos %}
|
2017-05-13 22:25:31 +00:00
|
|
|
<a href="/album/{{album.id}}.zip?recursive=no">
|
2018-04-15 07:59:54 +00:00
|
|
|
These files ({{album.sum_bytes(recurse=False)|bytestring }})
|
2017-05-13 22:25:31 +00:00
|
|
|
</a>
|
|
|
|
{% endif %}
|
2017-11-12 23:21:53 +00:00
|
|
|
{% if has_local_photos and has_child_photos %}—{% endif %}
|
|
|
|
{% if has_child_photos %}
|
2017-05-13 22:25:31 +00:00
|
|
|
<a href="/album/{{album.id}}.zip?recursive=yes">
|
2018-04-15 07:59:54 +00:00
|
|
|
Include children ({{album.sum_bytes(recurse=True)|bytestring }})
|
2017-05-13 22:25:31 +00:00
|
|
|
</a>
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
</p>
|
2017-12-16 11:47:54 +00:00
|
|
|
{{clipboard_tray.clipboard_tray()}}
|
2016-09-18 08:33:46 +00:00
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
2018-03-10 01:38:40 +00:00
|
|
|
var ALBUM_ID = "{{album.id}}";
|
2017-04-23 04:38:23 +00:00
|
|
|
|
2017-12-16 22:19:37 +00:00
|
|
|
function _paste_unpaste_photo_clipboard(add_or_remove)
|
|
|
|
{
|
2018-03-10 01:38:40 +00:00
|
|
|
var photo_ids = Array.from(photo_clipboard).join(",");
|
2017-12-16 22:19:37 +00:00
|
|
|
var url = "/album/{{album.id}}/" + add_or_remove;
|
|
|
|
var data = new FormData();
|
|
|
|
data.append("photo_id", photo_ids);
|
2018-02-18 02:47:17 +00:00
|
|
|
var callback = function(response)
|
|
|
|
{
|
|
|
|
if (response["meta"]["status"] !== 200)
|
2018-01-20 05:44:21 +00:00
|
|
|
{
|
2018-02-18 02:47:17 +00:00
|
|
|
return;
|
2018-01-20 05:44:21 +00:00
|
|
|
}
|
2018-02-18 02:47:17 +00:00
|
|
|
save_photo_clipboard();
|
|
|
|
location.reload();
|
2017-12-16 22:19:37 +00:00
|
|
|
};
|
|
|
|
post(url, data, callback);
|
|
|
|
}
|
|
|
|
function paste_photo_clipboard()
|
|
|
|
{
|
|
|
|
_paste_unpaste_photo_clipboard("add_photo");
|
|
|
|
}
|
|
|
|
function unpaste_photo_clipboard()
|
|
|
|
{
|
|
|
|
_paste_unpaste_photo_clipboard("remove_photo");
|
|
|
|
}
|
|
|
|
var paste_photo_clipboard_button = document.createElement("button");
|
|
|
|
paste_photo_clipboard_button.classList.add("green_button");
|
|
|
|
paste_photo_clipboard_button.innerText = "Add to album";
|
|
|
|
paste_photo_clipboard_button.onclick = paste_photo_clipboard;
|
|
|
|
document.getElementById("clipboard_tray_toolbox").appendChild(paste_photo_clipboard_button);
|
|
|
|
|
|
|
|
var unpaste_photo_clipboard_button = document.createElement("button");
|
|
|
|
unpaste_photo_clipboard_button.classList.add("red_button");
|
|
|
|
unpaste_photo_clipboard_button.innerText = "Remove from album";
|
|
|
|
unpaste_photo_clipboard_button.onclick = unpaste_photo_clipboard;
|
|
|
|
document.getElementById("clipboard_tray_toolbox").appendChild(unpaste_photo_clipboard_button);
|
|
|
|
|
2017-07-14 06:32:14 +00:00
|
|
|
function on_open(editor, edit_element_map, display_element_map)
|
2017-05-06 04:17:13 +00:00
|
|
|
{
|
2017-06-15 04:45:20 +00:00
|
|
|
editor.open();
|
2017-07-14 06:32:14 +00:00
|
|
|
edit_element_map["title"].focus();
|
2017-04-23 04:38:23 +00:00
|
|
|
}
|
|
|
|
|
2017-07-14 06:32:14 +00:00
|
|
|
function on_save(editor, edit_element_map, display_element_map)
|
2017-04-23 04:38:23 +00:00
|
|
|
{
|
2017-06-15 04:45:20 +00:00
|
|
|
function callback()
|
2017-05-06 04:17:13 +00:00
|
|
|
{
|
2018-03-10 21:24:23 +00:00
|
|
|
var title_display = display_element_map["title"];
|
|
|
|
var description_display = display_element_map["description"];
|
|
|
|
|
2017-06-15 04:45:20 +00:00
|
|
|
editor.hide_spinner();
|
|
|
|
editor.save();
|
2018-03-10 21:24:23 +00:00
|
|
|
if (title_display.innerText == title_display.dataset.editorEmptyText)
|
2017-04-23 04:38:23 +00:00
|
|
|
{
|
2018-03-11 03:54:56 +00:00
|
|
|
document.title = "Album " + title_display.dataset.editorEmptyText;
|
2017-04-23 04:38:23 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-03-10 21:24:23 +00:00
|
|
|
document.title = "Album " + title_display.innerText;
|
2017-06-15 04:45:20 +00:00
|
|
|
}
|
2018-03-10 21:24:23 +00:00
|
|
|
if (description_display.innerText == "")
|
2017-06-15 04:45:20 +00:00
|
|
|
{
|
2018-03-10 21:24:23 +00:00
|
|
|
description_display.classList.add("hidden");
|
2017-04-23 04:38:23 +00:00
|
|
|
}
|
|
|
|
}
|
2017-06-15 04:45:20 +00:00
|
|
|
|
2018-03-10 21:24:23 +00:00
|
|
|
var title_editor = edit_element_map["title"];
|
|
|
|
title_editor.value = title_editor.value.trim();
|
|
|
|
var description_editor = edit_element_map["description"];
|
|
|
|
|
2017-06-15 04:45:20 +00:00
|
|
|
var url = "/album/{{album.id}}/edit";
|
2018-03-10 21:24:23 +00:00
|
|
|
var title = edit_element_map["title"].value.trim();
|
|
|
|
var description = edit_element_map["description"].value;
|
2017-06-15 04:45:20 +00:00
|
|
|
var data = new FormData();
|
|
|
|
data.append("title", title_editor.value);
|
|
|
|
data.append("description", description_editor.value);
|
2018-03-10 21:24:23 +00:00
|
|
|
|
|
|
|
editor.show_spinner();
|
2017-06-15 04:45:20 +00:00
|
|
|
post(url, data, callback);
|
2017-04-23 04:38:23 +00:00
|
|
|
}
|
2017-06-15 04:45:20 +00:00
|
|
|
|
2017-07-14 06:32:14 +00:00
|
|
|
function on_cancel(editor, edit_element_map, display_element_map)
|
2017-06-15 04:56:47 +00:00
|
|
|
{
|
|
|
|
editor.cancel();
|
2017-07-14 06:32:14 +00:00
|
|
|
if (display_element_map["description"].innerText == "")
|
2017-06-15 04:56:47 +00:00
|
|
|
{
|
2017-07-14 06:32:14 +00:00
|
|
|
display_element_map["description"].classList.add("hidden");
|
2017-06-15 04:56:47 +00:00
|
|
|
}
|
|
|
|
}
|
2017-06-15 04:45:20 +00:00
|
|
|
|
2017-07-14 06:32:14 +00:00
|
|
|
var title_text = document.getElementById("title_text");
|
|
|
|
var description_text = document.getElementById("description_text");
|
2017-06-15 04:45:20 +00:00
|
|
|
var editor = new Editor([title_text, description_text], on_open, on_save, on_cancel);
|
2016-11-27 09:06:11 +00:00
|
|
|
</script>
|
2017-04-23 04:38:23 +00:00
|
|
|
</html>
|