Defect #10903
closed
[Rails 3] [plugins] Redmine can't find my assets. Support multiple assets paths
Added by John Yani over 12 years ago.
Updated over 12 years ago.
Resolution:
Cant reproduce
Description
Given: I put my plugins assets to root/plugins/my_plugin/app/assets folder.
Expected: I expect that Redmine will find my assets.
Actual: Instead, I see 404 error for my javacripts and css.
Given: I put my plugins assets to root/plugins/my_plugin/assets folder.
Expected: I expect that Redmine will find my assets.
Actual: Instead, I see 404 error for my javacripts and css.
Given: I put my plugins assets to root/plugins/my_plugin/public folder.
Expected: I expect that Redmine will find my assets.
Actual: Instead, I see 404 error for my javacripts and css.
I expect all these steps pass.
I use stylesheet_link_tag and javascript_include_tag
- Resolution set to Cant reproduce
Plugin assets must be placed in the redmine_root/plugins/my_plugin/assets
folder. And just like with Redmine 1.x, they are copied to redmine_root/public/plugin_assets/my_plugin
on startup. In 2.0, there's a also rake task redmine:plugins:assets to do that manually.
John Yani wrote:
I use stylesheet_link_tag and javascript_include_tag
And just like with Redmine 1.x, you have to use the :plugin
option to load a plugin stylesheet or javascript, eg.
stylesheet_link_tag 'example', :plugin => 'sample_plugin'
Please have a look at the sample plugin in extra/sample_plugin
.
But why do I need to include plugin option? There is no need to do that in Rails 3 engines. And why do I need to copy them?
Is it only technical reason or by design?
John Yani wrote:
But why do I need to include plugin option? There is no need to do that in Rails 3 engines.
This is how it worked with Redmine 1.x plugins: Plugin_Tutorial (although the tutorial may need slight updates). But feel free to experiment a Redmine plugin that would use Rails 3 engines.
And why do I need to copy them? Is it only technical reason or by design?
The asset pipeline is not enabled, so assets must be copied into the public folder. Note that you don't have to do it manually, they are copied on startup just like with Redmine 1.x.
- Status changed from New to Resolved
Oh, so the asset pipeline is not enabled.
Thanks for your answers.
- Status changed from Resolved to Closed
Also available in: Atom
PDF