diff --git a/frontends/etiquette_flask/static/js/albums.js b/frontends/etiquette_flask/static/js/albums.js index 542f90f..66233dd 100644 --- a/frontends/etiquette_flask/static/js/albums.js +++ b/frontends/etiquette_flask/static/js/albums.js @@ -1,37 +1,31 @@ -var create_child_prompt_button; -var create_child_title_entry; -var create_child_submit_button; -var create_child_cancel_button; - -function on_pageload() -{ - create_child_prompt_button = document.getElementById("create_child_prompt_button"); - create_child_title_entry = document.getElementById("create_child_title_entry"); - create_child_submit_button = document.getElementById("create_child_submit_button"); - create_child_cancel_button = document.getElementById("create_child_cancel_button"); - common.bind_box_to_button(create_child_title_entry, create_child_submit_button); -} -document.addEventListener("DOMContentLoaded", on_pageload); +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) { - create_child_prompt_button.classList.add("hidden"); - create_child_title_entry.classList.remove("hidden"); - create_child_title_entry.focus(); - create_child_submit_button.classList.remove("hidden"); - create_child_cancel_button.classList.remove("hidden"); + 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) { - create_child_prompt_button.classList.remove("hidden"); - create_child_title_entry.value = ""; - create_child_title_entry.classList.add("hidden"); - create_child_submit_button.classList.add("hidden"); - create_child_cancel_button.classList.add("hidden"); + 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"; @@ -58,6 +52,7 @@ function create_album_and_follow(title, parent) common.post(url, data, receive_callback); } +albums.submit_create_child = function submit_create_child(event) { var title = document.getElementById("create_child_title_entry").value; @@ -66,5 +61,16 @@ function submit_create_child(event) title = undefined; } var parent_id = ALBUM_ID; - create_album_and_follow(title, parent_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 18159c6..08779cb 100644 --- a/frontends/etiquette_flask/templates/album.html +++ b/frontends/etiquette_flask/templates/album.html @@ -80,10 +80,10 @@ p
  • {{sub_album.display_name}}
  • {% endfor %}
  • - + - - + +
  • diff --git a/frontends/etiquette_flask/templates/albums.html b/frontends/etiquette_flask/templates/albums.html index 466c2c5..a451b76 100644 --- a/frontends/etiquette_flask/templates/albums.html +++ b/frontends/etiquette_flask/templates/albums.html @@ -27,10 +27,10 @@
  • {{album.display_name}}
  • {% endfor %}
  • - + - - + +