aboutsummaryrefslogtreecommitdiffstats
path: root/app/maps
diff options
context:
space:
mode:
authorMarc Florisson2012-09-05 17:30:49 +0200
committerMarc Florisson2012-09-05 17:30:49 +0200
commit1a3e3ed00d4bef09a3a86e84a9f3d74e7ffb4993 (patch)
tree8e1e881c7a84db250bd3cbf33fac59cb0efb3f93 /app/maps
parentf2b7d5209ad0389bd49f20f4f5ed5a9a2c86b0ec (diff)
downloadchouette-core-1a3e3ed00d4bef09a3a86e84a9f3d74e7ffb4993.tar.bz2
fix relative_url_path
Diffstat (limited to 'app/maps')
-rw-r--r--app/maps/application_map.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/app/maps/application_map.rb b/app/maps/application_map.rb
index d87915bc5..e103a06f5 100644
--- a/app/maps/application_map.rb
+++ b/app/maps/application_map.rb
@@ -110,6 +110,14 @@ class ApplicationMap
} } )
end
+ def polymorphic_path_patch( source)
+ config = Rails.application.config
+ return source unless config.respond_to?(:relative_url_root)
+
+ relative_url_root = config.relative_url_root
+ relative_url_root && !source.starts_with?("#{relative_url_root}/") ? "#{relative_url_root}#{source}" : source
+ end
+
def kml_layer(url_or_object, options_or_url_options = {}, options = nil)
unless options
url_options = {}
@@ -125,9 +133,9 @@ class ApplicationMap
when String
url_or_object
when Array
- helpers.polymorphic_path(url_or_object, url_options)
+ polymorphic_path_patch( helpers.polymorphic_path(url_or_object, url_options))
else
- helpers.polymorphic_path([url_or_object.referential, url_or_object], url_options)
+ polymorphic_path_patch( helpers.polymorphic_path([url_or_object.referential, url_or_object], url_options))
end
protocol = OpenLayers::Protocol::HTTP.new :url => url, :format => kml