Skip to content

Instantly share code, notes, and snippets.

@matenia
Created December 10, 2012 00:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matenia/4247582 to your computer and use it in GitHub Desktop.
Save matenia/4247582 to your computer and use it in GitHub Desktop.
two forms on one page (slim, not haml)
div class="span12"
table class="table table-hover"
- @list.products.each_with_index do |product, index|
- if !product.id.nil?
tr
td class="span1"
= #TOP FORM
= form_tag(votes_vote_up_path)
= submit_tag "UP"
- if current_user
= render "products/new_product_form"
-------------------------------------------------
# "products/new_product_form"
.row
.span12
= # BOTTOM FORM IN PARTIAL
= form_for([@list, @product]) do |f|
.span2
.span8
= field_set_tag "Add product" do
- if @product.errors.any?
|product errors
= pluralize(@product.errors.count, "error")
ul
- @product.errors.full_messages.each do |msg|
li
= msg
.span4
= f.label :name
= f.text_field :name
br
= f.label :model
= f.text_field :model
br
= f.label :version
= f.text_field :version
br
= f.label :company
= f.text_field :company
br
.span3
= f.label :description
= f.text_area :description, size: "30x4"
br
= f.label :price
= f.text_field :price
br
= f.label :url
= f.text_field :url
br
= f.label :price
= f.text_field :price
br
.span2
.span8
.form-actions
= f.submit "Create", class: "btn btn-primary"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment