diff options
| -rw-r--r-- | app/helpers/users_helper.rb | 2 | ||||
| -rw-r--r-- | app/maps/application_map.rb | 12 | ||||
| -rw-r--r-- | app/views/layouts/application.html.erb | 2 | 
3 files changed, 12 insertions, 4 deletions
| diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index ad45433c1..acf511ac6 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -5,7 +5,7 @@ module UsersHelper    end    def user_default_avatar -    "#{root_url}#{image_path('icons/user.png')}" +    image_path('icons/user.png')    end  end 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 diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index c15bcf13f..358057b13 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -11,7 +11,7 @@    </head>    <body>      <script type="text/JavaScript"> -      OpenLayers.ImgPath = "/assets/openlayers/" +      OpenLayers.ImgPath = <%= asset_path("openlayers") %>      </script>      <div id="header">        <div class="infos">                | 
