diff options
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(){ | 
