プロジェクト

全般

プロフィール

Vote #72407

完了

Avoid the use of tag("...", "...", true) in layout

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Code cleanup/refactoring_30
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
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:
ステータス-->[Closed]

説明

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


I understand this isn't a problem for redmine core for now, but such a change would ease plugin development a lot and avoid overriding the layout/base partial.

Any thought on this is welcome.


journals

--------------------------------------------------------------------------------
Solution 1 committed in r10237.
--------------------------------------------------------------------------------
Thanks a lot :)
--------------------------------------------------------------------------------

Admin Redmine さんが3年以上前に更新

  • カテゴリCode cleanup/refactoring_30 にセット
  • 対象バージョン2.1.0_47 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0