summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2018-01-17 13:19:46 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2018-01-17 13:19:46 +0100
commit91ee090b466ef33ca18b8a6c7267b7402aaded46 (patch)
treedc0b5e05142a16d0824033abf957bef8740c7dd3
parente6981d344549cb858d3279a720f31e1ac9036b09 (diff)
downloadIshtar-91ee090b466ef33ca18b8a6c7267b7402aaded46.tar.bz2
Ishtar-91ee090b466ef33ca18b8a6c7267b7402aaded46.zip
JS: fix modal scroll on child modal close
-rw-r--r--ishtar_common/static/js/ishtar.js20
-rw-r--r--ishtar_common/templates/blocks/DataTables.html6
2 files changed, 18 insertions, 8 deletions
diff --git a/ishtar_common/static/js/ishtar.js b/ishtar_common/static/js/ishtar.js
index 8794fc722..00a9b66a0 100644
--- a/ishtar_common/static/js/ishtar.js
+++ b/ishtar_common/static/js/ishtar.js
@@ -38,6 +38,7 @@ function get_previous_table_id(){}
var shortcut_url = '';
var datatables_i18n;
+var current_modal;
var datatables_default = {
"processing": true,
@@ -59,7 +60,7 @@ var shortcut_menu_hide_url = '/hide-shortcut-menu/'
var shortcut_menu_show_url = '/show-shortcut-menu/'
function init_shortcut_menu(html){
- $('.modal-progress').modal('hide');
+ close_wait();
$("#context-menu").html(html);
$(".chosen-select").chosen();
if (advanced_menu) {
@@ -194,7 +195,7 @@ function load_shortcut_menu(){
init_shortcut_menu(html);
},
error:function(XMLHttpRequest, textStatus, errorThrows){
- $('.modal-progress').modal('hide');
+ close_wait();
}
});
}
@@ -272,6 +273,13 @@ function long_wait(){
}, 240000);
}
+function close_wait(){
+ $('.modal-progress').modal('hide');
+ if (current_modal){
+ $('body').addClass('modal-open');
+ }
+}
+
var last_window;
function load_window(url, speed, on_success, no_jump){
@@ -280,7 +288,7 @@ function load_window(url, speed, on_success, no_jump){
url: url,
cache: false,
success:function(html){
- $('.modal-progress').modal('hide');
+ close_wait();
$(".previous_page").remove();
$(".next_page").remove();
var register_id = $(html).find(".card-header").attr("data-sheet-id");
@@ -301,7 +309,7 @@ function load_window(url, speed, on_success, no_jump){
if (on_success) on_success();
},
error:function(XMLHttpRequest, textStatus, errorThrows){
- $('.modal-progress').modal('hide');
+ close_wait();
}
});
}
@@ -326,10 +334,10 @@ function load_url(url){
url: url,
cache: false,
success:function(html){
- $('.modal-progress').modal('hide');
+ close_wait();
},
error:function(XMLHttpRequest, textStatus, errorThrows){
- $('.modal-progress').modal('hide');
+ close_wait();
}
});
}
diff --git a/ishtar_common/templates/blocks/DataTables.html b/ishtar_common/templates/blocks/DataTables.html
index 37dd090d2..81b61a86a 100644
--- a/ishtar_common/templates/blocks/DataTables.html
+++ b/ishtar_common/templates/blocks/DataTables.html
@@ -83,14 +83,16 @@ $('#modal_grid_{{name}}').on('show.bs.modal', function (e) {
'#modal_grid_{{name}} .modal-body .current-grid');
$('#window').appendTo(
'#modal_grid_{{name}} .modal-body .current-sheets');
- $('#grid_{{name}}').DataTable().clear().draw()
+ $('#grid_{{name}}').DataTable().clear().draw();
+ current_modal = $("#modal_grid_{{name}}");
});
$('#modal_grid_{{name}}').on('hide.bs.modal', function (e) {
$('#grid_{{name}}_wrapper').appendTo(
'#grid_{{name}}_meta_wrapper');
$('#window').appendTo('#window_wrapper');
- $('#grid_{{name}}').DataTable().clear().draw()
+ $('#grid_{{name}}').DataTable().clear().draw();
+ current_modal = null;
});