..._if

An article by Gaspard Bucher

set the class of a tag to ’...’ depending on a condition

  1. action
  2. ajax
  3. API
  4. classes
  5. common attributes
    1. ..._if
    2. actions
    3. anchor
    4. attr
    5. date selection
    6. draggable
    7. eval
    8. label
    9. link params
    10. name
    11. prefix
    12. publish
    13. set_...
    14. status
    15. store
    16. text, t
    17. tlabel
    18. toggle
  6. conditions
  7. context
  8. dates
  9. display
  10. forms
  11. i18n
  12. meta
  13. SQLiss
  14. urls

You can use any kind of RubyLess code inside the condition.

Example:

<ul do='menus from root'>
  <li do='each' on_if='ancestor?(main)' do='link'/>
</ul>

Read the condition as “set class to ‘on’ if the current node is an ancestor of the main node”