Ticket #11072: add_info_window_html.diff

File add_info_window_html.diff, 2.4 KB (added by Ubercore, 16 years ago)
  • django/contrib/gis/templates/gis/google/google-map.js

     
    1919    {% for marker in markers %}{{ js_module }}.{{ dom_id }}_marker{{ forloop.counter }} = new {{ marker }};
    2020    {{ js_module }}.{{ dom_id }}.addOverlay({{ js_module }}.{{ dom_id }}_marker{{ forloop.counter }});
    2121    {% 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 %}
    2223    {% if calc_zoom %}bounds.extend({{ js_module }}.{{ dom_id }}_marker{{ forloop.counter }}.getLatLng()); {% endif %}{% endfor %}
    2324    {% if calc_zoom %}{{ js_module }}.{{ dom_id }}.setCenter(bounds.getCenter(), {{ js_module }}.{{ dom_id }}.getBoundsZoomLevel(bounds));{% endif %}
    2425    {% block load_extra %}{% endblock %}
  • django/contrib/gis/maps/google/overlays.py

     
    250250          return render_to_response('mytemplate.html',
    251251                 {'google' : GoogleMap(markers=[marker])})
    252252    """
    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):
    254254        """
    255255        The GMarker object may initialize on GEOS Points or a parameter
    256256        that may be instantiated into a GEOS point.  Keyword options map to
     
    262262
    263263         draggable:
    264264           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.
    265268        """
    266269        # If a GEOS geometry isn't passed in, try to construct one.
    267270        if isinstance(geom, basestring): geom = fromstr(geom)
     
    276279        self.title = title
    277280        self.draggable = draggable
    278281        self.icon = icon
     282        self.info_window_html = info_window_html
    279283        super(GMarker, self).__init__()
    280284
    281285    def latlng_from_coords(self, coords):
Back to Top