Project

General

Profile

Actions

Defect #10903

closed

[Rails 3] [plugins] Redmine can't find my assets. Support multiple assets paths

Added by John Yani about 12 years ago. Updated about 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Cant reproduce
Affected version:

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.

Actions #1

Updated by John Yani about 12 years ago

I use stylesheet_link_tag and javascript_include_tag

Actions #2

Updated by Jean-Philippe Lang about 12 years ago

  • 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.

Actions #3

Updated by John Yani about 12 years ago

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?

Actions #4

Updated by Jean-Philippe Lang about 12 years ago

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.

Actions #5

Updated by John Yani about 12 years ago

  • Status changed from New to Resolved

Oh, so the asset pipeline is not enabled.
Thanks for your answers.

Actions #6

Updated by Jean-Philippe Lang about 12 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF