summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoretienne <etienne@9215b0d5-fb2c-4bbd-8d3e-bd2e9090e864>2010-04-05 18:38:21 +0000
committeretienne <etienne@9215b0d5-fb2c-4bbd-8d3e-bd2e9090e864>2010-04-05 18:38:21 +0000
commit5f6363cbb2a499ef5009efbe26d9a3b6fc6e16b2 (patch)
treea5cb0ee5ae3187eef0c8c9280bc1b11691452202
parent04371d1191f094eb6a2e1c16a37fe2f6a590ee36 (diff)
downloadChimère-5f6363cbb2a499ef5009efbe26d9a3b6fc6e16b2.tar.bz2
Chimère-5f6363cbb2a499ef5009efbe26d9a3b6fc6e16b2.zip
Add the current selected item to the permalink - #92
git-svn-id: http://www.peacefrogs.net/svn/chimere/trunk@76 9215b0d5-fb2c-4bbd-8d3e-bd2e9090e864
-rw-r--r--chimere/main/views.py5
-rw-r--r--chimere/static/main_map.js11
-rw-r--r--chimere/templates/main_map.html12
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>