dnagir / ruby-haml-js

HAML-JS Tile and Rails 3.1 Template
MIT License
86 stars 13 forks source link

How to use Javascript loops in the template? #9

Closed volkanunsal closed 11 years ago

volkanunsal commented 11 years ago

Does this support random Javascript injection?

dnagir commented 11 years ago

You can do loops using:

%ul.todolist
  :each item in todolist
    %li= item.description

if-s:

:if todolist.length > 20
  %p Oh my, you are a busy fellow!

See comprehensive examples at https://github.com/creationix/haml-js