Defect #10909
closedDifferent from Rails 3 stylesheet_link_tag behaviour
0%
Description
In Rails 3, stylesheet_link_tag adds ".css" extension if there is no one.
So this:
stylesheet_link_tag('jquery/jquery.qtip')
results in
/stylesheets/jquery/jquery.qtip.css
But in Redmine
stylesheet_link_tag('jquery/jquery.qtip', :plugin => 'my_plugin')
results in
/plugin_assets/my_plugin/stylesheets/jquery/jquery.qtip
So that I have to add ".css" extension.
The same applies to javascript_include_tag. Does Redmine change Rails 3 behaviour?
Updated by Jean-Philippe Lang over 12 years ago
According to the tests, it should work as expected:
source:/trunk/test/unit/helpers/application_helper_test.rb@9664#L1056
But I'll check that.
Updated by John Yani over 12 years ago
If the extension is css it works. I doesn't work only if there is a dot in css name.
Updated by Jean-Philippe Lang over 12 years ago
- Status changed from New to Closed
- Resolution set to Invalid
This is actually the Rails 3 behaviour.
Updated by John Yani over 12 years ago
Jean-Philippe Lang wrote:
This is actually the Rails 3 behaviour.
What do you mean? Don't you believe that this
stylesheet_link_tag('jquery/jquery.qtip')
correctly resolved as this in Rails 3:
/stylesheets/jquery/jquery.qtip.css
???
I've just rechecked. Did you do a test with vanilla Rails 3, i.e. without Redmine monkey patches?
Updated by Jean-Philippe Lang over 12 years ago
Please, have a look at the Rails API documentation (FYI: http://api.rubyonrails.org). This is how #stylesheet_link_tag
is documented:
If you don’t specify an extension, .css will be appended automatically
And there's an explicit example:
stylesheet_link_tag "random.styles", "/css/stylish" # => <link href="/stylesheets/random.styles" media="screen" rel="stylesheet" type="text/css" /> <link href="/css/stylish.css" media="screen" rel="stylesheet" type="text/css" />
.css is not appended to random.styles because the extension is specified.
Updated by John Yani over 12 years ago
Must be a bug in Rails then or incorrect documentation...
Updated by Jean-Philippe Lang over 12 years ago
After a few tests with a blank Rails 3.2.3 app, it turns out that this behaviour changes when turning config.assets.enabled
on/off.
- with
config.assets.enabled = true
=> .css is always appended - with
config.assets.enabled = false
=> it works as documented
Anyway, this is a Rails issue and Redmine doesn't change this behaviour.
Updated by John Yani over 12 years ago
Thanks for helping figuring that out! Created a bug report in the rails tracker: https://github.com/rails/rails/issues/6310