Defect #10909

Different from Rails 3 stylesheet_link_tag behaviour

Added by John Yani about 1 year ago. Updated about 1 year ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-
Affected version: Resolution:Invalid

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?

History

#1 Updated by Jean-Philippe Lang about 1 year 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.

#2 Updated by John Yani about 1 year ago

If the extension is css it works. I doesn't work only if there is a dot in css name.

#3 Updated by Jean-Philippe Lang about 1 year ago

  • Status changed from New to Closed
  • Resolution set to Invalid

This is actually the Rails 3 behaviour.

#4 Updated by John Yani about 1 year 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?

#5 Updated by Jean-Philippe Lang about 1 year 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.

#6 Updated by John Yani about 1 year ago

Must be a bug in Rails then or incorrect documentation...

#7 Updated by Jean-Philippe Lang about 1 year 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.

#8 Updated by John Yani about 1 year ago

Thanks for helping figuring that out! Created a bug report in the rails tracker: https://github.com/rails/rails/issues/6310

#9 Updated by Jean-Philippe Lang about 1 year ago

You're welcome.

Also available in: Atom PDF