diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-05-14 16:12:21 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-06-17 13:21:28 +0200 |
commit | 0122c68228b0cf3f1ec152481bcb7c22248248d3 (patch) | |
tree | 634b407ea8c7b7b778c485744fcea9ac493f5541 /ishtar_common/static/js/ishtar-map.js | |
parent | 014eddee87b0e6e871cf4a201884cf60a41cc63e (diff) | |
download | Ishtar-0122c68228b0cf3f1ec152481bcb7c22248248d3.tar.bz2 Ishtar-0122c68228b0cf3f1ec152481bcb7c22248248d3.zip |
Statistics - JS and templates to manage graphs and tables
Diffstat (limited to 'ishtar_common/static/js/ishtar-map.js')
-rw-r--r-- | ishtar_common/static/js/ishtar-map.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/ishtar_common/static/js/ishtar-map.js b/ishtar_common/static/js/ishtar-map.js index 1b0d4384b..a93813e61 100644 --- a/ishtar_common/static/js/ishtar-map.js +++ b/ishtar_common/static/js/ishtar-map.js @@ -27,6 +27,41 @@ var geolocation = {}; var geoloc_feature = {}; var geoloc_activated = {}; +var fetching_msg = "Fetching data..."; + +var _map_submit_search = function(query_vars, name, source){ + var modal_base_text = $('.modal-progress .modal-header').html(); + $('.modal-progress .modal-header').html(fetching_msg); + $('.modal-progress').modal('show'); + var data = search_get_query_data(query_vars, name); + var nb_select = jQuery("#id_" + name + "-length_map").val(); + if (!nb_select) nb_select = 10; + + var url = source + "json-map?length=" + nb_select + "&submited=1&" + data; + var use_map_limit = false; + if(data.indexOf("no_limit=true") == -1){ + url += "&limit=" + current_map_limit; + use_map_limit = true; + } + $.getJSON(url, function(data) { + var timestamp = Math.floor(Date.now() / 1000); + var map_id = "map-" + timestamp; + $('.modal-progress .modal-header').html("{% trans 'Render map...' %}"); + + var html = render_map(map_id, use_map_limit); + $("#tab-content-map-" + name).html(html); + $("#id_" + name + "-length_map").change(map_submit_search); + if ($('.modal-progress').length > 0){ + $('.modal-progress').modal('hide'); + $('.modal-progress .modal-header').html(modal_base_text); + } + register_map(map_id, data); + }); + + return false; + +}; + var geoloc_activated_message = function(map_id){ setTimeout(function(){ |