プロジェクト

全般

プロフィール

Vote #65773

完了

stylesheet_link_tag with plugin doesn't take into account relative_url_root

Admin Redmine さんがほぼ2年前に追加. ほぼ2年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Plugin API_20
対象バージョン:
開始日:
2009/09/28
期日:
進捗率:

0%

予定工数:
category_id:
20
version_id:
24
issue_org_id:
3935
author_id:
517
assigned_to_id:
5
comments:
7
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

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.


journals

This duplicates #5021
--------------------------------------------------------------------------------
<pre>
--- 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
</pre>
--------------------------------------------------------------------------------
As a workaround, I used the following (more verbose) code (for example, in a hook):

<pre>
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
</pre>

--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
I have a "fork of Engines":http://github.com/edavis10/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.
--------------------------------------------------------------------------------
Merged into 1.0-stable for release in 1.0.2
--------------------------------------------------------------------------------


related_issues

duplicates,Closed,5021,stylesheet_link_tag does not honor Redmine running out of a sub-uri if it is called from a plugin
duplicates,Closed,3753,Plugin asset URLs not correctly generated for sub-URI deployments

Admin Redmine さんがほぼ2年前に更新

  • カテゴリPlugin API_20 にセット
  • 対象バージョン1.0.2_24 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0