[<% @active_sale_events.each_with_index do |t,i| %> { "attr" : { "id" : "<%= t.id %>", "parent_id" : "<%= t.parent_id %>" }, "data" : "<%= raw(event_js_data(t)) %>" <% unless t.children.empty? %> ,"state" : "closed" <% end %> }<%= "," if i < (@active_sale_events.size - 1) %> <% end %>]