From d6e7022470c46d93ca441ecaf23b8846893fc013 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 28 Sep 2018 12:01:00 +0200 Subject: Fix share of point of interest --- chimere/static/chimere/js/base.js | 4 ++- chimere/static/chimere/js/jquery.chimere.js | 9 ++++-- chimere/templates/chimere/detail.html | 14 --------- chimere/templates/chimere/detail_description.html | 14 +++++++++ chimere/templates/chimere/main_map.html | 1 + chimere/views.py | 37 ++++++++++++++++++----- 6 files changed, 54 insertions(+), 25 deletions(-) diff --git a/chimere/static/chimere/js/base.js b/chimere/static/chimere/js/base.js index fd1158a..0cf3f35 100644 --- a/chimere/static/chimere/js/base.js +++ b/chimere/static/chimere/js/base.js @@ -129,7 +129,9 @@ function share_link_update(){ $('.share_link').unbind('click').click(function(){ update_permalink(); var href = $(this).attr('href'); - var url = get_share_url; + var url = ''; + if (area_name) url += "/" + area_name; + url += get_share_url; var classes = $(this).attr('class').split(' '); prefix = 'share_id_'; var share_id; diff --git a/chimere/static/chimere/js/jquery.chimere.js b/chimere/static/chimere/js/jquery.chimere.js index f69565a..dbbc97d 100644 --- a/chimere/static/chimere/js/jquery.chimere.js +++ b/chimere/static/chimere/js/jquery.chimere.js @@ -314,6 +314,7 @@ function transformCoordToLonLat(coord) { } settings[map_id] = $.extend({}, defaults); settings[map_id]._revision = 0; + settings[map_id].load_start = Date.now(); if ( options ) $.extend(settings[map_id], options); @@ -747,7 +748,6 @@ function transformCoordToLonLat(coord) { } }); $("#permalink").click(methods.update_permalink); - return; /* @@ -1691,7 +1691,12 @@ function transformCoordToLonLat(coord) { } if (!data.features){ data.features = []; - if (ids != '0') methods.displayMessage(labels['no_marker_message']); + var laps = Math.floor( + (Date.now() - settings[map_id].load_start)/1000 + ); // arbitrary time for too fast load + if (ids != '0' && laps > 4){ + methods.displayMessage(labels['no_marker_message']); + } } if (data.zoom_need_reload){ settings[map_id]._zoom_need_reload = data.zoom_need_reload; diff --git a/chimere/templates/chimere/detail.html b/chimere/templates/chimere/detail.html index 5bac2b5..eaca0e8 100644 --- a/chimere/templates/chimere/detail.html +++ b/chimere/templates/chimere/detail.html @@ -61,20 +61,6 @@ {%endif%}
{% include "chimere/detail_description.html" %} - {% if extra_categories %} -

{% trans "Also appears in:" %}

- - {% endif %}