Defect #3935
closedstylesheet_link_tag with plugin doesn't take into account relative_url_root
0%
Description
When using the stylesheet_link_tag helper (and probably others) with :plugin to build URLs for plugin assets, this helper doesn't take into account the relative_url_root set through Redmine::Utils::relative_url_root
I think I've traced the problem to the method plugin_asset_path
in module Engines::RailsExtensions::AssetHelpers
, file vendor/plugins/engines/asset_helpers.rb
I guess that strictly speaking Engines is responsible for the bug and not Redmine. I'll leave it up to someone else to decide whether or not to resolve it in Redmine.
Related issues
Updated by Daniel S over 14 years ago
--- vendor/plugins/engines/lib/engines/rails_extensions/asset_helpers.rb~ 2010-08-02 17:40:47.000000000 +0200 +++ vendor/plugins/engines/lib/engines/rails_extensions/asset_helpers.rb 2010-08-02 17:40:47.000000000 +0200 @@ -109,7 +109,7 @@ module Engines::RailsExtensions::AssetHe # Returns the publicly-addressable relative URI for the given asset, type and plugin def self.plugin_asset_path(plugin_name, type, asset) raise "No plugin called '#{plugin_name}' - please use the full name of a loaded plugin." if Engines.plugins[plugin_name].nil? - "/#{Engines.plugins[plugin_name].public_asset_directory}/#{type}/#{asset}" + "#{ActionController::Base.relative_url_root}/#{Engines.plugins[plugin_name].public_asset_directory}/#{type}/#{asset}" end end
Updated by Nick Bolton over 14 years ago
As a workaround, I used the following (more verbose) code (for example, in a hook):
class EventNotificationOverrideViewer < Redmine::Hook::ViewListener def view_layouts_base_html_head(context = { }) javascript_include_tag "#{ActionController::Base.relative_url_root}/#{Engines.plugins['my_plugin'].public_asset_directory}/javascripts/somejs" end end
Updated by Go MAEDA about 14 years ago
Daniel S's patch works fine with Redmine 1.0.1 (deployed in a subdirectory) and Projects Tree View plugin (http://github.com/MischaTheEvil/projects_tree_view).
I wish this issue would be fixed in 1.0.2.
Updated by Jérémie Delaitre about 14 years ago
I just tried Daniel S's patch on a bitnami stack (redmine 1.0.1) and the redmine_time_tracker plugin (http://github.com/delaitre/redmine_time_tracker (master branch)) and it works fine too.
Updated by Eric Davis about 14 years ago
- Status changed from New to Resolved
- Target version set to 1.0.2
- Resolution set to Fixed
I have a fork of Engines now where I've added this fix to the plugin and also another fix that was floating around on Redmine. Fixed in r4094 for Redmine.
Updated by Eric Davis about 14 years ago
- Status changed from Resolved to Closed
Merged into 1.0-stable for release in 1.0.2