dynamic class/id

79 views
Skip to first unread message

Brewster

unread,
Apr 4, 2010, 12:56:11 AM4/4/10
to Haml
is it possible to insert ruby code as the class or id of an element?

for example, something like...

%div#main.#{controller_name}

that would render

<div class="controllerName" id="main"></div>

Nathan Weizenbaum

unread,
Apr 4, 2010, 6:16:54 AM4/4/10
to ha...@googlegroups.com
Classes and ids can be made dynamic in the attributes hash like any other attribute. For example: %div#main{:class => controller_name}


--
You received this message because you are subscribed to the Google Groups "Haml" group.
To post to this group, send email to ha...@googlegroups.com.
To unsubscribe from this group, send email to haml+uns...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/haml?hl=en.


Reply all
Reply to author
Forward
0 new messages