Vote #72407
完了Avoid the use of tag("...", "...", true) in layout
開始日:
2022/05/09
期日:
進捗率:
0%
予定工数:
Redmineorg_URL:
category_id:
30
version_id:
47
issue_org_id:
11704
author_id:
1188
assigned_to_id:
0
comments:
3
status_id:
5
tracker_id:
3
plus1:
0
affected_version:
closed_on:
affected_version_id:
説明
Here's a very simplified version of Redmine base layout :
<%= tag('div', {:id => 'main', :class => (sidebar_content? ? '' : 'nosidebar')}, true) %>
<%= yield %>
There's a "tag" helper, processed with ERB, to display "div#main", and it's closed with standard html in the end.
It could be considered as bad practice, but the main problem is that you cannot parse the layout correctly before it's fully processed by ERB. Hence gems that hook in the rendering process don't work correctly for the layout partial. It's the case of @deface@ (https://github.com/railsdog/deface) for instance, a gem I use these days so that I don't need 50 more view hooks in core.
1st solution : use inline erb just for the class
i.e. replace the tag line with :
<%= yield %>
<% end %>