= form_for @product, :html => {:multipart => true} do |f|
  = f.error_messages
  = field_set_tag "Category" do
    %dl
      %dt= f.label :product_category_id
      %dd= f.collection_select :product_category_id, Shoppe::ProductCategory.ordered, :id, :name, :include_blank => true
  = field_set_tag "Product Information" do
    %dl
      %dt= f.label :title
      %dd= f.text_field :title
    %dl
      %dt= f.label :permalink
      %dd= f.text_field :permalink
    %dl
      %dt= f.label :sku, 'SKU'
      %dd= f.text_field :sku
    %dl
      %dt= f.label :description
      %dd= f.text_area :description
    %dl
      %dt= f.label :short_description
      %dd= f.text_area :short_description
    %dl
      %dt= f.label :in_the_box, "What's in the box?"
      %dd= f.text_area :in_the_box
  = field_set_tag "Attachments" do
      
    %dl
      %dt= f.label :default_image_file, "Default Image"
      %dd
        = attachment_preview @product.default_image
        %p= f.file_field :default_image_file
    %dl
      %dt= f.label :data_sheet_file, "Datasheet"
      %dd
        = attachment_preview @product.data_sheet
        %p= f.file_field :data_sheet_file
        
  = field_set_tag "Pricing" do
    %dl
      %dt= f.label :price
      %dd= f.text_field :price
    %dl
      %dt= f.label :tax_rate
      %dd= f.text_field :tax_rate
      
  = field_set_tag "Website Properties" do
    %dl
      %dt= f.label :active, "On sale?"
      %dd
        = f.check_box :active
        = f.label :active, "If checked, this product will be displayed within the public store"
    %dl
      %dt= f.label :featured, "Featured?"
      %dd
        = f.check_box :featured
        = f.label :featured, "If checked, this product will appear on your homepage"

  = field_set_tag "Stock Control" do
    %dl
      %dt= f.label :weight
      %dd= f.text_field :weight
    %dl
      %dt= f.label :stock
      %dd= f.text_field :stock
  
  %p.submit
    - unless @product.new_record?
      %span.right= link_to "Delete", @product, :class => 'button purple', :method => :delete, :data => {:confirm => "Are you sure you wish to remove this product?"}
    = f.submit :class => 'button green'
    = link_to "Cancel", :products, :class => 'button'