Defect #11527

content_for :header_tag not working within partials

Added by Déja Augustine over 5 years ago. Updated about 3 years ago.

Status:Needs feedbackStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Plugin API
Target version:-
Resolution: Affected version:2.0.3

Description

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:

plugins/redmine_partial_test/app/views/partial_test/_test.html.erb
@
<% 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 hook Closed

History

#1 Updated by Mischa The Evil about 3 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 (https://github.com/MischaTheEvil/redmine_rm11527). 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

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...

#2 Updated by Go MAEDA about 3 years ago

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

Also available in: Atom PDF