2
例如,我有這樣一行:用HAML嵌入視圖內的紅寶石代碼?
<tr class="<%= cycle('list_line_odd', 'list_line_even') %>">
我怎樣才能把它翻譯成HAML?
例如,我有這樣一行:用HAML嵌入視圖內的紅寶石代碼?
<tr class="<%= cycle('list_line_odd', 'list_line_even') %>">
我怎樣才能把它翻譯成HAML?
%tr{ class: cycle('list_line_odd', 'list_line_even') }
響應的評論,它是一個單獨的問題:
這是您的源,從pastie:上述
%tr{:class => cycle('list_line_odd', 'list_line_even')}
%th
- @books.each do |book|
%tr
適用cycle
到最外表格行,不是每個人的書的行:
%tr
%th
- @books.each do |book|
%tr{ class: cycle('list_line_odd', 'list_line_even') }
yeap,我試過了,但它對我來說不起作用。我做錯了什麼? http://www.pastie.org/3084886 – TiSer 2011-12-28 14:45:53
@TiSer嗯;它是如何渲染的? – 2011-12-28 14:51:30
你是什麼意思? – TiSer 2011-12-28 14:55:11