diff options
| author | Marc Florisson | 2012-09-06 10:31:07 +0200 |
|---|---|---|
| committer | Marc Florisson | 2012-09-06 10:31:07 +0200 |
| commit | 09500773ee2bdb67719ffa0a6e529107a7cfc663 (patch) | |
| tree | 73e0faa412f97f47ff8ee27486ba0e161d346735 | |
| parent | 3e36a149597bc152ca2387945d4db7c74c3395f7 (diff) | |
| download | chouette-core-09500773ee2bdb67719ffa0a6e529107a7cfc663.tar.bz2 | |
fix relative_url_path
| -rw-r--r-- | app/maps/application_map.rb | 11 | ||||
| -rw-r--r-- | app/views/layouts/application.html.erb | 10 |
2 files changed, 13 insertions, 8 deletions
diff --git a/app/maps/application_map.rb b/app/maps/application_map.rb index e103a06f5..fd7862186 100644 --- a/app/maps/application_map.rb +++ b/app/maps/application_map.rb @@ -110,11 +110,14 @@ class ApplicationMap } } ) end - def polymorphic_path_patch( source) - config = Rails.application.config - return source unless config.respond_to?(:relative_url_root) + def open_layer_path + relative_url_root = Rails.application.config.relative_url_root + return "openlayers/" unless relative_url_root + "#{relative_url_root}/openlayers/" + end - relative_url_root = config.relative_url_root + def polymorphic_path_patch( source) + relative_url_root = Rails.application.config.relative_url_root relative_url_root && !source.starts_with?("#{relative_url_root}/") ? "#{relative_url_root}#{source}" : source end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 358057b13..604e34e23 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -4,15 +4,17 @@ <title>Chouette V2 - <%= title %></title> <%= stylesheet_link_tag :application %> <%= javascript_include_tag :application %> - <script src="http://maps.google.com/maps/api/js?v=3.2&sensor=false"></script> + <% if defined?( @map) %> + <script src="http://maps.google.com/maps/api/js?v=3.2&sensor=false"></script> + <script type="text/JavaScript"> + OpenLayers.ImgPath = "<%= @map.open_layer_path %>"; + </script> + <% end %> <%= csrf_meta_tag %> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> </head> <body> - <script type="text/JavaScript"> - OpenLayers.ImgPath = <%= asset_path("openlayers") %> - </script> <div id="header"> <div class="infos"> <div class="logo"> |
