Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
# sniplets of the code "_item_list.html.erb" <tr class="item"> <td><%= form.text_field :name%></td> <td>$<%= form.text_field :amount, :size => "5" %> </td> <td><%= form.select :item_category_id, ItemCategory.all.map{|t| [t.name, t.id]} %></td> <td><%= form.select :item_expense_id, ItemExpense.all.map{|p| [p.name, p.id]} %></td> <td><%= form.check_box :override, :onchange => "alert('GST overwritten');"%></td> <td> </td> <td><%= link_to_function image_tag("cross.png"), "$(this).up('.item').fade()"%></td> </tr> <%= form.hidden_field :club_id, :value => current_user.club.id %> # 2nd sniplet <img src="/images/add.png"><%= link_to_function "Add new Item" do |page| claim_form.fields_for :items, Item.new, :child_index => 'NEW_RECORD' do |f| html = render(:partial => "claims/item_list", :locals => { :form => f }) page << "$$('tr.item').last().insert({ bottom: '#{escape_javascript(html)}'.replace(/NEW_RECORD/g, new Date().getTime()) });" end end%> # when I click on the Add new Item button, I want it to create another <tr> below itself
This paste will be private.
From the Design Piracy series on my blog: