Reputation: 12495
I have a table defined in slim:
table
tr
td
=_("Some Content")
td
=_("Some Content")
I would like to add some classes to certain td tags. I can do so like this:
table
tr
td.extraclass
=_("Some Content")
td
=_("Some Content")
This adds "extraclass" to that td:
<td class="extraclass"> Some Content </td>
How can I add a class by embedding some rails/ruby into this? In normal rails I could do:
<td class="<%[email protected]%>">
How do I do this here? I don't think I can do:
td.=_(@article.attribute)
But I would like to add classes in some similar way here. Anybody have any advice? if I have not been clear in what I'm attempting to do, please let me know what I can add.
Upvotes: 2
Views: 4261
Reputation: 6635
According to the documentation here you can achieve this as follows:
Btw., when writing td.class1 class=some_ruby_expr
the two classes will automatically be merged into the resulting class
attribute.
Upvotes: 1
Reputation: 24617
The doc for this feature is here:
td class="#{@article.attribute}"
Upvotes: 4