我有以下html.erb
代码,我希望将其转移到Haml:
<span class="<%= item.dashboardstatus.cssclass %>" >
<%= item.dashboardstatus.status %>
</span>
它将当前分配状态的CSS类与跨度关联到什么?
在Haml中如何做到这一点?我肯定我错过了一些非常简单的东西。
编辑: Gah。我真不敢相信我自己都没弄明白。只是为了说明两双眼睛总比一双好。
发布于 2012-12-17 11:11:40
以下是HAML中的等效代码:
%span.{#item.dashboardstatus.cssclass}
= item.dashboardstatus.status
有两个工具可用于将HTML转换为HAML:
1)终端应用html2haml
工具
2)在线工具:http://html2haml.heroku.com/
https://stackoverflow.com/questions/13876467
复制相似问题