Defect #10909
closed
Different from Rails 3 stylesheet_link_tag behaviour
Added by John Yani over 12 years ago.
Updated over 12 years ago.
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?
If the extension is css it works. I doesn't work only if there is a dot in css name.
- Status changed from New to Closed
- Resolution set to Invalid
This is actually the Rails 3 behaviour.
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?
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.
Must be a bug in Rails then or incorrect documentation...
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.
Also available in: Atom
PDF