piggybak 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/Gemfile +2 -0
  2. data/Gemfile.lock +5 -0
  3. data/README.md +117 -0
  4. data/Rakefile +2 -1
  5. data/VERSION +1 -1
  6. data/app/assets/javascripts/piggybak.js +62 -2
  7. data/app/controllers/piggybak/orders_controller.rb +26 -5
  8. data/{lib/application_helper.rb → app/helpers/piggybak_helper.rb} +6 -1
  9. data/app/models/piggybak/address.rb +14 -1
  10. data/app/models/piggybak/cart.rb +19 -12
  11. data/app/models/piggybak/country.rb +5 -0
  12. data/app/models/piggybak/credit.rb +8 -0
  13. data/app/models/piggybak/line_item.rb +13 -6
  14. data/app/models/piggybak/order.rb +12 -6
  15. data/app/models/piggybak/payment.rb +5 -3
  16. data/app/models/piggybak/payment_calculator/authorize_net.rb +4 -0
  17. data/app/models/piggybak/payment_calculator/fake.rb +4 -0
  18. data/app/models/piggybak/payment_method.rb +8 -3
  19. data/app/models/piggybak/shipping_calculator/free.rb +13 -0
  20. data/app/models/piggybak/shipping_calculator/pickup.rb +1 -1
  21. data/app/models/piggybak/shipping_method.rb +9 -7
  22. data/app/models/piggybak/state.rb +1 -0
  23. data/app/models/piggybak/tax_calculator/{flat_rate.rb → percent.rb} +1 -1
  24. data/app/models/piggybak/tax_method.rb +8 -2
  25. data/app/models/piggybak/{product.rb → variant.rb} +5 -4
  26. data/app/views/piggybak/cart/_form.html.erb +7 -7
  27. data/app/views/piggybak/cart/_items.html.erb +9 -9
  28. data/app/views/piggybak/cart/show.html.erb +2 -0
  29. data/app/views/piggybak/notifier/order_notification.text.erb +1 -1
  30. data/app/views/piggybak/orders/_address_form.html.erb +18 -14
  31. data/app/views/piggybak/orders/_details.html.erb +48 -0
  32. data/app/views/piggybak/orders/download.text.erb +19 -0
  33. data/app/views/piggybak/orders/list.html.erb +12 -12
  34. data/app/views/piggybak/orders/no_access.text.erb +1 -0
  35. data/app/views/piggybak/orders/receipt.html.erb +1 -49
  36. data/app/views/piggybak/orders/show.html.erb +36 -31
  37. data/app/views/rails_admin/main/_actions.html.erb +9 -2
  38. data/config/routes.rb +12 -3
  39. data/db/migrate/20111227150106_create_orders.rb +4 -3
  40. data/db/migrate/20111227150322_create_addresses.rb +2 -1
  41. data/db/migrate/20111227150432_create_line_items.rb +2 -2
  42. data/db/migrate/{20111227213558_create_products.rb → 20111227213558_create_variants.rb} +3 -3
  43. data/db/migrate/20111228231829_create_payments.rb +3 -1
  44. data/db/migrate/20111228231838_create_shipments.rb +1 -1
  45. data/db/migrate/20120102162414_create_countries.rb +10 -0
  46. data/db/migrate/20120102162415_create_states.rb +1 -0
  47. data/db/migrate/20120104020930_populate_countries_and_states.rb +18 -0
  48. data/db/migrate/20120106010412_create_credits.rb +14 -0
  49. data/lib/{acts_as_product → acts_as_variant}/base.rb +6 -6
  50. data/lib/piggybak.rb +59 -23
  51. data/piggybak.gemspec +26 -11
  52. metadata +64 -62
  53. data/README.rdoc +0 -19
@@ -0,0 +1,19 @@
1
+ Order: #<%= @order.id %>
2
+
3
+ Email: <%= @order.email %>
4
+ Phone: <%= @order.phone %>
5
+
6
+ <% @order.line_items.each do |line_item| %>
7
+ <%= line_item.quantity %> x <%= raw line_item.variant.description %> (<%= number_to_currency line_item.total %>)
8
+ <% end -%>
9
+
10
+ Subtotal: <%= number_to_currency @order.line_items.inject(0) { |subtotal, li| subtotal + li.total } %>
11
+ Tax: <%= number_to_currency @order.tax_charge %>
12
+ Shipping: <%= number_to_currency @order.shipments.inject(0) { |shipping, shipment| shipping + shipment.total } %>
13
+ Total: <%= number_to_currency @order.total %>
14
+
15
+ Billing Information
16
+ <%= raw @order.billing_address.display.gsub("<br />", "\n") %>
17
+
18
+ Shipping Information
19
+ <%= raw @order.shipping_address.display.gsub("<br />", "\n") %>
@@ -1,12 +1,12 @@
1
- <h1>Your Orders</h1>
2
-
3
- <% @user.piggybak_orders.each do |order| -%>
4
- <h2>Order #<%= order.id %></h2>
5
-
6
- <p><%= number_to_currency order.total %></p>
7
-
8
- <% order.line_items.each do |line_item| -%>
9
- <%= debug(line_item) %>
10
- <% end -%>
11
-
12
- <% end -%>
1
+ <div id="list_orders">
2
+ <h1>Your Orders</h1>
3
+
4
+ <% current_user.piggybak_orders.each do |order| -%>
5
+
6
+ <h2>Order #<%= order.id %></h2>
7
+ Status: <%= order.status %><br />
8
+ Created at: <%= order.created_at.strftime("%m-%d-%Y") %><br />
9
+ <%= render "details", :order => order %>
10
+
11
+ <% end -%>
12
+ </div>
@@ -0,0 +1 @@
1
+ You do not have access to view this information.
@@ -1,53 +1,5 @@
1
1
  <div id="receipt">
2
2
  <h1>Thanks for your Order</h1>
3
-
4
- <table id="items" cellpadding="5" cellspacing="0">
5
- <tr>
6
- <th>Item</th>
7
- <th>Price</th>
8
- <th>Quantity</th>
9
- <th>Subtotal</th>
10
- </tr>
11
- <% @order.line_items.each do |line_item| %>
12
- <tr>
13
- <td><%= line_item.product.description %></td>
14
- <td><%= line_item.product.price %></td>
15
- <td><%= line_item.quantity %></td>
16
- <td><%= number_to_currency line_item.total %></td>
17
- </tr>
18
- <% end -%>
19
- <tr>
20
- <td colspan="4"></td>
21
- </tr>
22
- <tr>
23
- <td colspan="2"></td>
24
- <td>Subtotal</td>
25
- <td><%= number_to_currency @order.line_items.inject(0) { |subtotal, li| subtotal + li.total } %></td>
26
- </tr>
27
- <tr>
28
- <td colspan="2"></td>
29
- <td>Tax</td>
30
- <td><%= number_to_currency @order.tax_charge %></td>
31
- </tr>
32
- <tr>
33
- <td colspan="2"></td>
34
- <td>Shipping</td>
35
- <td><%= number_to_currency @order.shipments.inject(0) { |shipping, shipment| shipping + shipment.total } %></td>
36
- </tr>
37
- <tr>
38
- <td colspan="2"></td>
39
- <td>Total</td>
40
- <td><%= number_to_currency @order.total %></td>
41
- </tr>
42
- </table>
43
3
 
44
- Email: <%= @order.email %><br />
45
- Phone: <%= @order.phone %>
46
-
47
- <h3>Billing Information</h3>
48
- <%= raw @order.billing_address.display %>
49
-
50
- <h3>Shipping Information</h3>
51
- <%= raw @order.shipping_address.display %>
52
-
4
+ <%= render "details", :order => @order %>
53
5
  </div>
@@ -4,10 +4,31 @@
4
4
  <%= form_for @order, :url => piggybak.order_submit_url, :method => "POST" do |f| %>
5
5
 
6
6
  <% if @order.errors.any? -%>
7
+ <div id="checkout_error">
7
8
  <b>You have errors with your submission:</b><br />
8
9
  <%= raw @order.errors.full_messages.join("<br />") %>
10
+ </div>
9
11
  <% end -%>
10
12
  <div class="clear"></div>
13
+
14
+ <div id="user_details">
15
+ <h3>User Details</h3>
16
+ <div class="item">
17
+ <% if current_user -%>
18
+ <%= f.label :email %>
19
+ <%= f.text_field :email, { :readonly => true, :class => "readonly" } %><br />
20
+ <span>or <%= link_to 'LOGOUT', destroy_user_session_path, :method => :delete, :class => "last" %></span>
21
+ <% else -%>
22
+ <%= f.label :email %>
23
+ <%= f.text_field :email %><br />
24
+ <span>or <%= link_to 'LOG IN', new_user_session_path %></span>
25
+ <% end -%>
26
+ </div>
27
+ <div class="item">
28
+ <%= f.label :phone %>
29
+ <%= f.text_field :phone %>
30
+ </div>
31
+ </div>
11
32
 
12
33
  <div id="billing_address">
13
34
  <h3>Billing Address</h3>
@@ -16,48 +37,30 @@
16
37
  <% end -%>
17
38
  </div>
18
39
  <div id="shipping_address">
19
- <h3>Shipping Address</h3>
40
+ <h3>
41
+ Shipping Address
42
+ <a href="#" id="copy">copy from billing</a>
43
+ </h3>
44
+
20
45
  <%= f.fields_for :shipping_address do |shipping_address| %>
21
46
  <%= render "address_form", :address => shipping_address %>
22
47
  <% end -%>
23
48
  </div>
24
49
 
25
50
  <div id="add_details">
26
- <div id="user_details">
27
- <h3>User Details</h3>
28
- <p>
29
- <% if current_user -%>
30
- <%= f.label :email %>
31
- <%= f.text_field :email, { :readonly => true, :class => "readonly" } %>
32
- <% if false -%>
33
- <span>or <%= link_to 'LOGOUT', destroy_user_session_path, :method => :delete, :class => "last" %></span>
34
- <% end -%>
35
- <% else -%>
36
- <%= f.label :email %>
37
- <%= f.text_field :email %>
38
- <% if false -%>
39
- <span>or <%= link_to 'LOG IN', new_user_session_path %></span>
40
- <% end -%>
41
- <% end -%>
42
- </p>
43
- <p>
44
- <%= f.label :phone %>
45
- <%= f.text_field :phone %>
46
- </p>
47
- </div>
48
51
  <div id="shipping">
49
52
  <h3>Shipping Option</h3>
50
53
  <%= f.fields_for :shipments, f.object.shipments.build do |shipment| %>
51
- <p>
54
+ <div class="item">
52
55
  <%= shipment.label :shipping_method_id %>
53
56
  <%= shipment.select :shipping_method_id, [] %>
54
- </p>
57
+ </div>
55
58
  <% end -%>
56
59
  </div>
57
60
  <div id="payment">
58
61
  <h3>Payment</h3>
59
62
  <%= f.fields_for :payments, f.object.payments.build do |payment| %>
60
- <p>
63
+ <div class="item">
61
64
  <%= payment.label :number %>
62
65
  <% if @order.errors.keys.include?("payments.number".to_sym) %>
63
66
  <span class="field_with_errors">
@@ -66,9 +69,9 @@
66
69
  <% else -%>
67
70
  <%= payment.text_field :number %>
68
71
  <% end -%>
69
- </p>
72
+ </div>
70
73
 
71
- <p>
74
+ <div class="item">
72
75
  <%= payment.label :verification_value %>
73
76
  <% if @order.errors.keys.include?("payments.verification_value".to_sym) %>
74
77
  <span class="field_with_errors">
@@ -77,9 +80,9 @@
77
80
  <% else -%>
78
81
  <%= payment.text_field :verification_value %>
79
82
  <% end -%>
80
- </p>
83
+ </div>
81
84
 
82
- <p>
85
+ <div class="item">
83
86
  <%= payment.label :month %>
84
87
  <% if @order.errors.keys.include?("payments.verification_value".to_sym) %>
85
88
  <span class="field_with_errors">
@@ -90,7 +93,7 @@
90
93
  <%= payment.select :month, 1.upto(12) %> /
91
94
  <%= payment.select :year, Time.now.year.upto(Time.now.year + 10) %>
92
95
  <% end -%>
93
- </p>
96
+ </div>
94
97
  <% end -%>
95
98
  </div>
96
99
  <div id="submit">
@@ -106,7 +109,9 @@
106
109
 
107
110
  </div>
108
111
 
112
+ <%= javascript_include_tag "piggybak" %>
109
113
  <script type="text/javascript">
110
114
  var shipping_lookup = "<%= piggybak.orders_shipping_url %>";
111
115
  var tax_lookup = "<%= piggybak.orders_tax_url %>";
116
+ var geodata_lookup = "<%= piggybak.orders_geodata_url %>";
112
117
  </script>
@@ -1,5 +1,12 @@
1
+ <ul>
1
2
  <% if params[:action] == 'edit' -%>
2
- <%= link_to "Send Email Confirmation", piggybak.orders_email_url(params[:id]) %>
3
+ <li><%= link_to "Send Email Confirmation", piggybak.orders_email_url(params[:id]) %></li>
3
4
  <% else -%>
4
- <b>You may not send a confirmation email until you have a saved order.</b>
5
+ <li><b>You may not send a confirmation email until you have a saved order.</b></li>
5
6
  <% end -%>
7
+ <% if params[:action] == 'edit' -%>
8
+ <li><%= link_to "View as Text", piggybak.orders_download_url(params[:id]) %></li>
9
+ <% else -%>
10
+ <li><b>You may not download until you have a saved order.</b></li>
11
+ <% end -%>
12
+ </ul>
@@ -1,15 +1,24 @@
1
1
  Piggybak::Engine.routes.draw do
2
2
  scope :module => "piggybak" do
3
- match "/show" => "orders#show", :as => :orders
3
+ # cart actions
4
4
  match "/cart" => "cart#show", :as => :cart
5
5
  match "/cart/add" => "cart#add", :via => :post, :as => :cart_add
6
6
  match "/cart/update" => "cart#update", :via => :post, :as => :cart_update
7
7
  match "/cart/remove/:item" => "cart#remove", :via => :delete, :as => :remove_item
8
+
9
+ # order actions
10
+ match "/show" => "orders#show", :as => :orders
8
11
  match "/submit" => "orders#submit", :via => :post, :as => :order_submit
9
12
  match "/receipt" => "orders#receipt", :as => :receipt
10
- match "/orders" => "orders#list", :as => :orders_list
11
- match "/admin/orders/:id/email" => "orders#email", :as => :orders_email
12
13
  match "/orders/shipping" => "orders#shipping", :as => :orders_shipping
13
14
  match "/orders/tax" => "orders#tax", :as => :orders_tax
15
+ match "/orders/geodata" => "orders#geodata", :as => :orders_geodata
16
+
17
+ # list orders
18
+ match "/orders" => "orders#list", :as => :orders_list
19
+
20
+ # admin actions
21
+ match "/admin/orders/:id/email" => "orders#email", :as => :orders_email
22
+ match "/admin/orders/:id/download" => "orders#download", :as => :orders_download, :format => "txt"
14
23
  end
15
24
  end
@@ -8,9 +8,9 @@ class CreateOrders < ActiveRecord::Migration
8
8
  t.string :email, :null => false
9
9
  t.string :phone, :null => false
10
10
 
11
- t.float :total, :null => false
12
- t.float :total_due, :null => false
13
- t.float :tax_charge, :null => false
11
+ t.decimal :total, :null => false
12
+ t.decimal :total_due, :null => false
13
+ t.decimal :tax_charge, :null => false
14
14
  t.string :status, :null => false
15
15
 
16
16
  t.timestamps
@@ -19,3 +19,4 @@ class CreateOrders < ActiveRecord::Migration
19
19
  end
20
20
 
21
21
  # Note: To force precision, alter column type in database console
22
+ # Always use decimal when dealing with currency
@@ -6,7 +6,8 @@ class CreateAddresses < ActiveRecord::Migration
6
6
  t.string :address1, :null => false
7
7
  t.string :address2
8
8
  t.string :city, :null => false
9
- t.references :state, :null => false
9
+ t.string :state_id, :null => false # because both text states and ids are allowed
10
+ t.references :country, :null => false
10
11
  t.string :zip, :null => false
11
12
 
12
13
  t.timestamps
@@ -3,8 +3,8 @@ class CreateLineItems < ActiveRecord::Migration
3
3
  create_table :line_items do |t|
4
4
  t.references :order, :null => false
5
5
  t.integer :quantity, :null => false
6
- t.references :product, :null => false
7
- t.float :total
6
+ t.references :variant, :null => false
7
+ t.decimal :total
8
8
  end
9
9
  end
10
10
  end
@@ -1,9 +1,9 @@
1
- class CreateProducts < ActiveRecord::Migration
1
+ class CreateVariants < ActiveRecord::Migration
2
2
  def change
3
- create_table :products do |t|
3
+ create_table :variants do |t|
4
4
  t.string :sku, :null => false
5
5
  t.string :description, :null => false
6
- t.float :price, :null => false
6
+ t.decimal :price, :null => false
7
7
  t.integer :quantity, :null => false, :default => 0
8
8
  t.integer :item_id, :null => false
9
9
  t.string :item_type, :null => false
@@ -4,13 +4,15 @@ class CreatePayments < ActiveRecord::Migration
4
4
  t.references :order
5
5
  t.references :payment_method
6
6
  t.string :status, :null => false, :default => 'paid'
7
- t.float :total, :null => false, :default => 0.0
7
+ t.decimal :total, :null => false, :default => 0.0
8
8
 
9
9
  t.string :number
10
10
  t.integer :month
11
11
  t.integer :year
12
12
  t.string :verification_value
13
13
 
14
+ t.string :transaction_id
15
+
14
16
  t.timestamps
15
17
  end
16
18
  end
@@ -4,7 +4,7 @@ class CreateShipments < ActiveRecord::Migration
4
4
  t.references :order, :null => false
5
5
  t.references :shipping_method, :null => false
6
6
  t.string :status, :null => false, :default => "new"
7
- t.float :total, :null => false, :default => 0.0
7
+ t.decimal :total, :null => false, :default => 0.0
8
8
 
9
9
  t.timestamps
10
10
  end
@@ -0,0 +1,10 @@
1
+ require "countries"
2
+
3
+ class CreateCountries < ActiveRecord::Migration
4
+ def change
5
+ create_table :countries do |t|
6
+ t.string :name
7
+ t.string :abbr
8
+ end
9
+ end
10
+ end
@@ -3,6 +3,7 @@ class CreateStates < ActiveRecord::Migration
3
3
  create_table :states do |t|
4
4
  t.string :name
5
5
  t.string :abbr
6
+ t.references :country
6
7
  end
7
8
  end
8
9
  end
@@ -0,0 +1,18 @@
1
+ require "countries"
2
+
3
+ class PopulateCountriesAndStates < ActiveRecord::Migration
4
+ def change
5
+ ISO3166::Country.all.each do |country_array|
6
+ name = country_array[0]
7
+ abbr = country_array[1]
8
+ country = Piggybak::Country.create :name => name, :abbr => abbr
9
+
10
+ iso3166_country = ISO3166::Country.new(abbr)
11
+ iso3166_country.states.each do |key, value|
12
+ abbr = key
13
+ name = value["name"]
14
+ Piggybak::State.create! :name => name, :abbr => abbr, :country => country
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,14 @@
1
+ class CreateCredits < ActiveRecord::Migration
2
+ def change
3
+ create_table :credits do |t|
4
+ t.references :order
5
+
6
+ t.string :source_type
7
+ t.integer :source_id
8
+
9
+ t.decimal :total
10
+
11
+ t.timestamps
12
+ end
13
+ end
14
+ end
@@ -1,5 +1,5 @@
1
1
  module Piggybak
2
- module ActsAsProduct
2
+ module ActsAsVariant
3
3
  ## Define ModelMethods
4
4
  module Base
5
5
  def self.included(klass)
@@ -9,12 +9,12 @@ module Piggybak
9
9
  end
10
10
 
11
11
  module ClassMethods
12
- def acts_as_product
13
- has_one :piggybak_product, :as => "item", :class_name => "::Piggybak::Product"
12
+ def acts_as_variant
13
+ has_one :piggybak_variant, :as => "item", :class_name => "::Piggybak::Variant"
14
14
 
15
- accepts_nested_attributes_for :piggybak_product, :allow_destroy => true
15
+ accepts_nested_attributes_for :piggybak_variant, :allow_destroy => true
16
16
 
17
- include Piggybak::ActsAsProduct::Base::InstanceMethods
17
+ include Piggybak::ActsAsVariant::Base::InstanceMethods
18
18
  end
19
19
  end
20
20
 
@@ -29,4 +29,4 @@ module Piggybak
29
29
  end
30
30
  end
31
31
 
32
- ::ActiveRecord::Base.send :include, Piggybak::ActsAsProduct::Base
32
+ ::ActiveRecord::Base.send :include, Piggybak::ActsAsVariant::Base
@@ -1,29 +1,45 @@
1
- require 'acts_as_product/base'
1
+ require 'acts_as_variant/base'
2
2
  require 'acts_as_orderer/base'
3
- require 'application_helper'
4
3
  require 'active_merchant'
5
4
  require 'currency'
6
-
7
- ActiveMerchant::Billing::Base.mode = :test
8
5
 
9
6
  module Piggybak
7
+
10
8
  class Engine < Rails::Engine
11
- initializer "define rails_admin config" do |app|
9
+ initializer "piggybak.add_helper" do |app|
10
+ ApplicationController.class_eval do
11
+ helper :piggybak
12
+ end
13
+ end
14
+
15
+ initializer "piggybak.rails_admin_config" do |app|
12
16
  # RailsAdmin config file. Generated on December 21, 2011 13:04
13
17
  # See github.com/sferik/rails_admin for more informations
14
18
 
15
19
  RailsAdmin.config do |config|
16
20
  config.model Piggybak::Order do
17
21
  label "Order"
18
- navigation_label "Piggybak Orders"
22
+ navigation_label "Orders"
19
23
  weight 1
20
24
  object_label_method :admin_label
21
25
 
22
26
  show do
23
27
  field :status
24
- field :total
25
- field :tax_charge
26
- field :total_due
28
+ field :total do
29
+ formatted_value do
30
+ "$%.2f" % value
31
+ end
32
+ end
33
+ field :tax_charge do
34
+ formatted_value do
35
+ "$%.2f" % value
36
+ end
37
+ end
38
+ field :total_due do
39
+ formatted_value do
40
+ "$%.2f" % value
41
+ end
42
+ end
27
43
  field :created_at
28
44
  field :email
29
45
  field :phone
@@ -43,7 +59,7 @@ module Piggybak
43
59
  end
44
60
  end
45
61
  field :created_at do
46
- strftime_format "%d-%m-%Y"
62
+ #strftime_format "%d-%m-%Y"
47
63
  end
48
64
  field :user
49
65
  end
@@ -52,6 +68,10 @@ module Piggybak
52
68
  read_only true
53
69
  help "Autopopulated"
54
70
  end
71
+ field :actions do
72
+ partial "actions"
73
+ help ""
74
+ end
55
75
  field :user do
56
76
  read_only do
57
77
  !bindings[:object].new_record?
@@ -59,15 +79,15 @@ module Piggybak
59
79
  end
60
80
  field :email
61
81
  field :phone
62
- field :billing_address
63
- field :shipping_address
82
+ field :billing_address do
83
+ help "Required"
84
+ end
85
+ field :shipping_address do
86
+ help "Required"
87
+ end
64
88
  field :line_items
65
89
  field :shipments
66
90
  field :payments
67
- field :actions do
68
- partial "actions"
69
- help "Click above to resend email with current order details."
70
- end
71
91
  end
72
92
  end
73
93
 
@@ -84,7 +104,7 @@ module Piggybak
84
104
  visible false
85
105
 
86
106
  edit do
87
- field :product
107
+ field :variant
88
108
  field :quantity
89
109
  field :total do
90
110
  read_only true
@@ -160,7 +180,7 @@ module Piggybak
160
180
  end
161
181
 
162
182
  config.model Piggybak::PaymentMethod do
163
- navigation_label "Piggybak Configuration"
183
+ navigation_label "Configuration"
164
184
  weight 2
165
185
  object_label_method :admin_label
166
186
  list do
@@ -254,21 +274,37 @@ module Piggybak
254
274
  end
255
275
  end
256
276
 
277
+ config.model Piggybak::Country do
278
+ label "Countries"
279
+ navigation_label "Geodata"
280
+ weight 3
281
+ list do
282
+ field :name
283
+ field :abbr
284
+ end
285
+ edit do
286
+ field :name
287
+ field :abbr
288
+ end
289
+ end
290
+
257
291
  config.model Piggybak::State do
258
- weight 1
259
- parent Piggybak::PaymentMethod
292
+ parent Piggybak::Country
293
+ label "States"
260
294
  list do
261
295
  field :name
262
296
  field :abbr
297
+ field :country
263
298
  end
264
299
  edit do
265
300
  field :name
266
301
  field :abbr
302
+ field :country
267
303
  end
268
304
  end
269
305
 
270
- config.model Piggybak::Product do
271
- label "Product"
306
+ config.model Piggybak::Variant do
307
+ label "Variant"
272
308
  parent Piggybak::Order
273
309
  object_label_method :admin_label
274
310
  edit do
@@ -279,7 +315,7 @@ module Piggybak
279
315
  end
280
316
  include_all_fields
281
317
  field :unlimited_inventory do
282
- help "If true, backorders on this product will be allowed, regardless of quantity on hand."
318
+ help "If true, backorders on this variant will be allowed, regardless of quantity on hand."
283
319
  end
284
320
  end
285
321
  list do