Skip to content

Instantly share code, notes, and snippets.

@smoofles
Created January 18, 2009 17:46
Show Gist options
  • Save smoofles/48711 to your computer and use it in GitHub Desktop.
Save smoofles/48711 to your computer and use it in GitHub Desktop.
def table_form
builder.div(:class => "lpl_container_rounded") do |container|
container.form(:action => "/lepilo", :method => "post") do |form|
form.input(:name => "_method", :type => "hidden", :value => "put")
form.table(:class => "lpl_form") do |table|
table.tr do |row|
row.th do |header|
header.label("Form input")
end
row.th do |header|
header.label("Form select")
end
end
table.tr do |row|
row.td do |cell|
cell.input(:type => "text", :name => "article[name]", :id => "article[name]", :value => "article name here")
end
row.td do |cell|
cell.select(:name => "article[parent]") do |select|
select.option("name", :value => "name")
select.option("name 2", :value => "name 2")
select.option("name 3", :value => "name 3")
end
end
end
table.tr do |row|
row.th do |header|
header.label("Form input")
end
row.th do |header|
header.label("Form select")
end
end
table.tr do |row|
row.td do |cell|
cell.input(:type => "text", :name => "article[name]", :id => "article[name]", :value => "article name here")
end
row.td do |cell|
cell.textarea("blah", :name => "article[description]", :id => "article[description]", :rows => "4")
end
end
table.tr do |row|
row.th(:colspan => "2") do |header|
header.label("Colspanned Textarea")
end
end
table.tr do |row|
row.td(:colspan => 2) do |cell|
cell.textarea("blah", :name => "article[description]", :id => "article[description]", :rows => "4")
end
end
table.tr do |row|
row.td do |cell|
cell.button("Submit", :class => "button", :type => "sumbit")
end
row.td ""
end
end
end
end
builder.br
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment