1. Andrew Lombardi
  2. django-easy-maps

Commits

Andrew Lombardi  committed f9f733e

update easy_maps to accept a EASY_MAPS_SECURE option to change the URL for js to https

  • Participants
  • Parent commits 7b15574
  • Branches default

Comments (0)

Files changed (2)

File easy_maps/templates/easy_maps/map.html

View file
 
 {% block api_js %}
     <!-- Google Maps API javascript -->
-    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
+    <script type="text/javascript" src="http{% if secure %}s{% endif %}://maps.google.com/maps/api/js?sensor=false"></script>
 {% endblock %}
 
 {% block html %}
          class="easy-map-googlemap">
          {% block noscript %}
          <noscript>
-            <img alt="Map of {{ map.address }}" src="http://maps.google.com/maps/api/staticmap?center={{ lat }},{{ long }}&zoom={{ zoom }}&markers={{ lat }},{{ long }}&size={{ width }}x{{ height }}&sensor=false">
+            <img alt="Map of {{ map.address }}" src="http{% if secure %}s{% endif %}://maps.google.com/maps/api/staticmap?center={{ lat }},{{ long }}&zoom={{ zoom }}&markers={{ lat }},{{ long }}&size={{ width }}x{{ height }}&sensor=false">
          </noscript>
          {% endblock noscript %}
     </div>

File easy_maps/templatetags/easy_maps_tags.py

View file
 #coding: utf-8
+from django.conf import settings
 from django import template
 from django.template.loader import render_to_string
 from easy_maps.models import Address
                 'zoom': self.zoom,
                 'template_name': template_name
             })
+            if hasattr(settings, "EASY_MAPS_SECURE") and settings.EASY_MAPS_SECURE:
+                context.update({
+                    'secure': settings.EASY_MAPS_SECURE
+                })
+
             return render_to_string(template_name, context_instance=context)
         except template.VariableDoesNotExist:
             return ''