Ticket #11072: add_info_window_html.diff
File add_info_window_html.diff, 2.4 KB (added by , 15 years ago) |
---|
-
django/contrib/gis/templates/gis/google/google-map.js
19 19 {% for marker in markers %}{{ js_module }}.{{ dom_id }}_marker{{ forloop.counter }} = new {{ marker }}; 20 20 {{ js_module }}.{{ dom_id }}.addOverlay({{ js_module }}.{{ dom_id }}_marker{{ forloop.counter }}); 21 21 {% for event in marker.events %}GEvent.addListener({{ js_module }}.{{ dom_id }}_marker{{ forloop.parentloop.counter }}, {{ event }}); {% endfor %} 22 {% if marker.info_window_html %}{{ js_module }}.{{ dom_id }}_marker{{ forloop.counter }}.bindInfoWindowHtml('{{ marker.info_window_html }}');{% endif %} 22 23 {% if calc_zoom %}bounds.extend({{ js_module }}.{{ dom_id }}_marker{{ forloop.counter }}.getLatLng()); {% endif %}{% endfor %} 23 24 {% if calc_zoom %}{{ js_module }}.{{ dom_id }}.setCenter(bounds.getCenter(), {{ js_module }}.{{ dom_id }}.getBoundsZoomLevel(bounds));{% endif %} 24 25 {% block load_extra %}{% endblock %} -
django/contrib/gis/maps/google/overlays.py
250 250 return render_to_response('mytemplate.html', 251 251 {'google' : GoogleMap(markers=[marker])}) 252 252 """ 253 def __init__(self, geom, title=None, draggable=False, icon=None ):253 def __init__(self, geom, title=None, draggable=False, icon=None, info_window_html=None): 254 254 """ 255 255 The GMarker object may initialize on GEOS Points or a parameter 256 256 that may be instantiated into a GEOS point. Keyword options map to … … 262 262 263 263 draggable: 264 264 Draggable option for GMarker, disabled by default. 265 266 info_window_html: 267 An HTML fragment that will be displayed when the marker is clicked. 265 268 """ 266 269 # If a GEOS geometry isn't passed in, try to construct one. 267 270 if isinstance(geom, basestring): geom = fromstr(geom) … … 276 279 self.title = title 277 280 self.draggable = draggable 278 281 self.icon = icon 282 self.info_window_html = info_window_html 279 283 super(GMarker, self).__init__() 280 284 281 285 def latlng_from_coords(self, coords):