Vote #72297
未完了content_for :header_tag not working within partials
0%
説明
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).
journals
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@13366[1], I cannot reproduce the behavior described by you[2]. 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...
fn1. {{collapse(Details about my test environment...)
<pre>
Environment:
OS Ubuntu Server 12.04.5 LTS
Web server Apache 2.2.22
Application server Phusion Passenger 4.0.52, running as Apache module
Database backend MySQL 5.5.38
Redmine version 2.5.2.devel.13366
Ruby version 2.1.2-p95 (2014-05-08) [i686-linux]
Rails version 3.2.19
Environment development
Database adapter Mysql2
SCM:
Subversion 1.6.17
Git 1.7.9.5
Filesystem
Redmine plugins:
redmine_rm11527 0.0.1
</pre>
}}
fn2. 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...
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
related_issues
relates,Closed,11105,<% content_for :header_tags do %> doesn't work inside hook