Use more _form functions instead of inline api.js calls.
This commit is contained in:
parent
c99f6858df
commit
f9e4bac186
3 changed files with 30 additions and 5 deletions
|
@ -184,7 +184,7 @@ const ALBUM_ID = undefined;
|
|||
|
||||
<button
|
||||
class="red_button button_with_confirm"
|
||||
data-onclick="return api.albums.delete(ALBUM_ID, api.albums.callback_go_to_albums);"
|
||||
data-onclick="return delete_album_form();"
|
||||
data-prompt="Delete Album?"
|
||||
data-cancel-class="gray_button"
|
||||
>
|
||||
|
@ -214,7 +214,7 @@ const ALBUM_ID = undefined;
|
|||
{% set associated_directories = album.get_associated_directories() %}
|
||||
<button
|
||||
class="green_button button_with_spinner"
|
||||
onclick="return api.albums.refresh_directories(ALBUM_ID, common.refresh);"
|
||||
onclick="return refresh_associated_directories_form();"
|
||||
data-spinner-delay="500"
|
||||
{% if associated_directories %}
|
||||
title="Pull from {{associated_directories|length}} directories"
|
||||
|
@ -322,6 +322,16 @@ function add_child(child_id)
|
|||
api.albums.add_child(ALBUM_ID, child_id, common.refresh);
|
||||
}
|
||||
|
||||
function delete_album_form()
|
||||
{
|
||||
api.albums.delete(ALBUM_ID, api.albums.callback_go_to_albums);
|
||||
}
|
||||
|
||||
function refresh_associated_directories_form()
|
||||
{
|
||||
api.albums.refresh_directories(ALBUM_ID, common.refresh);
|
||||
}
|
||||
|
||||
function paste_photo_clipboard()
|
||||
{
|
||||
const photo_ids = Array.from(photo_clipboard.clipboard);
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
|
||||
<button
|
||||
class="red_button button_with_confirm"
|
||||
data-onclick="return api.bookmarks.delete('{{bookmark.id}}', common.refresh);"
|
||||
data-onclick="return delete_bookmark_form();"
|
||||
data-prompt="Delete Bookmark?"
|
||||
data-cancel-class="gray_button"
|
||||
>
|
||||
|
@ -108,6 +108,11 @@ function create_bookmark_form()
|
|||
return api.bookmarks.create(url, title, common.refresh);
|
||||
}
|
||||
|
||||
function delete_bookmark_form()
|
||||
{
|
||||
api.bookmarks.delete('{{bookmark.id}}', common.refresh);
|
||||
}
|
||||
|
||||
function on_open(ed, edit_element_map)
|
||||
{
|
||||
ed.open();
|
||||
|
|
|
@ -258,7 +258,7 @@
|
|||
{% endif %}
|
||||
<button
|
||||
class="red_button button_with_confirm"
|
||||
data-onclick="return api.photos.delete(PHOTO_ID, false, api.photos.callback_go_to_search);"
|
||||
data-onclick="return delete_photo_form();"
|
||||
data-prompt="Delete photo, keep file?"
|
||||
data-cancel-class="gray_button"
|
||||
>
|
||||
|
@ -267,7 +267,7 @@
|
|||
|
||||
<button
|
||||
class="red_button button_with_confirm"
|
||||
data-onclick="return api.photos.delete(PHOTO_ID, true, api.photos.callback_go_to_search);"
|
||||
data-onclick="return delete_photo_from_disk_form();"
|
||||
data-prompt="Delete file on disk?"
|
||||
data-cancel-class="gray_button"
|
||||
>
|
||||
|
@ -381,6 +381,16 @@ function add_remove_photo_tag_callback(response)
|
|||
common.create_message_bubble(message_area, message_positivity, message_text, 8000);
|
||||
}
|
||||
|
||||
function delete_photo_form()
|
||||
{
|
||||
api.photos.delete(PHOTO_ID, false, api.photos.callback_go_to_search);
|
||||
}
|
||||
|
||||
function delete_photo_from_disk_form()
|
||||
{
|
||||
api.photos.delete(PHOTO_ID, true, api.photos.callback_go_to_search);
|
||||
}
|
||||
|
||||
function sort_tag_objects()
|
||||
{
|
||||
const tag_list = document.getElementById("this_tags");
|
||||
|
|
Loading…
Reference in a new issue