summaryrefslogtreecommitdiff
path: root/ishtar_common/static/js/ishtar.js
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/static/js/ishtar.js')
-rw-r--r--ishtar_common/static/js/ishtar.js94
1 files changed, 48 insertions, 46 deletions
diff --git a/ishtar_common/static/js/ishtar.js b/ishtar_common/static/js/ishtar.js
index 025b05a56..02dd3ac44 100644
--- a/ishtar_common/static/js/ishtar.js
+++ b/ishtar_common/static/js/ishtar.js
@@ -602,52 +602,6 @@ function close_wait(){
}
}
-var last_window;
-
-function load_window(url, speed, on_success, no_jump){
- $('.modal-progress').modal('show');
- $.ajax({
- url: url,
- cache: false,
- success:function(html){
- close_wait();
- $(".previous_page").remove();
- $(".next_page").remove();
- var register_id = $(html).find(".card-header").attr("data-sheet-id");
- var current_sheet = $('[data-sheet-id="' + register_id + '"]');
- if (current_sheet.length){
- current_sheet.parent().remove();
- }
- var current_id = $(html).find(".card-header").parent().attr("id");
- var current_label = $(html).find(".card-label").html();
- var new_sheet_list = new Array();
- for (idx in sheet_list){
- if (sheet_list[idx]['register_id'] != register_id){
- new_sheet_list.push(sheet_list[idx]);
- }
- }
- sheet_list = new_sheet_list;
- sheet_list.push({'id': current_id, 'label': current_label,
- 'register_id': register_id});
- $("#window").append(html);
- $("#" + last_window).show();
- update_window_menu();
- $(".lg-close").click(); // close a potential lightgallery view
- if (!no_jump){
- // jump to this window
- var url = location.href;
- location.href = "#" + last_window;
- history.replaceState(null, null, url);
- }
- register_wait_button();
- if (on_success) on_success();
- },
- error:function(XMLHttpRequest, textStatus, errorThrows){
- close_wait();
- }
- });
-}
-
function load_current_window(url, model_name){
var id;
if (advanced_menu){
@@ -2198,3 +2152,51 @@ var import_csv_check_ignored = function(){
import_table_update_import_list(import_ids);
});
}
+
+/* keep load_window function at the end of this file */
+
+var last_window;
+
+function load_window(url, speed, on_success, no_jump){
+ $('.modal-progress').modal('show');
+ $.ajax({
+ url: url,
+ cache: false,
+ success:function(html){
+ close_wait();
+ $(".previous_page").remove();
+ $(".next_page").remove();
+ var register_id = $(html).find(".card-header").attr("data-sheet-id");
+ var current_sheet = $('[data-sheet-id="' + register_id + '"]');
+ if (current_sheet.length){
+ current_sheet.parent().remove();
+ }
+ var current_id = $(html).find(".card-header").parent().attr("id");
+ var current_label = $(html).find(".card-label").html();
+ var new_sheet_list = new Array();
+ for (idx in sheet_list){
+ if (sheet_list[idx]['register_id'] != register_id){
+ new_sheet_list.push(sheet_list[idx]);
+ }
+ }
+ sheet_list = new_sheet_list;
+ sheet_list.push({'id': current_id, 'label': current_label,
+ 'register_id': register_id});
+ $("#window").append(html);
+ $("#" + last_window).show();
+ update_window_menu();
+ $(".lg-close").click(); // close a potential lightgallery view
+ if (!no_jump){
+ // jump to this window
+ var url = location.href;
+ location.href = "#" + last_window;
+ history.replaceState(null, null, url);
+ }
+ register_wait_button();
+ if (on_success) on_success();
+ },
+ error:function(XMLHttpRequest, textStatus, errorThrows){
+ close_wait();
+ }
+ });
+}