Fix #1930964 [[Enhancement - Server] Show a warning when not having applied changes after editing metadata](https://bugs.launchpad.net/calibre/+bug/1930964)

This commit is contained in:
Kovid Goyal 2021-06-09 20:26:13 +05:30
parent 67a9c175c7
commit 17e19bdff3
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -2,10 +2,9 @@
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net> # License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals from __python__ import bound_methods, hash_literals
import traceback
from elementmaker import E from elementmaker import E
from gettext import gettext as _
import traceback
from ajax import ajax_send from ajax import ajax_send
from book_list.book_details import ( from book_list.book_details import (
add_stars_to, basic_table_rules, fetch_metadata, field_sorter, no_book, add_stars_to, basic_table_rules, fetch_metadata, field_sorter, no_book,
@ -29,7 +28,8 @@ from dom import add_extra_css, build_rule, clear, svgicon
from file_uploads import ( from file_uploads import (
update_status_widget, upload_files_widget, upload_status_widget update_status_widget, upload_files_widget, upload_status_widget
) )
from modals import error_dialog from gettext import gettext as _
from modals import error_dialog, question_dialog
from session import get_interface_data from session import get_interface_data
from utils import ( from utils import (
conditional_timeout, fmt_sidx, parse_url_params, safe_set_inner_html conditional_timeout, fmt_sidx, parse_url_params, safe_set_inner_html
@ -1055,7 +1055,15 @@ def on_close(container_id):
document.location.protocol + '//' + document.location.host document.location.protocol + '//' + document.location.host
) )
else: else:
back() if has_changes:
question_dialog(_('Are you sure'), _(
'Any changes you have made will be discarded.'
' Do you wish to discard all changes?'), def (yes):
if yes:
back()
)
else:
back()
def proceed_after_succesful_fetch_metadata(container_id, book_id): def proceed_after_succesful_fetch_metadata(container_id, book_id):