Skip to content

Commit

Permalink
Merge pull request #490 from flibbertigibbet/feature/ssl-admin-openla…
Browse files Browse the repository at this point in the history
…yers

Override URL for openlayers.js
  • Loading branch information
flibbertigibbet authored Aug 19, 2016
2 parents c650055 + 154e188 commit ee8671a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions python/cac_tripplanner/destinations/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,18 @@ class DestinationAdmin(admin.OSMGeoAdmin):
# Override map_template for custom address geocoding behavior
map_template = 'admin/cac-geocoding-map.html'

# Override configurable URL for openlayers.js to support SSL
# default is: 'http://openlayers.org/api/2.13.1/OpenLayers.js'
openlayers_url = 'https://cdnjs.cloudflare.com/ajax/libs/openlayers/2.13.1/OpenLayers.js'

# Include geocoder dependencies
jquery = 'https://code.jquery.com/jquery-2.1.3.min.js'
if settings.DEBUG:
extra_js = [
jquery,
'/static/scripts/vendor/lodash.js',
'/static/scripts/main/cac/cac.js',
'/static/scripts/main/cac/search/cac-search-params.js',
'/static/scripts/main/cac/search/cac-geocoder.js'
]
else:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'gis/admin/osm.html' %}
{% extends "gis/admin/openlayers.html" %}

{% block openlayers %}
{% include 'admin/cac-geocoding-map.js' %}
Expand Down
10 changes: 9 additions & 1 deletion python/cac_tripplanner/templates/admin/cac-geocoding-map.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
{% extends 'gis/admin/osm.js' %}
{% extends "gis/admin/openlayers.js" %}
{% block base_layer %}
// explicitly load via SSL to deal with redirect to HTTPS
new OpenLayers.Layer.OSM("OpenStreetMap", [
'https://a.tile.openstreetmap.org/${z}/${x}/${y}.png',
'https://b.tile.openstreetmap.org/${z}/${x}/${y}.png',
'https://c.tile.openstreetmap.org/${z}/${x}/${y}.png'
]);
{% endblock %}

{% block extra_layers %}

Expand Down

0 comments on commit ee8671a

Please sign in to comment.