Skip to content

Instantly share code, notes, and snippets.

@frangucc
Created January 5, 2012 15:08
Show Gist options
  • Save frangucc/1565638 to your computer and use it in GitHub Desktop.
Save frangucc/1565638 to your computer and use it in GitHub Desktop.
form
= simple_form_for([:admin, resource],
:url => resource.new_record? ? collection_url : resource_url(resource),
:html => {:multipart => true, :method => (resource.new_record? ? "post" : "put") } ) do |f|
- if resource.errors.any?
%tr
%td{:colspan => "2"}
%h2
= pluralize(resource.errors.count, "error")
prohibited this testa from being saved:
%ul
- resource.errors.full_messages.each do |msg|
%li= msg
%div.clearfix
= f.label :is_active
%div.input= f.check_box :is_active
= f.association :merchant
= f.input :name
= f.input :order
= f.input :zipcode
= f.association :states
= f.input :description
= f.input :fine_print
= f.input :shipping_radius_in_miles
= f.input :shipping_info
= f.input :area
%div.input.clearfix
= f.label :ships_nationally
%div.input= f.check_box :ships_nationally
%div.input.clearfix
= f.label :refundable
%div.input= f.check_box :refundable
%div.input.clearfix
= f.label :featured
%div.input= f.check_box :featured
= label_tag "Categories"
%div.input
%ul.inputs-list
- @categories.each do |category|
%li
= check_box_tag "subscription[category_ids][]", category.id,
@subscription.category_ids.include?(category.id), id: dom_id(category)
= label_tag dom_id(category), category.name
= f.inputs :name, :description, :our_cost, :customer_cost, :delivery_date, :name => "Package #%i", :for => :packages
%fieldset
%legend= "Packages"
= f.simple_fields_for :packages do |fp|
%div.fields-for-package
= fp.input :delivery_date, :as => :date
= fp.input :frequency
= fp.input :name
= fp.input :our_cost
= fp.input :customer_cost
= fp.input :description
= f.input :etc
%div.input= f.button :submit, :input_html => {:class => "primary"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment