radiant-shop-extension 0.11.6 → 0.90.0
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.md +21 -3
- data/LICENSE +42 -0
- data/README.md +62 -25
- data/Rakefile +4 -5
- data/VERSION +1 -1
- data/app/controllers/admin/shop/categories_controller.rb +1 -0
- data/app/controllers/admin/shop/orders_controller.rb +1 -1
- data/app/controllers/admin/shop/products_controller.rb +18 -7
- data/app/helpers/shop_helper.rb +8 -0
- data/app/models/form_address.rb +5 -5
- data/app/models/form_checkout.rb +25 -17
- data/app/models/form_line_item.rb +1 -1
- data/app/models/shop_category.rb +22 -7
- data/app/models/shop_customer.rb +1 -1
- data/app/models/shop_line_item.rb +26 -26
- data/app/models/shop_order.rb +0 -2
- data/app/models/shop_product.rb +15 -18
- data/app/views/.DS_Store +0 -0
- data/app/views/admin/shop/categories/edit/meta/_status.html.haml +3 -0
- data/app/views/admin/shop/products/edit/_foot.html.haml +1 -8
- data/app/views/admin/shop/products/edit/meta/_layout.html.haml +6 -0
- data/app/views/admin/shop/products/edit/meta/_status.html.haml +3 -0
- data/app/views/admin/shop/products/index/_product.html.haml +1 -1
- data/config/locales/en.yml +8 -7
- data/config/routes.rb +4 -16
- data/db/migrate/20101011063133_setup_shop.rb +94 -0
- data/db/seeds/forms.rb +113 -154
- data/db/seeds/layouts.rb +67 -103
- data/db/seeds/pages.rb +101 -0
- data/db/seeds/products.rb +29 -0
- data/db/seeds/snippets.rb +36 -21
- data/lib/shop/controllers/application_controller.rb +5 -3
- data/lib/shop/models/form_extension.rb +1 -2
- data/lib/shop/models/page.rb +0 -1
- data/lib/shop/models/user.rb +0 -1
- data/lib/shop/tags/card.rb +8 -2
- data/lib/shop/tags/cart.rb +5 -1
- data/lib/shop/tags/helpers.rb +35 -60
- data/lib/shop/tags/item.rb +2 -16
- data/lib/shop/tags/product.rb +7 -0
- data/lib/tasks/shop_extension_tasks.rake +9 -4
- data/public/javascripts/admin/extensions/shop/products/edit.js +0 -25
- data/radiant-shop-extension.gemspec +25 -201
- data/shop_extension.rb +18 -19
- data/spec/datasets/forms.rb +25 -28
- data/spec/datasets/shop_categories.rb +2 -2
- data/spec/datasets/shop_config.rb +24 -0
- data/spec/datasets/shop_customers.rb +1 -0
- data/spec/datasets/shop_line_items.rb +21 -3
- data/spec/datasets/shop_products.rb +4 -1
- data/spec/datasets/tags.rb +19 -0
- data/spec/lib/shop/models/page_spec.rb +1 -1
- data/spec/lib/shop/tags/card_spec.rb +30 -4
- data/spec/lib/shop/tags/cart_spec.rb +29 -12
- data/spec/lib/shop/tags/helpers_spec.rb +45 -66
- data/spec/lib/shop/tags/item_spec.rb +6 -10
- data/spec/lib/shop/tags/product_spec.rb +27 -2
- data/spec/models/form_address_spec.rb +9 -8
- data/spec/models/form_checkout_spec.rb +28 -22
- data/spec/models/shop_category_spec.rb +2 -10
- data/spec/models/shop_line_item_spec.rb +71 -34
- data/spec/models/shop_order_spec.rb +5 -5
- data/spec/models/shop_product_attachment_spec.rb +1 -0
- data/spec/models/shop_product_spec.rb +4 -47
- data/spec/spec.opts +3 -5
- metadata +60 -248
- data/Gemfile +0 -26
- data/Gemfile.lock +0 -75
- data/MIT-LICENSE +0 -20
- data/app/controllers/admin/shop/discounts/discountables_controller.rb +0 -44
- data/app/controllers/admin/shop/discounts_controller.rb +0 -64
- data/app/controllers/admin/shop/packages/packings_controller.rb +0 -90
- data/app/controllers/admin/shop/packages_controller.rb +0 -63
- data/app/controllers/admin/shop/products/variant_templates_controller.rb +0 -27
- data/app/controllers/admin/shop/products/variants_controller.rb +0 -60
- data/app/controllers/admin/shop/variants_controller.rb +0 -48
- data/app/models/form_discount.rb +0 -39
- data/app/models/shop_discount.rb +0 -37
- data/app/models/shop_discountable.rb +0 -64
- data/app/models/shop_group.rb +0 -15
- data/app/models/shop_grouping.rb +0 -6
- data/app/models/shop_package.rb +0 -74
- data/app/models/shop_packing.rb +0 -22
- data/app/models/shop_product_variant.rb +0 -34
- data/app/models/shop_variant.rb +0 -23
- data/app/views/admin/pages/_shop_category.html.haml +0 -4
- data/app/views/admin/pages/_shop_product.html.haml +0 -4
- data/app/views/admin/shop/discounts/edit/_foot.html.haml +0 -16
- data/app/views/admin/shop/discounts/edit/_form.html.haml +0 -15
- data/app/views/admin/shop/discounts/edit/_head.html.haml +0 -4
- data/app/views/admin/shop/discounts/edit/_inputs.html.haml +0 -2
- data/app/views/admin/shop/discounts/edit/_meta.html.haml +0 -8
- data/app/views/admin/shop/discounts/edit/_parts.html.haml +0 -9
- data/app/views/admin/shop/discounts/edit/_popups.html.haml +0 -4
- data/app/views/admin/shop/discounts/edit/buttons/_browse_categories.html.haml +0 -1
- data/app/views/admin/shop/discounts/edit/buttons/_browse_products.html.haml +0 -1
- data/app/views/admin/shop/discounts/edit/inputs/_amount.html.haml +0 -3
- data/app/views/admin/shop/discounts/edit/inputs/_code.html.haml +0 -3
- data/app/views/admin/shop/discounts/edit/inputs/_name.html.haml +0 -3
- data/app/views/admin/shop/discounts/edit/meta/_finish.html.haml +0 -5
- data/app/views/admin/shop/discounts/edit/meta/_start.html.haml +0 -5
- data/app/views/admin/shop/discounts/edit/parts/_categories.html.haml +0 -3
- data/app/views/admin/shop/discounts/edit/parts/_products.html.haml +0 -3
- data/app/views/admin/shop/discounts/edit/popups/_browse_categories.html.haml +0 -6
- data/app/views/admin/shop/discounts/edit/popups/_browse_products.html.haml +0 -6
- data/app/views/admin/shop/discounts/edit/shared/_category.html.haml +0 -11
- data/app/views/admin/shop/discounts/edit/shared/_product.html.haml +0 -12
- data/app/views/admin/shop/discounts/edit.html.haml +0 -11
- data/app/views/admin/shop/discounts/index/_discount.html.haml +0 -13
- data/app/views/admin/shop/discounts/index/_foot.html.haml +0 -5
- data/app/views/admin/shop/discounts/index/_head.html.haml +0 -2
- data/app/views/admin/shop/discounts/index/buttons/_new_discount.html.haml +0 -1
- data/app/views/admin/shop/discounts/index.html.haml +0 -13
- data/app/views/admin/shop/discounts/new.html.haml +0 -11
- data/app/views/admin/shop/discounts/remove.html.haml +0 -12
- data/app/views/admin/shop/packages/edit/_foot.html.haml +0 -17
- data/app/views/admin/shop/packages/edit/_form.html.haml +0 -15
- data/app/views/admin/shop/packages/edit/_head.html.haml +0 -4
- data/app/views/admin/shop/packages/edit/_inputs.html.haml +0 -2
- data/app/views/admin/shop/packages/edit/_meta.html.haml +0 -8
- data/app/views/admin/shop/packages/edit/_parts.html.haml +0 -9
- data/app/views/admin/shop/packages/edit/_popups.html.haml +0 -4
- data/app/views/admin/shop/packages/edit/buttons/_browse_products.html.haml +0 -1
- data/app/views/admin/shop/packages/edit/inputs/_name.html.haml +0 -3
- data/app/views/admin/shop/packages/edit/inputs/_price.html.haml +0 -3
- data/app/views/admin/shop/packages/edit/meta/_sku.html.haml +0 -5
- data/app/views/admin/shop/packages/edit/parts/_description.html.haml +0 -1
- data/app/views/admin/shop/packages/edit/parts/_products.html.haml +0 -3
- data/app/views/admin/shop/packages/edit/popups/_browse_products.html.haml +0 -7
- data/app/views/admin/shop/packages/edit/shared/_product.html.haml +0 -8
- data/app/views/admin/shop/packages/edit.html.haml +0 -11
- data/app/views/admin/shop/packages/index/_foot.html.haml +0 -8
- data/app/views/admin/shop/packages/index/_head.html.haml +0 -2
- data/app/views/admin/shop/packages/index/_package.html.haml +0 -9
- data/app/views/admin/shop/packages/index/buttons/_new_package.html.haml +0 -1
- data/app/views/admin/shop/packages/index.html.haml +0 -13
- data/app/views/admin/shop/packages/new.html.haml +0 -11
- data/app/views/admin/shop/packages/remove.html.haml +0 -12
- data/app/views/admin/shop/products/edit/buttons/_browse_templates.html.haml +0 -1
- data/app/views/admin/shop/products/edit/buttons/_new_variant.html.haml +0 -1
- data/app/views/admin/shop/products/edit/parts/_variants.html.haml +0 -3
- data/app/views/admin/shop/products/edit/popups/_browse_templates.html.haml +0 -6
- data/app/views/admin/shop/products/edit/popups/_new_variant.html.haml +0 -16
- data/app/views/admin/shop/products/edit/shared/_template.html.haml +0 -6
- data/app/views/admin/shop/products/edit/shared/_variant.html.haml +0 -10
- data/app/views/admin/shop/products/index/buttons/_variants.html.haml +0 -1
- data/app/views/admin/shop/variants/edit/_foot.html.haml +0 -9
- data/app/views/admin/shop/variants/edit/_form.html.haml +0 -13
- data/app/views/admin/shop/variants/edit/_head.html.haml +0 -4
- data/app/views/admin/shop/variants/edit/_inputs.html.haml +0 -2
- data/app/views/admin/shop/variants/edit/_meta.html.haml +0 -8
- data/app/views/admin/shop/variants/edit/_parts.html.haml +0 -9
- data/app/views/admin/shop/variants/edit/_popups.html.haml +0 -4
- data/app/views/admin/shop/variants/edit/inputs/_name.html.haml +0 -3
- data/app/views/admin/shop/variants/edit/inputs/_options.html.haml +0 -3
- data/app/views/admin/shop/variants/edit.html.haml +0 -11
- data/app/views/admin/shop/variants/index/_foot.html.haml +0 -5
- data/app/views/admin/shop/variants/index/_head.html.haml +0 -2
- data/app/views/admin/shop/variants/index/_variant.html.haml +0 -9
- data/app/views/admin/shop/variants/index/buttons/_add_variant.html.haml +0 -1
- data/app/views/admin/shop/variants/index/buttons/_categories.html.haml +0 -1
- data/app/views/admin/shop/variants/index.html.haml +0 -13
- data/app/views/admin/shop/variants/new.html.haml +0 -11
- data/app/views/admin/shop/variants/remove.html.haml +0 -12
- data/app/views/shop/categories/show.html.haml +0 -1
- data/app/views/shop/orders/show.html.haml +0 -1
- data/app/views/shop/products/index.html.haml +0 -1
- data/app/views/shop/products/show.html.haml +0 -1
- data/cucumber.yml +0 -1
- data/db/migrate/20100311053701_initial.rb +0 -153
- data/db/migrate/20100927041219_remove_payment_methods.rb +0 -16
- data/db/migrate/20100927041624_change_payments_add_gateway.rb +0 -11
- data/db/migrate/20100927140446_change_payment_add_card_type_card_number.rb +0 -11
- data/db/migrate/20100929011106_fix_relationship_foreign_keys.rb +0 -101
- data/db/migrate/20100929011607_drop_shop_addressables.rb +0 -25
- data/db/migrate/20100929030510_create_shop_groups.rb +0 -19
- data/db/migrate/20100929080301_shop_groups_change_add_description.rb +0 -11
- data/db/migrate/20100929081200_create_variants.rb +0 -20
- data/db/migrate/20100929143531_change_variants_add_updated_by.rb +0 -25
- data/db/migrate/20100929145641_change_created_by_to_id.rb +0 -75
- data/db/migrate/20100929235221_change_category_add_variant_id.rb +0 -9
- data/db/migrate/20100930235221_create_packages.rb +0 -31
- data/db/migrate/20101005231713_create_page_ids.rb +0 -11
- data/db/migrate/20101006051214_create_pages_for_products_and_categories.rb +0 -73
- data/db/migrate/20101007111845_add_default_position_to_attachment.rb +0 -9
- data/db/migrate/20101010071143_create_discounts.rb +0 -29
- data/db/migrate/20101010072225_modify_categories_remove_variant.rb +0 -9
- data/db/migrate/20101010130034_change_discountables_add_observer.rb +0 -15
- data/db/migrate/20101011063133_change_orders_set_limits_to_null.rb +0 -11
- data/features/support/env.rb +0 -16
- data/features/support/paths.rb +0 -14
- data/lib/shop/interface/packages.rb +0 -34
- data/lib/shop/interface/variants.rb +0 -34
- data/lib/shop/tags/package.rb +0 -95
- data/lib/shop/tags/product_variant.rb +0 -52
- data/lib/shop/tags/responses.rb +0 -34
- data/mockups/balsamiq/products-retro_fun_tshirt-more.bmml +0 -0
- data/mockups/balsamiq/products-retro_fun_tshirt.bmml +0 -0
- data/mockups/discounts/new-edit.bmml +0 -492
- data/public/javascripts/admin/extensions/shop/discounts/edit.js +0 -76
- data/public/javascripts/admin/extensions/shop/packages/edit.js +0 -109
- data/public/stylesheets/sass/admin/extensions/shop/discounts/edit.sass +0 -125
- data/public/stylesheets/sass/admin/extensions/shop/packages/edit.sass +0 -162
- data/spec/controllers/admin/shop/discounts/discountables_controller_spec.rb +0 -73
- data/spec/controllers/admin/shop/discounts_controller_spec.rb +0 -81
- data/spec/controllers/admin/shop/packages/packings_controller_spec.rb +0 -188
- data/spec/controllers/admin/shop/packages_controller_spec.rb +0 -32
- data/spec/controllers/admin/shop/products/variant_templates_controller_spec.rb +0 -53
- data/spec/controllers/admin/shop/products/variants_controller_spec.rb +0 -116
- data/spec/controllers/admin/shop/variants_controller_spec.rb +0 -67
- data/spec/datasets/shop_discountables.rb +0 -22
- data/spec/datasets/shop_discounts.rb +0 -29
- data/spec/datasets/shop_groups.rb +0 -15
- data/spec/datasets/shop_packages.rb +0 -25
- data/spec/datasets/shop_product_variants.rb +0 -22
- data/spec/datasets/shop_variants.rb +0 -17
- data/spec/lib/shop/tags/package_spec.rb +0 -342
- data/spec/lib/shop/tags/product_variant_spec.rb +0 -175
- data/spec/lib/shop/tags/responses_spec.rb +0 -129
- data/spec/models/form_discount_spec.rb +0 -63
- data/spec/models/shop_discount_spec.rb +0 -130
- data/spec/models/shop_discountable_spec.rb +0 -114
- data/spec/models/shop_group_spec.rb +0 -38
- data/spec/models/shop_package_spec.rb +0 -117
- data/spec/models/shop_packing_spec.rb +0 -67
- data/spec/models/shop_product_variant_spec.rb +0 -92
- data/spec/models/shop_variant_spec.rb +0 -32
@@ -9,11 +9,4 @@
|
|
9
9
|
= updated_stamp @shop_product
|
10
10
|
|
11
11
|
- unless @shop_product.new_record?
|
12
|
-
|
13
|
-
if(typeof(ROUTES) === 'undefined') ROUTES = new Array();
|
14
|
-
|
15
|
-
ROUTES['admin_shop_product_images_path'] = "#{admin_shop_product_images_path(@shop_product)}";
|
16
|
-
ROUTES['sort_admin_shop_product_images_path'] = "#{sort_admin_shop_product_images_path(@shop_product)}";
|
17
|
-
|
18
|
-
ROUTES['admin_shop_product_image_path'] = "#{admin_shop_product_image_path(@shop_product, ':id')}";
|
19
|
-
ROUTES['admin_shop_product_variant_path'] = "#{admin_shop_product_variant_path(@shop_product, ':id')}";
|
12
|
+
= routes_to_js(@routes)
|
@@ -6,7 +6,7 @@
|
|
6
6
|
- body.icon do
|
7
7
|
- link_to [:edit_admin, product], :class => 'icon' do
|
8
8
|
- unless product.attachments.empty?
|
9
|
-
= image_tag product.attachments.first.image.url(:
|
9
|
+
= image_tag product.attachments.first.image.url(:icon)
|
10
10
|
- body.name do
|
11
11
|
%span.name.attribute
|
12
12
|
- link_to [:edit_admin, product] do
|
data/config/locales/en.yml
CHANGED
@@ -49,13 +49,14 @@ en:
|
|
49
49
|
caption: "Caption"
|
50
50
|
price: "Price"
|
51
51
|
sku: "sku"
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
52
|
+
all: "all"
|
53
|
+
new: "new"
|
54
|
+
shipped: "shipped"
|
55
|
+
paid: "paid"
|
56
|
+
order: "Order"
|
57
|
+
orders: "Orders"
|
58
|
+
export: Export
|
59
|
+
new_customer: "New Customer"
|
59
60
|
text:
|
60
61
|
remove_customer:
|
61
62
|
warning: "Deleting a customer is irreversible and will also delete their orders and addresses, make sure you're sure."
|
data/config/routes.rb
CHANGED
@@ -1,32 +1,20 @@
|
|
1
1
|
ActionController::Routing::Routes.draw do |map|
|
2
2
|
|
3
3
|
map.namespace :admin do |admin|
|
4
|
-
admin.namespace :shop, :member => { :remove => :get } do |shop|
|
4
|
+
admin.namespace :shop, :member => { :remove => :get } do |shop|
|
5
|
+
|
5
6
|
shop.resources :categories, :collection => { :sort => :put }, :member => { :products => :get } do |category|
|
6
7
|
category.resources :products, :only => :new
|
7
8
|
end
|
8
9
|
|
9
10
|
shop.resources :products, :except => :new, :collection => { :sort => :put } do |product|
|
10
|
-
product.resources :images,
|
11
|
-
product.resources :variants, :controller => 'products/variants', :only => [ :create, :destroy]
|
12
|
-
product.resources :variant_templates, :controller => 'products/variant_templates', :only => [ :update ]
|
13
|
-
product.resources :discounts, :controller => 'products/discounts', :only => [ :create, :destroy]
|
14
|
-
product.resources :discount_templates,:controller => 'products/discount_templates', :only => [ :update ]
|
11
|
+
product.resources :images, :controller => 'products/images', :only => [:index, :create, :destroy], :collection => { :sort => :put }
|
15
12
|
end
|
16
13
|
|
17
|
-
shop.resources :packages, :member => { :remove => :get } do |packages|
|
18
|
-
packages.resources :packings, :controller => 'packages/packings', :only => [:create, :update, :destroy], :collection => { :sort => :put }
|
19
|
-
end
|
20
|
-
|
21
|
-
shop.resources :discounts, :member => { :remove => :get } do |discounts|
|
22
|
-
discounts.resources :discountables, :controller => 'discounts/discountables', :only => [:create,:destroy]
|
23
|
-
end
|
24
|
-
|
25
|
-
shop.resources :variants
|
26
|
-
|
27
14
|
shop.resources :customers
|
28
15
|
|
29
16
|
shop.resources :orders, :except => [ :destroy ], :collection => { :export => :get }
|
17
|
+
|
30
18
|
end
|
31
19
|
|
32
20
|
admin.resources :shops, :as => 'shop', :only => [ :index ]
|
@@ -0,0 +1,94 @@
|
|
1
|
+
class SetupShop < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table "shop_products", :force => true do |t|
|
4
|
+
t.decimal "price"
|
5
|
+
t.decimal "weight"
|
6
|
+
t.decimal "height"
|
7
|
+
t.decimal "width"
|
8
|
+
t.decimal "depth"
|
9
|
+
t.datetime "created_at"
|
10
|
+
t.datetime "updated_at"
|
11
|
+
t.integer "created_by_id"
|
12
|
+
t.integer "updated_by_id"
|
13
|
+
t.integer "page_id"
|
14
|
+
end
|
15
|
+
|
16
|
+
create_table "shop_categories", :force => true do |t|
|
17
|
+
t.integer "product_layout_id"
|
18
|
+
t.datetime "created_at"
|
19
|
+
t.datetime "updated_at"
|
20
|
+
t.integer "created_by_id"
|
21
|
+
t.integer "updated_by_id"
|
22
|
+
t.integer "page_id"
|
23
|
+
end
|
24
|
+
|
25
|
+
create_table "shop_product_attachments", :force => true do |t|
|
26
|
+
t.integer "position", :default => 1
|
27
|
+
t.integer "image_id"
|
28
|
+
t.integer "product_id"
|
29
|
+
t.integer "created_by_id"
|
30
|
+
t.integer "updated_by_id"
|
31
|
+
end
|
32
|
+
add_index "shop_product_attachments", ["image_id"], :name => "index_shop_product_attachments_on_image_id"
|
33
|
+
add_index "shop_product_attachments", ["position"], :name => "index_shop_product_attachments_on_position"
|
34
|
+
add_index "shop_product_attachments", ["product_id"], :name => "index_shop_product_attachments_on_product_id"
|
35
|
+
|
36
|
+
create_table "shop_orders", :force => true do |t|
|
37
|
+
t.text "notes"
|
38
|
+
t.string "status", :default => "new"
|
39
|
+
t.integer "billing_id"
|
40
|
+
t.integer "shipping_id"
|
41
|
+
t.datetime "created_at"
|
42
|
+
t.datetime "updated_at"
|
43
|
+
t.integer "customer_id"
|
44
|
+
t.integer "created_by_id"
|
45
|
+
t.integer "updated_by_id"
|
46
|
+
end
|
47
|
+
add_index "shop_orders", ["customer_id"], :name => "index_shop_orders_on_customer_id"
|
48
|
+
add_index "shop_orders", ["status"], :name => "index_shop_orders_on_status"
|
49
|
+
|
50
|
+
create_table "shop_line_items", :force => true do |t|
|
51
|
+
t.integer "quantity", :default => 1
|
52
|
+
t.integer "item_id"
|
53
|
+
t.string "item_type"
|
54
|
+
t.decimal "item_price"
|
55
|
+
t.datetime "created_at"
|
56
|
+
t.datetime "updated_at"
|
57
|
+
t.integer "order_id"
|
58
|
+
t.integer "created_by_id"
|
59
|
+
t.integer "updated_by_id"
|
60
|
+
end
|
61
|
+
add_index "shop_line_items", ["item_id"], :name => "index_shop_line_items_on_item_id"
|
62
|
+
add_index "shop_line_items", ["order_id"], :name => "index_shop_line_items_on_order_id"
|
63
|
+
|
64
|
+
create_table "shop_addresses", :force => true do |t|
|
65
|
+
t.string "email"
|
66
|
+
t.string "name"
|
67
|
+
t.string "unit"
|
68
|
+
t.string "street"
|
69
|
+
t.string "city"
|
70
|
+
t.string "state"
|
71
|
+
t.string "postcode"
|
72
|
+
t.string "country"
|
73
|
+
t.integer "created_by_id"
|
74
|
+
t.integer "updated_by_id"
|
75
|
+
t.datetime "created_at"
|
76
|
+
t.datetime "updated_at"
|
77
|
+
end
|
78
|
+
|
79
|
+
create_table "shop_payments", :force => true do |t|
|
80
|
+
t.float "amount"
|
81
|
+
t.datetime "created_at"
|
82
|
+
t.datetime "updated_at"
|
83
|
+
t.string "gateway"
|
84
|
+
t.string "card_type"
|
85
|
+
t.string "card_number"
|
86
|
+
t.integer "order_id"
|
87
|
+
t.integer "created_by_id"
|
88
|
+
t.integer "updated_by_id"
|
89
|
+
end
|
90
|
+
|
91
|
+
add_index "shop_payments", ["gateway"], :name => "index_shop_payments_on_gateway"
|
92
|
+
add_index "shop_payments", ["order_id"], :name => "index_shop_payments_on_order_id"
|
93
|
+
end
|
94
|
+
end
|
data/db/seeds/forms.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
#---------------------------------------------------#
|
3
2
|
# Add Cart Item
|
4
|
-
|
5
|
-
Form.
|
6
|
-
|
7
|
-
|
8
|
-
:body => <<-BODY
|
3
|
+
#---------------------------------------------------#
|
4
|
+
add = Form.new
|
5
|
+
add.title = 'CartAddProduct'
|
6
|
+
add.body = <<-BODY
|
9
7
|
<r:shop:product>
|
10
8
|
<input type="hidden" name="line_item[item_id]" value="<r:id />" />
|
11
9
|
<input type="hidden" name="line_item[item_type]" value="ShopProduct" />
|
@@ -14,177 +12,138 @@ Form.create({
|
|
14
12
|
<input type="submit" name="add_to_cart" id="add_to_cart_<r:id />" value="Buy Now" />
|
15
13
|
</r:shop:product>
|
16
14
|
BODY
|
17
|
-
|
15
|
+
add.config = <<-CONFIG
|
16
|
+
add_product:
|
17
|
+
extension: line_item
|
18
|
+
process: add
|
19
|
+
CONFIG
|
18
20
|
|
19
|
-
|
20
|
-
:title => 'CartAddProductVariant',
|
21
|
-
:action => '/shop/cart', # Redirects to the cart listing
|
22
|
-
:body => <<-BODY
|
23
|
-
<r:shop:product>
|
24
|
-
<input type="hidden" name="line_item[item_id]" value="<r:id />" />
|
25
|
-
<input type="hidden" name="line_item[item_type]" value="ShopProduct" />
|
26
|
-
|
27
|
-
<input type="hidden" name="line_item[quantity]" value="1" />
|
28
|
-
<input type="submit" name="add_to_cart" id="add_to_cart_<r:id />" value="Buy Now" />
|
29
|
-
</r:shop:product>
|
30
|
-
BODY
|
31
|
-
})
|
21
|
+
add.save
|
32
22
|
|
23
|
+
#---------------------------------------------------#
|
33
24
|
# Update Cart Item
|
34
|
-
|
35
|
-
Form.
|
36
|
-
|
37
|
-
|
38
|
-
:body => <<-BODY
|
25
|
+
#---------------------------------------------------#
|
26
|
+
update = Form.new
|
27
|
+
update.title = 'CartUpdateItem'
|
28
|
+
update.body = <<-BODY
|
39
29
|
<r:shop:cart>
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
30
|
+
<r:item>
|
31
|
+
<input type="hidden" name="_method" value="put" />
|
32
|
+
<input type="hidden" name="line_item[id]" value="<r:item:id />" />
|
33
|
+
|
34
|
+
<input type="text" name="line_item[quantity]" value="<r:quantity />" />
|
35
|
+
<input type="submit" name="add_to_cart" id="update_<r:id />" value="Update" />
|
36
|
+
</r:item>
|
47
37
|
</r:shop:cart>
|
48
38
|
BODY
|
49
|
-
|
50
|
-
|
51
|
-
|
39
|
+
update.config = <<-CONFIG
|
40
|
+
add_product:
|
41
|
+
extension: line_item
|
42
|
+
process: modify
|
43
|
+
CONFIG
|
52
44
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
<li>
|
70
|
-
<r:label for='billing[street]'>Street</r:label>
|
71
|
-
<input type="text" name="billing[street]" value="<r:street/>" />
|
72
|
-
</li>
|
73
|
-
<li>
|
74
|
-
<r:label for='billing[city]'>Suburb and Postcode</r:label>
|
75
|
-
<input type="text" name="billing[city]" value="<r:city/>" />
|
76
|
-
<input type="text" name="billing[postcode]" value="<r:postcode/>" />
|
77
|
-
</li>
|
78
|
-
<li>
|
79
|
-
<r:label for='billing[state]'>State and Country</r:label>
|
80
|
-
<input type="text" name="billing[state]" value="<r:state/>" />
|
81
|
-
<input type="text" name="billing[country]" value="<r:country/>" />
|
82
|
-
</li>
|
83
|
-
</r:address>
|
84
|
-
</ol>
|
85
|
-
</div>
|
86
|
-
|
87
|
-
<div id="shipping" class="address">
|
88
|
-
<h4>Shipping</h4>
|
45
|
+
update.save
|
46
|
+
|
47
|
+
#---------------------------------------------------#
|
48
|
+
# Cart Address
|
49
|
+
#---------------------------------------------------#
|
50
|
+
address = Form.new
|
51
|
+
address.title = 'CartAddress'
|
52
|
+
address.redirect_to = '/cart/payment'
|
53
|
+
address.body = <<-BODY
|
54
|
+
<r:shop:cart:items:if_items>
|
55
|
+
<div id="billing" class="address">
|
56
|
+
<r:address type='billing'>
|
57
|
+
<h4>Address</h4>
|
58
|
+
|
59
|
+
<r:if_address><input type="hidden" name="billing[id]" value="<r:id />" /></r:if_address>
|
60
|
+
|
89
61
|
<ol class="address">
|
90
|
-
<
|
91
|
-
<r:
|
92
|
-
<
|
93
|
-
|
94
|
-
|
95
|
-
</
|
96
|
-
<
|
97
|
-
|
98
|
-
|
99
|
-
</
|
100
|
-
<
|
101
|
-
|
102
|
-
|
103
|
-
</
|
104
|
-
<
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
</
|
109
|
-
<
|
110
|
-
|
111
|
-
|
112
|
-
<input type="text" name="shipping[country]" value="<r:country/>" />
|
113
|
-
</li>
|
114
|
-
</r:address>
|
62
|
+
<li id="billing_name_input" class="input required">
|
63
|
+
<r:label for='billing[name]'>Full Name</r:label>
|
64
|
+
<input type="text" name="billing[name]" value="<r:name/>" />
|
65
|
+
</li>
|
66
|
+
<li id="billing_email_input" class="input required">
|
67
|
+
<r:label for='billing[email]'>Email</r:label>
|
68
|
+
<input type="text" name="billing[email]" value="<r:email/>" />
|
69
|
+
</li>
|
70
|
+
<li id="billing_street_input" class="input required">
|
71
|
+
<r:label for='billing[street]'>Street</r:label>
|
72
|
+
<input type="text" name="billing[street]" value="<r:street/>" />
|
73
|
+
</li>
|
74
|
+
<li id="billing_city_input" class="input required">
|
75
|
+
<r:label for='billing[city]'>Suburb and Postcode</r:label>
|
76
|
+
<input type="text" name="billing[city]" value="<r:city/>" />
|
77
|
+
<input type="text" name="billing[postcode]" value="<r:postcode/>" />
|
78
|
+
</li>
|
79
|
+
<li id="billing_state_input" class="input required">
|
80
|
+
<r:label for='billing[state]'>State and Country</r:label>
|
81
|
+
<input type="text" name="billing[state]" value="<r:state/>" />
|
82
|
+
<input type="text" name="billing[country]" value="<r:country/>" />
|
83
|
+
</li>
|
115
84
|
</ol>
|
116
|
-
</
|
85
|
+
</r:address>
|
117
86
|
</div>
|
118
|
-
</r:shop:cart>
|
87
|
+
</r:shop:cart:items:if_items>
|
119
88
|
|
120
|
-
<r:submit value="
|
89
|
+
<r:submit value="On To Payment" />
|
121
90
|
BODY
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
billing: true
|
127
|
-
shipping: true
|
91
|
+
address.config = <<-CONFIG
|
92
|
+
checkout_addresses:
|
93
|
+
extension: address
|
94
|
+
billing: true
|
128
95
|
CONFIG
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
96
|
+
address.save
|
97
|
+
|
98
|
+
|
99
|
+
#---------------------------------------------------#
|
100
|
+
# Cart Payment
|
101
|
+
#---------------------------------------------------#
|
102
|
+
payment = Form.new
|
103
|
+
payment.title = 'CartPayment'
|
104
|
+
payment.redirect_to = '/cart/thanks'
|
105
|
+
payment.body = <<-BODY
|
106
|
+
<r:response:if_results extension='bogus_checkout'>
|
107
|
+
<r:response:get name='results[bogus_checkout][message]' />
|
108
|
+
</r:response:if_results>
|
109
|
+
|
110
|
+
<r:shop:cart:items:if_items>
|
111
|
+
<input type="hidden" name="options[order_number]" value="<r:id />" />
|
139
112
|
<ol class="card">
|
140
|
-
<li>
|
113
|
+
<li id="card_type_select" class="select required">
|
141
114
|
<r:label for='card[type]'>Type of Card</r:label>
|
142
|
-
<r:
|
143
|
-
|
144
|
-
<r:option value='mastercard'>Master Card</r:option>
|
145
|
-
<r:option value='diners'>Diners Club</r:option>
|
146
|
-
<r:option vlaue='amex'>AMEX</r:option>
|
147
|
-
</r:select>
|
115
|
+
<r:form:card:type />
|
116
|
+
<r:hidden name='card[type]' value='bogus' /> <!-- delete me -->
|
148
117
|
</li>
|
149
|
-
<li>
|
118
|
+
<li id="card_name_input" class="input required">
|
150
119
|
<r:label for='card[name]'>Name on Card</r:label>
|
151
120
|
<r:text name='card[name]' />
|
152
121
|
</li>
|
153
|
-
<li>
|
122
|
+
<li id="card_number_input" class="input required">
|
154
123
|
<r:label for='card[number]'>Card Number</r:label>
|
155
124
|
<r:text name='card[number]' />
|
125
|
+
<r:hidden name='card[number]' value='1' /> <!-- delete me -->
|
156
126
|
</li>
|
157
|
-
<li>
|
158
|
-
<r:label for='card[verification]'>
|
127
|
+
<li id="card_verification_input" class="input required">
|
128
|
+
<r:label for='card[verification]'>Security Code</r:label>
|
159
129
|
<r:text name='card[verification]' length='4' />
|
160
130
|
</li>
|
161
|
-
<li>
|
162
|
-
<r:label for='card[month]'>
|
163
|
-
<r:
|
164
|
-
|
131
|
+
<li id="card_month_select" class="select required">
|
132
|
+
<r:label for='card[month]'>Expiry</r:label>
|
133
|
+
<r:form:card:month /><r:form:card:year />
|
134
|
+
</li>
|
135
|
+
<li id="card_submit" class="submit">
|
136
|
+
<r:submit value='Place Order' />
|
165
137
|
</li>
|
166
138
|
</ol>
|
167
|
-
|
168
|
-
|
169
|
-
<h3>Special Instructions</h3>
|
170
|
-
|
171
|
-
<p><textarea name="order[message]"></textarea></p>
|
172
|
-
|
173
|
-
<r:shop:cart:address type='billing'>
|
174
|
-
<input type="hidden" name="options[address][address1]" value="<r:street />" />
|
175
|
-
<input type="hidden" name="options[address][city]" value="<r:city />" />
|
176
|
-
<input type="hidden" name="options[address][state]" value="<r:state />" />
|
177
|
-
<input type="hidden" name="options[address][country]" value="<r:country />" />
|
178
|
-
<input type="hidden" name="options[address][zip]" value="<r:postcode />" />
|
179
|
-
<input type="hidden" name="options[email]" value="<r:email />" />
|
180
|
-
<input type="hidden" name="options[description]" value="<r:config:setting key='site.url' /> order #<r:shop:cart:id />" />
|
181
|
-
</r:shop:cart:address>
|
182
|
-
|
183
|
-
<r:submit value="Place Order" />
|
184
|
-
|
185
|
-
<r:snippet name='PaymentResponse' />
|
139
|
+
|
140
|
+
</r:shop:cart:items:if_items>
|
186
141
|
BODY
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
142
|
+
payment.config = <<-CONFIG
|
143
|
+
bogus_checkout:
|
144
|
+
extension: checkout
|
145
|
+
test: true
|
146
|
+
gateway:
|
147
|
+
name: bogus
|
148
|
+
CONFIG
|
149
|
+
payment.save
|