From 894fcadf03aaac34038f2938b5db809882108148 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Kl=C3=BCnder?= Date: Wed, 26 Jul 2017 13:29:12 +0200 Subject: [PATCH] send can_close_modal only if in modal --- src/c3nav/editor/static/editor/js/editor.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/c3nav/editor/static/editor/js/editor.js b/src/c3nav/editor/static/editor/js/editor.js index 032fbd91..88c12854 100644 --- a/src/c3nav/editor/static/editor/js/editor.js +++ b/src/c3nav/editor/static/editor/js/editor.js @@ -121,6 +121,7 @@ editor = { } level_control.current_id = parseInt(level_list.attr('data-current-id')); }, + _in_modal: false, _sidebar_loaded: function(data) { // sidebar was loaded. load the content. check if there are any redirects. call _check_start_editing. var content = $('#sidebar').removeClass('loading').find('.content'); @@ -148,6 +149,7 @@ editor = { var modal_close = content.find('[data-modal-close]'); var is_modal = (modal_close.length > 0); + editor._in_modal = is_modal; if (!is_modal) { editor._last_non_modal_path = editor.get_location_path(); } else if (editor._last_non_modal_path !== null) { @@ -228,7 +230,9 @@ editor = { } var action = $(this).attr('action'); editor._sidebar_unload(); - data += '&can_close_modal=' + ((editor._last_non_modal_path === null) ? '0' : '1'); + if (editor._in_modal) { + data += '&can_close_modal=' + ((editor._last_non_modal_path === null) ? '0' : '1'); + } $.post(action, data, editor._sidebar_loaded).fail(editor._sidebar_error); },