Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #11249, #11261 -- Blocks may now be overridden again `google-ma…

…p.js` template; now use GMaps `setUIToDefault` to use default controls. Thanks to ludifan and Peter Landry for the ttickets and patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@11124 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit cb9cf01ff292cc6e6b8489258d1c59a6e8631d52 1 parent fdcc0c7
@jbronn jbronn authored
View
4 django/contrib/gis/maps/google/gmap.py
@@ -21,7 +21,7 @@ class GoogleMap(object):
def __init__(self, key=None, api_url=None, version=None,
center=None, zoom=None, dom_id='map',
kml_urls=[], polylines=None, polygons=None, markers=None,
- template='gis/google/google-single.js',
+ template='gis/google/google-map.js',
js_module='geodjango',
extra_context={}):
@@ -162,7 +162,7 @@ def __init__(self, *args, **kwargs):
# This is the template used to generate the GMap load JavaScript for
# each map in the set.
- self.map_template = kwargs.pop('map_template', 'gis/google/google-map.js')
+ self.map_template = kwargs.pop('map_template', 'gis/google/google-single.js')
# Running GoogleMap.__init__(), and resetting the template
# value with default obtained above.
View
7 django/contrib/gis/templates/gis/google/google-base.js
@@ -1,7 +0,0 @@
-{% block vars %}var geodjango = {};{% for icon in icons %}
-var {{ icon.varname }} = new GIcon(G_DEFAULT_ICON);
-{% if icon.image %}{{ icon.varname }}.image = "{{ icon.image }}";{% endif %}
-{% if icon.shadow %}{{ icon.varname }}.shadow = "{{ icon.shadow }}";{% endif %} {% if icon.shadowsize %}{{ icon.varname }}.shadowSize = new GSize({{ icon.shadowsize.0 }}, {{ icon.shadowsize.1 }});{% endif %}
-{% if icon.iconanchor %}{{ icon.varname }}.iconAnchor = new GPoint({{ icon.iconanchor.0 }}, {{ icon.iconanchor.1 }});{% endif %} {% if icon.iconsize %}{{ icon.varname }}.iconSize = new GSize({{ icon.iconsize.0 }}, {{ icon.iconsize.1 }});{% endif %}
-{% if icon.infowindowanchor %}{{ icon.varname }}.infoWindowAnchor = new GPoint({{ icon.infowindowanchor.0 }}, {{ icon.infowindowanchor.1 }});{% endif %}{% endfor %}{% endblock %}
-{% block functions %}{% endblock %}
View
12 django/contrib/gis/templates/gis/google/google-map.js
@@ -1,10 +1,16 @@
{% autoescape off %}
+{% block vars %}var geodjango = {};{% for icon in icons %}
+var {{ icon.varname }} = new GIcon(G_DEFAULT_ICON);
+{% if icon.image %}{{ icon.varname }}.image = "{{ icon.image }}";{% endif %}
+{% if icon.shadow %}{{ icon.varname }}.shadow = "{{ icon.shadow }}";{% endif %} {% if icon.shadowsize %}{{ icon.varname }}.shadowSize = new GSize({{ icon.shadowsize.0 }}, {{ icon.shadowsize.1 }});{% endif %}
+{% if icon.iconanchor %}{{ icon.varname }}.iconAnchor = new GPoint({{ icon.iconanchor.0 }}, {{ icon.iconanchor.1 }});{% endif %} {% if icon.iconsize %}{{ icon.varname }}.iconSize = new GSize({{ icon.iconsize.0 }}, {{ icon.iconsize.1 }});{% endif %}
+{% if icon.infowindowanchor %}{{ icon.varname }}.infoWindowAnchor = new GPoint({{ icon.infowindowanchor.0 }}, {{ icon.infowindowanchor.1 }});{% endif %}{% endfor %}
+{% endblock vars %}{% block functions %}
{% block load %}{{ js_module }}.{{ dom_id }}_load = function(){
if (GBrowserIsCompatible()) {
{{ js_module }}.{{ dom_id }} = new GMap2(document.getElementById("{{ dom_id }}"));
{{ js_module }}.{{ dom_id }}.setCenter(new GLatLng({{ center.1 }}, {{ center.0 }}), {{ zoom }});
- {% block controls %}{{ js_module }}.{{ dom_id }}.addControl(new GSmallMapControl());
- {{ js_module }}.{{ dom_id }}.addControl(new GMapTypeControl());{% endblock %}
+ {% block controls %}{{ js_module }}.{{ dom_id }}.setUIToDefault();{% endblock %}
{% if calc_zoom %}var bounds = new GLatLngBounds(); var tmp_bounds = new GLatLngBounds();{% endif %}
{% for kml_url in kml_urls %}{{ js_module }}.{{ dom_id }}_kml{{ forloop.counter }} = new GGeoXml("{{ kml_url }}");
{{ js_module }}.{{ dom_id }}.addOverlay({{ js_module }}.{{ dom_id }}_kml{{ forloop.counter }});{% endfor %}
@@ -26,4 +32,4 @@
alert("Sorry, the Google Maps API is not compatible with this browser.");
}
}
-{% endblock %}{% endautoescape %}
+{% endblock load %}{% endblock functions %}{% endautoescape %}
View
2  django/contrib/gis/templates/gis/google/google-multi.js
@@ -1,4 +1,4 @@
-{% extends "gis/google/google-base.js" %}
+{% extends "gis/google/google-map.js" %}
{% block functions %}
{{ load_map_js }}
{{ js_module }}.load = function(){
View
4 django/contrib/gis/templates/gis/google/google-single.js
@@ -1,2 +1,2 @@
-{% extends "gis/google/google-base.js" %}
-{% block functions %}{% include "gis/google/google-map.js" %}{% endblock %}
+{% extends "gis/google/google-map.js" %}
+{% block vars %}{# No vars here because used within GoogleMapSet #}{% endblock %}
Please sign in to comment.
Something went wrong with that request. Please try again.