]> git.openstreetmap.org Git - rails.git/commitdiff
Avoid mixed content warnings when routing queries Nominatim
authorTom Hughes <tom@compton.nu>
Mon, 16 Feb 2015 21:46:54 +0000 (21:46 +0000)
committerTom Hughes <tom@compton.nu>
Mon, 16 Feb 2015 21:46:54 +0000 (21:46 +0000)
app/assets/javascripts/index/directions.js.erb
app/controllers/geocoder_controller.rb

index 7b1ef3c5b8af4f4e3630bd4f2fed715b73091555..faa9226358f6ca1471f98a7b8788dc386359defe 100644 (file)
@@ -73,7 +73,7 @@ OSM.Directions = function (map) {
 
       endpoint.awaitingGeocode = true;
 
-      $.getJSON('<%= NOMINATIM_URL %>search?q=' + encodeURIComponent(endpoint.value) + '&format=json', function (json) {
+      $.getJSON(document.location.protocol + '<%= NOMINATIM_URL %>search?q=' + encodeURIComponent(endpoint.value) + '&format=json', function (json) {
         endpoint.awaitingGeocode = false;
         endpoint.hasGeocode = true;
         if (json.length == 0) {
index 6053cbb4b5588dcb7fbd6863c7cdc6942e7d5b74..5a3cbebdf97a08fe95dd4b03458d02334333e63d 100644 (file)
@@ -145,7 +145,7 @@ class GeocoderController < ApplicationController
     end
 
     # ask nominatim
-    response = fetch_xml("#{NOMINATIM_URL}search?format=xml&q=#{escape_query(query)}#{viewbox}#{exclude}&accept-language=#{http_accept_language.user_preferred_languages.join(',')}")
+    response = fetch_xml("http:#{NOMINATIM_URL}search?format=xml&q=#{escape_query(query)}#{viewbox}#{exclude}&accept-language=#{http_accept_language.user_preferred_languages.join(',')}")
 
     # extract the results from the response
     results =  response.elements["searchresults"]
@@ -236,7 +236,7 @@ class GeocoderController < ApplicationController
     @results = Array.new
 
     # ask nominatim
-    response = fetch_xml("#{NOMINATIM_URL}reverse?lat=#{lat}&lon=#{lon}&zoom=#{zoom}&accept-language=#{http_accept_language.user_preferred_languages.join(',')}")
+    response = fetch_xml("http:#{NOMINATIM_URL}reverse?lat=#{lat}&lon=#{lon}&zoom=#{zoom}&accept-language=#{http_accept_language.user_preferred_languages.join(',')}")
 
     # parse the response
     response.elements.each("reversegeocode/result") do |result|