diff --git a/frontends/etiquette_flask/etiquette_flask/endpoints/album_endpoints.py b/frontends/etiquette_flask/etiquette_flask/endpoints/album_endpoints.py index e30687c..94ab804 100644 --- a/frontends/etiquette_flask/etiquette_flask/endpoints/album_endpoints.py +++ b/frontends/etiquette_flask/etiquette_flask/endpoints/album_endpoints.py @@ -166,7 +166,7 @@ def get_albums_core(): def get_albums_html(): albums = get_albums_core() session = session_manager.get(request) - return flask.render_template('albums.html', albums=albums, session=session) + return flask.render_template('album.html', albums=albums, session=session) @site.route('/albums.json') @session_manager.give_token @@ -178,18 +178,19 @@ def get_albums_json(): # Album create and delete ########################################################################## @site.route('/albums/create_album', methods=['POST']) +@session_manager.give_token @decorators.catch_etiquette_exception def post_albums_create(): title = request.form.get('title', None) description = request.form.get('description', None) - parent = request.form.get('parent', None) - if parent is not None: - parent = common.P_album(parent) + parent_id = request.form.get('parent_id', None) + if parent_id is not None: + parent = common.P_album(parent_id) user = session_manager.get(request).user album = common.P.new_album(title=title, description=description, author=user) - if parent is not None: + if parent_id is not None: parent.add_child(album) response = etiquette.jsonify.album(album, minimal=False) diff --git a/frontends/etiquette_flask/static/js/albums.js b/frontends/etiquette_flask/static/js/albums.js deleted file mode 100644 index 66233dd..0000000 --- a/frontends/etiquette_flask/static/js/albums.js +++ /dev/null @@ -1,76 +0,0 @@ -var albums = {}; - -albums.create_child_prompt_button = null; -albums.create_child_title_entry = null; -albums.create_child_submit_button = null; -albums.create_child_cancel_button = null; - -albums.open_creator_prompt = -function open_creator_prompt(event) -{ - albums.create_child_prompt_button.classList.add("hidden"); - albums.create_child_title_entry.classList.remove("hidden"); - albums.create_child_title_entry.focus(); - albums.create_child_submit_button.classList.remove("hidden"); - albums.create_child_cancel_button.classList.remove("hidden"); -} - -albums.cancel_create_child = -function cancel_create_child(event) -{ - albums.create_child_prompt_button.classList.remove("hidden"); - albums.create_child_title_entry.value = ""; - albums.create_child_title_entry.classList.add("hidden"); - albums.create_child_submit_button.classList.add("hidden"); - albums.create_child_cancel_button.classList.add("hidden"); -} - -albums.create_album_and_follow = -function create_album_and_follow(title, parent) -{ - var url = "/albums/create_album"; - var data = new FormData(); - if (title !== undefined) - { - data.append("title", title); - } - if (parent !== undefined) - { - data.append("parent", parent); - } - function receive_callback(response) - { - if (response["meta"]["status"] == 200 && response["data"]["id"]) - { - window.location.href = "/album/" + response["data"]["id"]; - } - else - { - console.log(response); - } - } - common.post(url, data, receive_callback); -} - -albums.submit_create_child = -function submit_create_child(event) -{ - var title = document.getElementById("create_child_title_entry").value; - if (! title) - { - title = undefined; - } - var parent_id = ALBUM_ID; - albums.create_album_and_follow(title, parent_id); -} - -albums.on_pageload = -function on_pageload() -{ - albums.create_child_prompt_button = document.getElementById("create_child_prompt_button"); - albums.create_child_title_entry = document.getElementById("create_child_title_entry"); - albums.create_child_submit_button = document.getElementById("create_child_submit_button"); - albums.create_child_cancel_button = document.getElementById("create_child_cancel_button"); - common.bind_box_to_button(albums.create_child_title_entry, albums.create_child_submit_button); -} -document.addEventListener("DOMContentLoaded", albums.on_pageload); diff --git a/frontends/etiquette_flask/templates/album.html b/frontends/etiquette_flask/templates/album.html index 4c7a6bd..2f4d92e 100644 --- a/frontends/etiquette_flask/templates/album.html +++ b/frontends/etiquette_flask/templates/album.html @@ -1,5 +1,53 @@ + +{% if album is not defined %} {## Album listing ###################################################} + + + {% import "header.html" as header %} + Albums + + + + + + + + + + + +{{header.make_header(session=session)}} +
+
+

Albums

+ +
+
+ + + + + +{% else %} {## Individual album ###################################################################} + {% import "photo_card.html" as photo_card %} {% import "header.html" as header %} @@ -11,7 +59,7 @@ - + @@ -21,11 +69,6 @@ p { word-break: break-word; } -#content_body -{ - /* overriding common.css here */ - display: block; -} #album_metadata { max-width: 800px; @@ -36,6 +79,21 @@ p padding: 8px; background-color: var(--color_site_transparency); } + +ul +{ + line-height: 1.5; +} + +.remove_child_button +{ + display: none; +} +.remove_child_button:hover, +li:hover .remove_child_button +{ + display: initial; +} @@ -44,27 +102,36 @@ p {{header.make_header(session=session)}}
-

- {{-album.display_name-}} - -

+ -
-        {{-album.description-}}
-    
+
+            {{-album.description-}}
+        
+ +
+ + {% set photos = album.get_photos() %} {% if photos %}

{{photos|length}} Photos

@@ -108,69 +195,74 @@ p {% endif %} + {% set has_local_photos = photos|length > 0 %} {% set has_child_photos = album.has_any_subalbum_photo() %} {% if has_local_photos or has_child_photos %}

- Download: + Download: {% if has_local_photos %} - - These files ({{album.sum_bytes(recurse=False)|bytestring }}) - - {% if has_child_photos %}—{% endif %} + These files ({{album.sum_bytes(recurse=False)|bytestring }}) + {% if has_child_photos %}{% endif %} {% endif %} {% if has_child_photos %} - - Include children ({{album.sum_bytes(recurse=True)|bytestring }}) - + Include children ({{album.sum_bytes(recurse=True)|bytestring }}) {% endif %}

{% endif %} + + {{clipboard_tray.clipboard_tray()}} +
+ + +
- + +{% endif %} {## Shared ############################################################################} + + diff --git a/frontends/etiquette_flask/templates/albums.html b/frontends/etiquette_flask/templates/albums.html deleted file mode 100644 index 470a3b6..0000000 --- a/frontends/etiquette_flask/templates/albums.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - {% import "header.html" as header %} - Albums - - - - - - - - - - - -{{header.make_header(session=session)}} -
-

Albums

- -
- - - - -