summaryrefslogtreecommitdiff
path: root/ishtar_common
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2018-02-22 12:16:30 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2018-02-22 12:16:30 +0100
commitabff4e19886c6e820d32fbfc4647ac11323a7626 (patch)
tree187b387cb7dac154564e8e4684c6b463b7a31026 /ishtar_common
parentf23c8b44e08c244af9096d32cc0c3bbbdb9d6627 (diff)
downloadIshtar-abff4e19886c6e820d32fbfc4647ac11323a7626.tar.bz2
Ishtar-abff4e19886c6e820d32fbfc4647ac11323a7626.zip
Improve navigation between sheets (JS)
Diffstat (limited to 'ishtar_common')
-rw-r--r--ishtar_common/static/js/ishtar.js49
1 files changed, 49 insertions, 0 deletions
diff --git a/ishtar_common/static/js/ishtar.js b/ishtar_common/static/js/ishtar.js
index c3e36d77b..2772b3ecf 100644
--- a/ishtar_common/static/js/ishtar.js
+++ b/ishtar_common/static/js/ishtar.js
@@ -324,8 +324,20 @@ function load_window(url, speed, on_success, no_jump){
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();
if (!no_jump){
// jump to this window
var url = location.href;
@@ -354,6 +366,24 @@ function load_current_window(url, model_name){
return load_window(url.join('/'));
}
+function hide_window(window_id){
+ $("#" + window_id).remove();
+ splitted = window_id.split('-');
+ register_id = "";
+ for (idx=0 ; idx < splitted.length - 1 ; idx++){
+ if (idx > 0) register_id += "-";
+ register_id += splitted[idx]
+ }
+ 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;
+ update_window_menu();
+}
+
function load_url(url){
$('.modal-progress').modal('show');
$.ajax({
@@ -500,6 +530,25 @@ function update_search_resume(){
}
}
+var sheet_list = new Array();
+
+function update_window_menu(){
+ if (!sheet_list.length){
+ $("#window-fixed-menu").hide();
+ return
+ }
+ var html = "";
+ for (idx in sheet_list){
+ var sheet = sheet_list[idx];
+ html += '<li class="nav-item">';
+ html += '<a class="nav-link" href="#' + sheet['id'] + '">' +
+ sheet['label'] +'</a>';
+ html += '</li>';
+ }
+ $("#window-fixed-menu-list").html(html);
+ $("#window-fixed-menu").show();
+}
+
function register_advanced_search(){
$(".advanced-search-reset").click(