Defect #11527


content_for :header_tag not working within partials

Added by Déja Augustine almost 12 years ago. Updated over 9 years ago.

Needs feedback
Plugin API
Target version:
Start date:
Due date:
% Done:


Estimated time:
Affected version:


After upgrading from 1.4 to 2.0.3 this morning, I've noticed a change in a custom plugin I had written. The content_for :header_tag block does not seem to be being functioning within partials, as in the following example:

<% content_for :header_tag do >
= stylesheet_link_tag 'test.css', :plugin => 'redmine_partial_test' >
= javascript_include_tag 'test.js', :plugin => 'redmine_partial_test' >
end %>

[...] markup that makes use of the styles and scripts included above [...]

This worked just fine in 1.4.x (with the styles/scripts being included on pages that rendered the partial in question), but the stylesheet and javascript tags are completely absent in 2.x (leaving script/style errors in their wake).

Related issues

Related to Redmine - Defect #11105: <% content_for :header_tags do %> doesn't work inside hookClosedJean-Philippe Lang

Actions #1

Updated by Mischa The Evil over 9 years ago

  • Category set to Plugin API
  • Status changed from New to Needs feedback

Hi Déja, I just came around this issue and decided to test the given behavior by generating a simple sample plugin ( Testing this plugin on a test deployment of Redmine source:/trunk@133661, I cannot reproduce the behavior described by you2. In my case the plugin's assets are included in page headers also when the content_for :header_tags do blocks are used in view partials.
Can you please confirm that the defect you reported is still being experienced and, if yes, test the plugin and provide the results and some more debug info (see submissions wiki page)?

Looking closely at your example it may even be a simple typo [content_for :header_tag do vs content_for :header_tags do] too...

1 Details about my test environment...

2 I only tested this on the given trunk version. I haven't tested this with 1.x.x at all. More general: I cannot think that the API has changed that much between 1.x.x and 2.x.x...

Actions #2

Updated by Go MAEDA over 9 years ago

  • Related to Defect #11105: <% content_for :header_tags do %> doesn't work inside hook added

Also available in: Atom PDF