Project

General

Profile

Actions

Defect #10909

closed

Different from Rails 3 stylesheet_link_tag behaviour

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

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

0%

Estimated time:
Resolution:
Invalid
Affected version:

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?

Actions #1

Updated by Jean-Philippe Lang almost 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.

Actions #2

Updated by John Yani almost 12 years ago

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

Actions #3

Updated by Jean-Philippe Lang almost 12 years ago

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

This is actually the Rails 3 behaviour.

Actions #4

Updated by John Yani almost 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?

Actions #5

Updated by Jean-Philippe Lang almost 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.

Actions #6

Updated by John Yani almost 12 years ago

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

Actions #7

Updated by Jean-Philippe Lang almost 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.

Actions #8

Updated by John Yani almost 12 years ago

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

Actions #9

Updated by Jean-Philippe Lang almost 12 years ago

You're welcome.

Actions

Also available in: Atom PDF