diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-02-20 17:27:28 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-04-24 19:38:57 +0200 |
commit | fd2531f407c0d2db884a09563a6c25ae924a19b8 (patch) | |
tree | f6c530b9f57fd68088ebeaafdb25d2482dbc91ec /ishtar_common/static/js/ishtar.js | |
parent | 579fa06f40218802184d3cf78df457b0c504bb67 (diff) | |
download | Ishtar-fd2531f407c0d2db884a09563a6c25ae924a19b8.tar.bz2 Ishtar-fd2531f407c0d2db884a09563a6c25ae924a19b8.zip |
Map: display number of items - link to item not displayed
Diffstat (limited to 'ishtar_common/static/js/ishtar.js')
-rw-r--r-- | ishtar_common/static/js/ishtar.js | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/ishtar_common/static/js/ishtar.js b/ishtar_common/static/js/ishtar.js index e8652720a..415398b95 100644 --- a/ishtar_common/static/js/ishtar.js +++ b/ishtar_common/static/js/ishtar.js @@ -1265,6 +1265,9 @@ var limit_map_msg = "Limit to {0} items"; var limit_map_help_msg = "Unchecking this limit on a poorly performing device may result in web browser freeze"; var limit_map_nb = 50000; var current_map_limit = limit_map_nb; +var displayed_map_msg = "{0} items displayed on the map"; +var non_displayed_map_msg = "{0} items not displayed"; +var non_displayed_map_link_msg = "(list)"; var render_map = function(map_id, use_map_limit){ var html = ""; @@ -1274,7 +1277,8 @@ var render_map = function(map_id, use_map_limit){ html += "<input class='form-check-input' type='checkbox' id='ishtar-map-limit-" + map_id + "' "; if (use_map_limit) html += " checked='checked'"; html += "/> "; - html += "<label class='form-check-label' for='ishtar-map-limit-" + map_id + "'>" + limit_map_msg.format(limit_map_nb); + html += "<label class='form-check-label' for='ishtar-map-limit-" + map_id + "'>"; + html += limit_map_msg.format(number_with_commas(limit_map_nb)); html += " <i class='fa fa-question-circle' title=\""+ limit_map_help_msg +"\" aria-hidden='true'></i></label>"; html += "</div></div>"; html += "<div class='ishtar-table-map' id='" + map_id + "'></div>"; @@ -1284,6 +1288,8 @@ var render_map = function(map_id, use_map_limit){ return html; }; +var no_geo_window_content = ""; + var register_map = function(map_id, points){ display_map(map_id, points); $('#ishtar-map-limit-' + map_id).change(function() { @@ -1294,6 +1300,41 @@ var register_map = function(map_id, points){ } $(".search_button").click(); }); + if (points){ + var lbl = ""; + if (points['features'].length){ + lbl += displayed_map_msg.format( + number_with_commas(points['features'].length) + ); + } + if (points['no-geo'].length){ + if (points['features'].length){ + lbl += " - "; + } + lbl += non_displayed_map_msg.format( + number_with_commas(points['no-geo'].length) + ); + lbl += " <a href='#' id='no-geo-" + map_id + "'>" + non_displayed_map_link_msg + "</a>"; + } + $("#ishtar-map-info-" + map_id).html(lbl); + + no_geo_window_content = "<ul>"; + for (var idx in points['no-geo']){ + no_geo = points['no-geo'][idx]; + var link = link_template[map_id].replace("<pk>", no_geo["id"]); + var txt = "<li>" + link + " " + no_geo['name'] + "</li>"; + no_geo_window_content += txt; + } + no_geo_window_content += "</ul>"; + $("#no-geo-" + map_id).click(function(){ + $(popup_item[map_id]).hide(); + $('#ishtar-map-window-' + map_id).hide(); + $("#ishtar-map-window-" + map_id + " .modal-body").html( + no_geo_window_content + ); + $('#ishtar-map-window-' + map_id).show(); + }); + } }; var main_submit_search = function(){ |