diff options
-rw-r--r-- | chimere/main/views.py | 5 | ||||
-rw-r--r-- | chimere/static/main_map.js | 11 | ||||
-rw-r--r-- | chimere/templates/main_map.html | 12 |
3 files changed, 20 insertions, 8 deletions
diff --git a/chimere/main/views.py b/chimere/main/views.py index 7556610..52c0627 100644 --- a/chimere/main/views.py +++ b/chimere/main/views.py @@ -91,11 +91,12 @@ def index(request, area_name=None, default_area=None, simple=False): }) # manage permalink if request.GET: - for key in ('zoom', 'lon', 'lat', 'display_submited'): + for key in ('zoom', 'lon', 'lat', 'display_submited', + 'current_feature'): if key in request.GET and request.GET[key]: response_dct['p_'+key] = request.GET[key] else: - response_dct['p_'+key] = '""' + response_dct['p_'+key] = None if 'checked_categories' in request.GET \ and request.GET['checked_categories']: cats = request.GET['checked_categories'].split('_') diff --git a/chimere/static/main_map.js b/chimere/static/main_map.js index fb736f5..792021c 100644 --- a/chimere/static/main_map.js +++ b/chimere/static/main_map.js @@ -136,6 +136,7 @@ function showPop(feature) { currentPopup = feature.popup; /* hide on click on the cloud */ currentPopup.groupDiv.onclick = hidePopUp; + permalink.updateLink(); } /* check checked categories */ @@ -362,6 +363,13 @@ function putMarker(layer, mark) { marker.events.register('mouseover', feature, markerOver); marker.events.register('mouseout', feature, markerOut); layer.addMarker(marker); + /* show the item when designed in the permalink */ + if (p_current_feature == feature.pk){ + showPop(feature); + clicked = true; + updateDetail(feature.pk); + p_current_feature = null; + } return feature; } @@ -452,6 +460,9 @@ function createParams(center, zoom, layers) { /* only piece of code added */ params.checked_categories = checked_categories; params.display_submited = display_submited; + if(currentFeature){ + params.current_feature = currentFeature.pk; + } } return params; } diff --git a/chimere/templates/main_map.html b/chimere/templates/main_map.html index 3d01d9f..526bf32 100644 --- a/chimere/templates/main_map.html +++ b/chimere/templates/main_map.html @@ -31,12 +31,12 @@ var map_layer = {{map_layer|safe}}; var permalink_label = '{%trans "Permalink"%}'; var dynamic_categories{%if dynamic_categories %} = 1{%endif%}; var default_area{%if default_area %} = new Array({{default_area.upper_left_corner.x}}, {{default_area.upper_left_corner.y}}, {{default_area.lower_right_corner.x}}, {{default_area.lower_right_corner.y}}){%endif%}; -var p_zoom; -{%if p_zoom %}p_zoom={{p_zoom}}; -var p_lat={{p_lat}}; -var p_lon={{p_lon}}; -var p_display_submited={{p_display_submited}}; -var p_checked_categories = [{{p_checked_categories}}];{%endif%} +var p_zoom{%if p_zoom %} = {{p_zoom}}{%endif%}; +var p_lat{%if p_lat %} = {{p_lat}}{%endif%}; +var p_lon{%if p_lon %} = {{p_lon}}{%endif%}; +var p_display_submited{%if p_display_submited %} = {{p_display_submited}}{%endif%}; +var p_checked_categories{%if p_checked_categories %} = [{{p_checked_categories}}];{%endif%} +var p_current_feature{% if p_current_feature %} = {{p_current_feature}}{%endif%}; init(); // --> </script>{% endblock %} {% block footer %}<div id='map-footer'>{{ block.super }} - {% trans "Map"%} © <a href='http://openstreetmap.org/'>OpenStreetMap</a></div> |