radiant-shop-extension 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +5 -1
- data/VERSION +1 -1
- data/app/controllers/admin/shop/categories_controller.rb +32 -65
- data/app/controllers/admin/shop/customers_controller.rb +8 -7
- data/app/controllers/admin/shop/orders_controller.rb +37 -159
- data/app/controllers/admin/shop/packages/packings_controller.rb +90 -0
- data/app/controllers/admin/shop/packages_controller.rb +65 -0
- data/app/controllers/admin/shop/products/images_controller.rb +5 -8
- data/app/controllers/admin/shop/products/variant_templates_controller.rb +27 -0
- data/app/controllers/admin/shop/products/variants_controller.rb +60 -0
- data/app/controllers/admin/shop/products_controller.rb +67 -64
- data/app/controllers/admin/shop/variants_controller.rb +49 -0
- data/app/helpers/shop_helper.rb +5 -0
- data/app/models/form_address.rb +144 -0
- data/app/models/form_checkout.rb +200 -307
- data/app/models/form_line_item.rb +60 -0
- data/app/models/shop_address.rb +2 -2
- data/app/models/shop_category.rb +48 -51
- data/app/models/shop_customer.rb +25 -5
- data/app/models/shop_group.rb +15 -0
- data/app/models/shop_grouping.rb +6 -0
- data/app/models/shop_line_item.rb +7 -6
- data/app/models/shop_order.rb +44 -16
- data/app/models/shop_package.rb +74 -0
- data/app/models/shop_packing.rb +22 -0
- data/app/models/shop_page.rb +7 -0
- data/app/models/shop_payment.rb +5 -1
- data/app/models/shop_product.rb +86 -48
- data/app/models/shop_product_attachment.rb +5 -2
- data/app/models/shop_product_variant.rb +31 -0
- data/app/models/shop_variant.rb +25 -0
- data/app/views/admin/shop/categories/edit.html.haml +9 -10
- data/app/views/admin/shop/categories/edit/_foot.html.haml +9 -0
- data/app/views/admin/shop/categories/edit/_form.html.haml +14 -0
- data/app/views/admin/shop/categories/edit/_head.html.haml +4 -2
- data/app/views/admin/shop/categories/edit/_inputs.html.haml +2 -0
- data/app/views/admin/shop/categories/edit/_meta.html.haml +8 -7
- data/app/views/admin/shop/categories/edit/_parts.html.haml +9 -0
- data/app/views/admin/shop/categories/edit/_popups.html.haml +4 -0
- data/app/views/admin/shop/categories/edit/inputs/_name.html.haml +4 -0
- data/app/views/admin/shop/categories/edit/meta/_handle.html.haml +6 -5
- data/app/views/admin/shop/categories/edit/meta/_layouts.html.haml +6 -5
- data/app/views/admin/shop/categories/edit/meta/_page.html.haml +3 -0
- data/app/views/admin/shop/categories/edit/parts/_description.html.haml +4 -1
- data/app/views/admin/shop/categories/index/_category.html.haml +11 -10
- data/app/views/admin/shop/categories/new.html.haml +10 -9
- data/app/views/admin/shop/customers/edit.html.haml +8 -10
- data/app/views/admin/shop/customers/edit/_foot.html.haml +9 -0
- data/app/views/admin/shop/customers/edit/_form.html.haml +13 -0
- data/app/views/admin/shop/customers/edit/_head.html.haml +4 -2
- data/app/views/admin/shop/customers/edit/_inputs.html.haml +2 -0
- data/app/views/admin/shop/customers/edit/_parts.html.haml +9 -4
- data/app/views/admin/shop/customers/edit/inputs/_email.html.haml +3 -0
- data/app/views/admin/shop/customers/edit/inputs/_name.html.haml +3 -0
- data/app/views/admin/shop/customers/edit/parts/_orders.html.haml +10 -6
- data/app/views/admin/shop/customers/index.html.haml +4 -1
- data/app/views/admin/shop/customers/index/_customer.html.haml +3 -3
- data/app/views/admin/shop/customers/index/_foot.html.haml +4 -0
- data/app/views/admin/shop/customers/index/_head.html.haml +4 -0
- data/app/views/admin/shop/customers/new.html.haml +9 -9
- data/app/views/admin/shop/orders/edit.html.haml +11 -0
- data/app/views/admin/shop/orders/edit/_foot.html.haml +9 -0
- data/app/views/admin/shop/orders/edit/_form.html.haml +13 -0
- data/app/views/admin/shop/orders/edit/_head.html.haml +4 -0
- data/app/views/admin/shop/orders/edit/_inputs.html.haml +2 -0
- data/app/views/admin/shop/orders/edit/_meta.html.haml +8 -0
- data/app/views/admin/shop/orders/edit/_parts.html.haml +9 -0
- data/app/views/admin/shop/orders/edit/_popups.html.haml +4 -0
- data/app/views/admin/shop/orders/edit/parts/_address.html.haml +7 -0
- data/app/views/admin/shop/orders/edit/parts/_addresses.html.haml +9 -0
- data/app/views/admin/shop/orders/edit/parts/_customer.html.haml +3 -0
- data/app/views/admin/shop/orders/edit/parts/_items.html.haml +8 -0
- data/app/views/admin/shop/orders/index.html.haml +10 -30
- data/app/views/admin/shop/orders/index/_foot.html.haml +3 -0
- data/app/views/admin/shop/orders/index/_head.html.haml +4 -0
- data/app/views/admin/shop/orders/index/_order.html.haml +13 -0
- data/app/views/admin/shop/orders/index/buttons/_all.html.haml +1 -0
- data/app/views/admin/shop/orders/index/buttons/_new.html.haml +1 -0
- data/app/views/admin/shop/orders/index/buttons/_paid.html.haml +1 -0
- data/app/views/admin/shop/orders/index/buttons/_shipped.html.haml +1 -0
- data/app/views/admin/shop/packages/edit.html.haml +11 -0
- data/app/views/admin/shop/packages/edit/_foot.html.haml +17 -0
- data/app/views/admin/shop/packages/edit/_form.html.haml +15 -0
- data/app/views/admin/shop/packages/edit/_head.html.haml +4 -0
- data/app/views/admin/shop/packages/edit/_inputs.html.haml +2 -0
- data/app/views/admin/shop/packages/edit/_meta.html.haml +8 -0
- data/app/views/admin/shop/packages/edit/_parts.html.haml +9 -0
- data/app/views/admin/shop/packages/edit/_popups.html.haml +4 -0
- data/app/views/admin/shop/packages/edit/buttons/_browse_products.html.haml +1 -0
- data/app/views/admin/shop/packages/edit/inputs/_name.html.haml +3 -0
- data/app/views/admin/shop/packages/edit/inputs/_price.html.haml +3 -0
- data/app/views/admin/shop/packages/edit/meta/_sku.html.haml +5 -0
- data/app/views/admin/shop/packages/edit/parts/_description.html.haml +1 -0
- data/app/views/admin/shop/packages/edit/parts/_products.html.haml +3 -0
- data/app/views/admin/shop/packages/edit/popups/_browse_products.html.haml +7 -0
- data/app/views/admin/shop/packages/edit/shared/_product.html.haml +8 -0
- data/app/views/admin/shop/packages/index.html.haml +13 -0
- data/app/views/admin/shop/packages/index/_foot.html.haml +7 -0
- data/app/views/admin/shop/packages/index/_head.html.haml +4 -0
- data/app/views/admin/shop/packages/index/_package.html.haml +9 -0
- data/app/views/admin/shop/packages/new.html.haml +11 -0
- data/app/views/admin/shop/packages/remove.html.haml +12 -0
- data/app/views/admin/shop/products/edit.html.haml +9 -12
- data/app/views/admin/shop/products/edit/_foot.html.haml +19 -0
- data/app/views/admin/shop/products/edit/_form.html.haml +15 -0
- data/app/views/admin/shop/products/edit/_head.html.haml +4 -2
- data/app/views/admin/shop/products/edit/_inputs.html.haml +2 -0
- data/app/views/admin/shop/products/edit/_meta.html.haml +8 -8
- data/app/views/admin/shop/products/edit/_parts.html.haml +9 -0
- data/app/views/admin/shop/products/edit/_popups.html.haml +4 -0
- data/app/views/admin/shop/products/edit/buttons/_browse_images.html.haml +1 -1
- data/app/views/admin/shop/products/edit/buttons/_browse_templates.html.haml +1 -0
- data/app/views/admin/shop/products/edit/buttons/_new_image.html.haml +1 -1
- data/app/views/admin/shop/products/edit/buttons/_new_variant.html.haml +1 -0
- data/app/views/admin/shop/products/edit/inputs/_name.html.haml +4 -0
- data/app/views/admin/shop/products/edit/inputs/_price.html.haml +3 -0
- data/app/views/admin/shop/products/edit/meta/_category.html.haml +6 -5
- data/app/views/admin/shop/products/edit/meta/_page.html.haml +2 -0
- data/app/views/admin/shop/products/edit/meta/_sku.html.haml +6 -5
- data/app/views/admin/shop/products/edit/parts/_customers.html.haml +5 -0
- data/app/views/admin/shop/products/edit/parts/_description.html.haml +4 -1
- data/app/views/admin/shop/products/edit/parts/_images.html.haml +1 -1
- data/app/views/admin/shop/products/edit/parts/_variants.html.haml +3 -0
- data/app/views/admin/shop/products/edit/popups/_browse_images.html.haml +1 -1
- data/app/views/admin/shop/products/edit/popups/_browse_templates.html.haml +6 -0
- data/app/views/admin/shop/products/edit/popups/_new_image.html.haml +4 -4
- data/app/views/admin/shop/products/edit/popups/_new_variant.html.haml +16 -0
- data/app/views/admin/shop/products/edit/{_image.html.haml → shared/_image.html.haml} +0 -0
- data/app/views/admin/shop/products/edit/shared/_template.html.haml +6 -0
- data/app/views/admin/shop/products/edit/shared/_variant.html.haml +10 -0
- data/app/views/admin/shop/products/index.html.haml +6 -3
- data/app/views/admin/shop/products/index/_foot.html.haml +10 -0
- data/app/views/admin/shop/products/index/_head.html.haml +4 -0
- data/app/views/admin/shop/products/index/_product.html.haml +18 -10
- data/app/views/admin/shop/products/index/buttons/_discounts.html.haml +1 -0
- data/app/views/admin/shop/products/index/buttons/_packages.html.haml +1 -0
- data/app/views/admin/shop/products/index/buttons/_variants.html.haml +1 -0
- data/app/views/admin/shop/products/new.html.haml +10 -9
- data/app/views/admin/shop/variants/edit.html.haml +11 -0
- data/app/views/admin/shop/variants/edit/_foot.html.haml +9 -0
- data/app/views/admin/shop/variants/edit/_form.html.haml +13 -0
- data/app/views/admin/shop/variants/edit/_head.html.haml +4 -0
- data/app/views/admin/shop/variants/edit/_inputs.html.haml +2 -0
- data/app/views/admin/shop/variants/edit/_meta.html.haml +8 -0
- data/app/views/admin/shop/variants/edit/_parts.html.haml +9 -0
- data/app/views/admin/shop/variants/edit/_popups.html.haml +4 -0
- data/app/views/admin/shop/variants/edit/inputs/_name.html.haml +3 -0
- data/app/views/admin/shop/variants/edit/inputs/_options.html.haml +3 -0
- data/app/views/admin/shop/variants/index.html.haml +13 -0
- data/app/views/admin/shop/variants/index/_foot.html.haml +4 -0
- data/app/views/admin/shop/variants/index/_head.html.haml +4 -0
- data/app/views/admin/shop/variants/index/_variant.html.haml +9 -0
- data/app/views/admin/shop/variants/new.html.haml +11 -0
- data/app/views/admin/shop/variants/remove.html.haml +12 -0
- data/config/locales/en.yml +8 -1
- data/config/routes.rb +11 -22
- data/db/migrate/20100929011106_fix_relationship_foreign_keys.rb +101 -0
- data/db/migrate/20100929011607_drop_shop_addressables.rb +25 -0
- data/db/migrate/20100929030510_create_shop_groups.rb +19 -0
- data/db/migrate/20100929080301_shop_groups_change_add_description.rb +11 -0
- data/db/migrate/20100929081200_create_variants.rb +20 -0
- data/db/migrate/20100929143531_change_variants_add_updated_by.rb +25 -0
- data/db/migrate/20100929145641_change_created_by_to_id.rb +75 -0
- data/db/migrate/20100929235221_change_category_add_variant_id.rb +9 -0
- data/db/migrate/20100930235221_create_packages.rb +31 -0
- data/db/migrate/20101005231713_create_page_ids.rb +11 -0
- data/db/migrate/20101006051214_create_pages_for_products_and_categories.rb +73 -0
- data/db/migrate/20101007111845_add_default_position_to_attachment.rb +9 -0
- data/lib/shop/controllers/application_controller.rb +1 -1
- data/lib/shop/interface/categories.rb +29 -0
- data/lib/shop/interface/customers.rb +15 -15
- data/lib/shop/interface/orders.rb +34 -0
- data/lib/shop/interface/packages.rb +34 -0
- data/lib/shop/interface/products.rb +18 -31
- data/lib/shop/interface/variants.rb +34 -0
- data/lib/shop/models/form_extension.rb +23 -0
- data/lib/shop/models/page.rb +3 -2
- data/lib/shop/tags/address.rb +3 -3
- data/lib/shop/tags/cart.rb +12 -16
- data/lib/shop/tags/category.rb +4 -6
- data/lib/shop/tags/helpers.rb +131 -30
- data/lib/shop/tags/item.rb +16 -33
- data/lib/shop/tags/package.rb +95 -0
- data/lib/shop/tags/product.rb +11 -16
- data/lib/shop/tags/product_variant.rb +52 -0
- data/mockups/discounts/new-edit.bmml +492 -0
- data/public/javascripts/admin/extensions/shop/edit.js +20 -0
- data/public/javascripts/admin/extensions/shop/packages/edit.js +109 -0
- data/public/javascripts/admin/extensions/shop/products/edit.js +64 -65
- data/public/javascripts/admin/extensions/shop/products/index.js +31 -36
- data/public/stylesheets/sass/admin/extensions/shop/edit.sass +58 -11
- data/public/stylesheets/sass/admin/extensions/shop/index.sass +104 -53
- data/public/stylesheets/sass/admin/extensions/shop/packages/edit.sass +162 -0
- data/public/stylesheets/sass/admin/extensions/shop/products/edit.sass +115 -36
- data/public/stylesheets/sass/admin/extensions/shop/products/index.sass +12 -20
- data/radiant-shop-extension.gemspec +182 -38
- data/shop_extension.rb +29 -25
- data/spec/controllers/admin/shop/categories_controller_spec.rb +76 -191
- data/spec/controllers/admin/shop/customers_controller_spec.rb +67 -0
- data/spec/controllers/admin/shop/orders_controller_spec.rb +85 -0
- data/spec/controllers/admin/shop/packages/packings_controller_spec.rb +188 -0
- data/spec/controllers/admin/shop/packages_controller_spec.rb +32 -0
- data/spec/controllers/admin/shop/products/images_controller_spec.rb +10 -15
- data/spec/controllers/admin/shop/products/variant_templates_controller_spec.rb +53 -0
- data/spec/controllers/admin/shop/products/variants_controller_spec.rb +116 -0
- data/spec/controllers/admin/shop/products_controller_spec.rb +80 -148
- data/spec/controllers/admin/shop/variants_controller_spec.rb +67 -0
- data/spec/datasets/forms.rb +23 -8
- data/spec/datasets/shop_addresses.rb +1 -4
- data/spec/datasets/shop_categories.rb +25 -4
- data/spec/datasets/shop_groups.rb +15 -0
- data/spec/datasets/shop_line_items.rb +4 -3
- data/spec/datasets/shop_orders.rb +6 -15
- data/spec/datasets/shop_packages.rb +25 -0
- data/spec/datasets/shop_payments.rb +12 -0
- data/spec/datasets/{images.rb → shop_product_attachments.rb} +9 -1
- data/spec/datasets/shop_product_variants.rb +22 -0
- data/spec/datasets/shop_products.rb +28 -18
- data/spec/datasets/shop_variants.rb +17 -0
- data/spec/lib/shop/models/image_spec.rb +4 -4
- data/spec/lib/shop/tags/address_spec.rb +3 -3
- data/spec/lib/shop/tags/cart_spec.rb +32 -43
- data/spec/lib/shop/tags/category_spec.rb +58 -93
- data/spec/lib/shop/tags/helpers_spec.rb +162 -69
- data/spec/lib/shop/tags/item_spec.rb +116 -158
- data/spec/lib/shop/tags/package_spec.rb +342 -0
- data/spec/lib/shop/tags/product_spec.rb +29 -26
- data/spec/lib/shop/tags/product_variant_spec.rb +175 -0
- data/spec/models/form_address_spec.rb +166 -0
- data/spec/models/form_checkout_spec.rb +27 -157
- data/spec/models/shop_address_spec.rb +81 -0
- data/spec/models/shop_category_spec.rb +114 -31
- data/spec/models/shop_customer_spec.rb +105 -0
- data/spec/models/shop_group_spec.rb +38 -0
- data/spec/models/shop_line_item_spec.rb +5 -5
- data/spec/models/shop_order_spec.rb +89 -83
- data/spec/models/shop_package_spec.rb +117 -0
- data/spec/models/shop_packing_spec.rb +67 -0
- data/spec/models/shop_payment_spec.rb +19 -0
- data/spec/models/shop_product_attachment_spec.rb +4 -3
- data/spec/models/shop_product_spec.rb +171 -92
- data/spec/models/shop_product_variant_spec.rb +92 -0
- data/spec/models/shop_variant_spec.rb +47 -0
- metadata +183 -39
- data/app/controllers/shop/categories_controller.rb +0 -45
- data/app/controllers/shop/line_items_controller.rb +0 -165
- data/app/controllers/shop/orders_controller.rb +0 -16
- data/app/controllers/shop/products_controller.rb +0 -48
- data/app/models/shop_addressable.rb +0 -11
- data/app/views/admin/shop/categories/edit/_fields.html.haml +0 -28
- data/app/views/admin/shop/categories/edit/_part.html.haml +0 -3
- data/app/views/admin/shop/categories/edit/_popup.html.haml +0 -3
- data/app/views/admin/shop/customers/edit/_fields.html.haml +0 -33
- data/app/views/admin/shop/customers/index/_bottom.html.haml +0 -4
- data/app/views/admin/shop/products/edit/_fields.html.haml +0 -38
- data/app/views/admin/shop/products/edit/_part.html.haml +0 -3
- data/app/views/admin/shop/products/edit/_popup.html.haml +0 -3
- data/app/views/admin/shop/products/index/_bottom.html.haml +0 -5
- data/spec/controllers/shop/categories_controller_spec.rb +0 -42
- data/spec/controllers/shop/line_items_controller_spec.rb +0 -256
- data/spec/controllers/shop/orders_controller_specs.rb +0 -37
- data/spec/controllers/shop/products_controller_spec.rb +0 -51
- data/vendor/plugins/json_fields/.gitignore +0 -3
- data/vendor/plugins/json_fields/MIT-LICENSE +0 -20
- data/vendor/plugins/json_fields/README.rdoc +0 -65
- data/vendor/plugins/json_fields/Rakefile +0 -55
- data/vendor/plugins/json_fields/init.rb +0 -2
- data/vendor/plugins/json_fields/lib/json_fields.rb +0 -99
- data/vendor/plugins/json_fields/spec/lib/json_fields_spec.rb +0 -124
- data/vendor/plugins/json_fields/spec/spec.opts +0 -6
- data/vendor/plugins/json_fields/spec/spec_helper.rb +0 -29
- data/vendor/plugins/json_fields/spec/test_models.rb +0 -12
@@ -0,0 +1,11 @@
|
|
1
|
+
class ShopGroupsChangeAddDescription < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
add_column :shop_groups, :description, :text
|
4
|
+
add_column :pages, :shop_group_id, :integer
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.down
|
8
|
+
remove_column :shop_groups, :description
|
9
|
+
remove_column :pages, :shop_group_id
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class CreateVariants < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :shop_variants do |t|
|
4
|
+
t.string :name
|
5
|
+
t.text :options_json
|
6
|
+
end
|
7
|
+
|
8
|
+
create_table :shop_product_variants do |t|
|
9
|
+
t.string :name
|
10
|
+
t.decimal :price
|
11
|
+
|
12
|
+
t.integer :product_id
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.down
|
17
|
+
remove_table :shop_variants
|
18
|
+
remove_table :shop_product_variants
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class ChangeVariantsAddUpdatedBy < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
add_column :shop_variants, :created_by_id, :integer
|
4
|
+
add_column :shop_variants, :updated_by_id, :integer
|
5
|
+
add_column :shop_variants, :created_at, :datetime
|
6
|
+
add_column :shop_variants, :updated_at, :datetime
|
7
|
+
|
8
|
+
add_column :shop_groups, :created_by_id, :integer
|
9
|
+
add_column :shop_groups, :updated_by_id, :integer
|
10
|
+
add_column :shop_groups, :created_at, :datetime
|
11
|
+
add_column :shop_groups, :updated_at, :datetime
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.down
|
15
|
+
remove_column :shop_variants, :created_by_id
|
16
|
+
remove_column :shop_variants, :created_by_id
|
17
|
+
remove_column :shop_variants, :created_at
|
18
|
+
remove_column :shop_variants, :updated_at
|
19
|
+
|
20
|
+
remove_column :shop_groups, :created_by_id
|
21
|
+
remove_column :shop_groups, :created_by_id
|
22
|
+
remove_column :shop_groups, :created_at
|
23
|
+
remove_column :shop_groups, :updated_at
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
class ChangeCreatedByToId < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
add_column :shop_products, :created_by_id, :integer
|
4
|
+
add_column :shop_products, :updated_by_id, :integer
|
5
|
+
remove_column :shop_products, :created_by
|
6
|
+
remove_column :shop_products, :updated_by
|
7
|
+
|
8
|
+
add_column :shop_categories, :created_by_id, :integer
|
9
|
+
add_column :shop_categories, :updated_by_id, :integer
|
10
|
+
remove_column :shop_categories, :created_by
|
11
|
+
remove_column :shop_categories, :updated_by
|
12
|
+
|
13
|
+
add_column :shop_product_attachments, :created_by_id, :integer
|
14
|
+
add_column :shop_product_attachments, :updated_by_id, :integer
|
15
|
+
remove_column :shop_product_attachments, :created_by
|
16
|
+
remove_column :shop_product_attachments, :updated_by
|
17
|
+
|
18
|
+
add_column :shop_addresses, :created_by_id, :integer
|
19
|
+
add_column :shop_addresses, :updated_by_id, :integer
|
20
|
+
add_column :shop_addresses, :created_at, :datetime
|
21
|
+
add_column :shop_addresses, :updated_at, :datetime
|
22
|
+
|
23
|
+
add_column :shop_orders, :created_by_id, :integer
|
24
|
+
add_column :shop_orders, :updated_by_id, :integer
|
25
|
+
remove_column :shop_orders, :created_by
|
26
|
+
remove_column :shop_orders, :updated_by
|
27
|
+
|
28
|
+
add_column :shop_line_items, :created_by_id, :integer
|
29
|
+
add_column :shop_line_items, :updated_by_id, :integer
|
30
|
+
remove_column :shop_line_items, :created_by
|
31
|
+
remove_column :shop_line_items, :updated_by
|
32
|
+
|
33
|
+
add_column :shop_payments, :created_by_id, :integer
|
34
|
+
add_column :shop_payments, :updated_by_id, :integer
|
35
|
+
remove_column :shop_payments, :created_by
|
36
|
+
remove_column :shop_payments, :updated_by
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.down
|
40
|
+
remove_column :shop_products, :created_by_id, :integer
|
41
|
+
remove_column :shop_products, :updated_by_id, :integer
|
42
|
+
add_column :shop_products, :created_by, :integer
|
43
|
+
add_column :shop_products, :updated_by, :integer
|
44
|
+
|
45
|
+
remove_column :shop_categories, :created_by_id, :integer
|
46
|
+
remove_column :shop_categories, :updated_by_id, :integer
|
47
|
+
add_column :shop_categories, :created_by, :integer
|
48
|
+
add_column :shop_categories, :updated_by, :integer
|
49
|
+
|
50
|
+
remove_column :shop_product_attachments, :created_by_id, :integer
|
51
|
+
remove_column :shop_product_attachments, :updated_by_id, :integer
|
52
|
+
add_column :shop_product_attachments, :created_by, :integer
|
53
|
+
add_column :shop_product_attachments, :updated_by, :integer
|
54
|
+
|
55
|
+
remove_column :shop_addresses, :created_by_id
|
56
|
+
remove_column :shop_addresses, :updated_by_id
|
57
|
+
remove_column :shop_addresses, :created_at
|
58
|
+
remove_column :shop_addresses, :updated_at
|
59
|
+
|
60
|
+
remove_column :shop_orders, :created_by_id
|
61
|
+
remove_column :shop_orders, :updated_by_id
|
62
|
+
add_column :shop_orders, :created_by, :integer
|
63
|
+
add_column :shop_orders, :updated_by, :integer
|
64
|
+
|
65
|
+
remove_column :shop_line_items, :created_by_id
|
66
|
+
remove_column :shop_line_items, :updated_by_id
|
67
|
+
add_column :shop_line_items, :created_by, :integer
|
68
|
+
add_column :shop_line_items, :updated_by, :integer
|
69
|
+
|
70
|
+
remove_column :shop_payments, :created_by_id
|
71
|
+
remove_column :shop_payments, :updated_by_id
|
72
|
+
add_column :shop_payments, :created_by, :integer
|
73
|
+
add_column :shop_payments, :updated_by, :integer
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
class CreatePackages < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :shop_packages do |t|
|
4
|
+
t.string :name
|
5
|
+
t.string :sku
|
6
|
+
t.text :description
|
7
|
+
t.boolean :is_active, :default => true
|
8
|
+
|
9
|
+
t.decimal :price
|
10
|
+
|
11
|
+
t.integer :created_by
|
12
|
+
t.integer :updated_by
|
13
|
+
|
14
|
+
t.timestamps
|
15
|
+
end
|
16
|
+
|
17
|
+
create_table :shop_packings do |t|
|
18
|
+
t.integer :quantity, :default => 1
|
19
|
+
t.integer :position
|
20
|
+
|
21
|
+
t.integer :product_id
|
22
|
+
t.integer :package_id
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.down
|
28
|
+
drop_table :shop_packages
|
29
|
+
drop_table :shop_packings
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class CreatePageIds < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
add_column :shop_products, :page_id, :integer
|
4
|
+
add_column :shop_categories, :page_id, :integer
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.down
|
8
|
+
remove_column :shop_products, :page_id, :integer
|
9
|
+
remove_column :shop_categories, :page_id, :integer
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
class CreatePagesForProductsAndCategories < ActiveRecord::Migration
|
2
|
+
|
3
|
+
class ShopProduct < ActiveRecord::Base
|
4
|
+
belongs_to :page
|
5
|
+
belongs_to :category, :class_name => 'ShopCategory', :foreign_key => :category_id
|
6
|
+
accepts_nested_attributes_for :page
|
7
|
+
end
|
8
|
+
|
9
|
+
class ShopCategory < ActiveRecord::Base
|
10
|
+
belongs_to :page
|
11
|
+
|
12
|
+
accepts_nested_attributes_for :page
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.up
|
16
|
+
ShopCategory.all.each do |c|
|
17
|
+
c.update_attributes(
|
18
|
+
:page => Page.create(
|
19
|
+
:title => c.name,
|
20
|
+
:slug => c.handle,
|
21
|
+
:breadcrumb => c.handle,
|
22
|
+
:status_id => 100,
|
23
|
+
:parent_id => Radiant::Config['shop.root_page_id'],
|
24
|
+
:layout_id => c.layout_id,
|
25
|
+
:class_name => 'ShopCategoryPage',
|
26
|
+
:published_at => Time.now,
|
27
|
+
:parts => [PagePart.create(
|
28
|
+
:name => 'description',
|
29
|
+
:content => c.description
|
30
|
+
)]
|
31
|
+
)
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
35
|
+
ShopProduct.all.each do |p|
|
36
|
+
p.update_attributes(
|
37
|
+
:page => Page.create(
|
38
|
+
:title => p.name,
|
39
|
+
:slug => p.sku,
|
40
|
+
:breadcrumb => p.sku,
|
41
|
+
:status_id => 100,
|
42
|
+
:parent_id => ShopCategory.find(p.category_id).page_id,
|
43
|
+
:layout_id => p.category.product_layout_id,
|
44
|
+
:class_name => 'ShopProductPage',
|
45
|
+
:published_at => Time.now,
|
46
|
+
:parts => [PagePart.create(
|
47
|
+
:name => 'description',
|
48
|
+
:content => p.description
|
49
|
+
)]
|
50
|
+
)
|
51
|
+
)
|
52
|
+
end
|
53
|
+
|
54
|
+
remove_column :shop_products, :name
|
55
|
+
remove_column :shop_products, :sku
|
56
|
+
remove_column :shop_products, :description
|
57
|
+
remove_column :shop_products, :is_active
|
58
|
+
remove_column :shop_products, :position
|
59
|
+
remove_column :shop_products, :category_id
|
60
|
+
remove_column :shop_products, :layout_id
|
61
|
+
|
62
|
+
remove_column :shop_categories, :name
|
63
|
+
remove_column :shop_categories, :handle
|
64
|
+
remove_column :shop_categories, :description
|
65
|
+
remove_column :shop_categories, :layout_id
|
66
|
+
remove_column :shop_categories, :position
|
67
|
+
remove_column :shop_categories, :is_active
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.down
|
71
|
+
# There is no going back from this adventure
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class AddDefaultPositionToAttachment < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
change_column :shop_product_attachments, :position, :integer, :default => 1, :allow_null => false
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.down
|
7
|
+
change_column :shop_product_attachments, :position, :integer
|
8
|
+
end
|
9
|
+
end
|
@@ -25,7 +25,7 @@ module Shop
|
|
25
25
|
if find_shop_order and find_shop_order.status != 'paid'
|
26
26
|
shop_order = find_shop_order
|
27
27
|
else
|
28
|
-
shop_order = ShopOrder.create
|
28
|
+
shop_order = ShopOrder.create({ :customer_id => (current_user.id rescue nil) })
|
29
29
|
request.session[:shop_order] = shop_order.id
|
30
30
|
end
|
31
31
|
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Shop
|
2
|
+
module Interface
|
3
|
+
module Categories
|
4
|
+
|
5
|
+
def self.included(base)
|
6
|
+
base.send :include, InstanceMethods
|
7
|
+
end
|
8
|
+
|
9
|
+
module InstanceMethods
|
10
|
+
attr_accessor :categories
|
11
|
+
|
12
|
+
protected
|
13
|
+
|
14
|
+
def load_default_shop_categories_regions
|
15
|
+
returning OpenStruct.new do |categories|
|
16
|
+
categories.edit = Radiant::AdminUI::RegionSet.new do |edit|
|
17
|
+
edit.main.concat %w{head form popups}
|
18
|
+
edit.form.concat %w{inputs meta parts foot}
|
19
|
+
edit.foot.concat %w{buttons timestamp}
|
20
|
+
end
|
21
|
+
categories.new = categories.edit
|
22
|
+
categories.remove = categories.index
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -10,23 +10,23 @@ module Shop
|
|
10
10
|
attr_accessor :customers
|
11
11
|
|
12
12
|
protected
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
customers.new = customers.edit
|
21
|
-
customers.index = Radiant::AdminUI::RegionSet.new do |index|
|
22
|
-
index.top
|
23
|
-
index.bottom.concat %w{ add }
|
24
|
-
index.thead.concat %w{ name modify }
|
25
|
-
index.customer.concat %w{ name modify }
|
26
|
-
end
|
27
|
-
customers.remove = customers.index
|
13
|
+
|
14
|
+
def load_default_shop_customers_regions
|
15
|
+
returning OpenStruct.new do |customers|
|
16
|
+
customers.edit = Radiant::AdminUI::RegionSet.new do |edit|
|
17
|
+
edit.main.concat %w{head form popups}
|
18
|
+
edit.form.concat %w{inputs meta parts foot}
|
19
|
+
edit.foot.concat %w{buttons timestamp}
|
28
20
|
end
|
21
|
+
customers.new = customers.edit
|
22
|
+
customers.index = Radiant::AdminUI::RegionSet.new do |index|
|
23
|
+
index.head.concat %w{buttons}
|
24
|
+
index.body.concat %w{name modify}
|
25
|
+
index.foot.concat %w{add}
|
26
|
+
end
|
27
|
+
customers.remove = customers.index
|
29
28
|
end
|
29
|
+
end
|
30
30
|
end
|
31
31
|
|
32
32
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Shop
|
2
|
+
module Interface
|
3
|
+
module Orders
|
4
|
+
|
5
|
+
def self.included(base)
|
6
|
+
base.send :include, InstanceMethods
|
7
|
+
end
|
8
|
+
|
9
|
+
module InstanceMethods
|
10
|
+
attr_accessor :orders
|
11
|
+
|
12
|
+
protected
|
13
|
+
|
14
|
+
def load_default_shop_orders_regions
|
15
|
+
returning OpenStruct.new do |orders|
|
16
|
+
orders.edit = Radiant::AdminUI::RegionSet.new do |edit|
|
17
|
+
edit.main.concat %w{head form popups}
|
18
|
+
edit.form.concat %w{inputs meta parts foot}
|
19
|
+
edit.foot.concat %w{buttons timestamp}
|
20
|
+
end
|
21
|
+
orders.new = orders.edit
|
22
|
+
orders.index = Radiant::AdminUI::RegionSet.new do |index|
|
23
|
+
index.head.concat %w{buttons}
|
24
|
+
index.body.concat %w{price status updated customer}
|
25
|
+
index.foot.concat %w{}
|
26
|
+
end
|
27
|
+
orders.remove = orders.index
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Shop
|
2
|
+
module Interface
|
3
|
+
module Packages
|
4
|
+
|
5
|
+
def self.included(base)
|
6
|
+
base.send :include, InstanceMethods
|
7
|
+
end
|
8
|
+
|
9
|
+
module InstanceMethods
|
10
|
+
attr_accessor :packages
|
11
|
+
|
12
|
+
protected
|
13
|
+
|
14
|
+
def load_default_shop_packages_regions
|
15
|
+
returning OpenStruct.new do |packages|
|
16
|
+
packages.edit = Radiant::AdminUI::RegionSet.new do |edit|
|
17
|
+
edit.main.concat %w{head form popups}
|
18
|
+
edit.form.concat %w{inputs meta parts foot}
|
19
|
+
edit.foot.concat %w{buttons timestamp}
|
20
|
+
end
|
21
|
+
packages.new = packages.edit
|
22
|
+
packages.index = Radiant::AdminUI::RegionSet.new do |index|
|
23
|
+
index.head.concat %w{buttons}
|
24
|
+
index.body.concat %w{name modify}
|
25
|
+
index.foot.concat %w{add}
|
26
|
+
end
|
27
|
+
packages.remove = packages.index
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -7,41 +7,28 @@ module Shop
|
|
7
7
|
end
|
8
8
|
|
9
9
|
module InstanceMethods
|
10
|
-
attr_accessor :products
|
10
|
+
attr_accessor :products
|
11
11
|
|
12
12
|
protected
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
end
|
21
|
-
products.new = products.edit
|
22
|
-
products.index = Radiant::AdminUI::RegionSet.new do |index|
|
23
|
-
index.top
|
24
|
-
index.bottom.concat %w{ add_category }
|
25
|
-
index.thead.concat %w{ name_header description_header modify_header }
|
26
|
-
index.category_attributes.concat %w{ category_name category_description category_modify }
|
27
|
-
index.category_products.concat %w{ category_products }
|
28
|
-
index.product.concat %w{ product_name product_modify }
|
29
|
-
end
|
30
|
-
products.remove = products.index
|
13
|
+
|
14
|
+
def load_default_shop_products_regions
|
15
|
+
returning OpenStruct.new do |products|
|
16
|
+
products.edit = Radiant::AdminUI::RegionSet.new do |edit|
|
17
|
+
edit.main.concat %w{head form popups}
|
18
|
+
edit.form.concat %w{inputs meta parts foot}
|
19
|
+
edit.foot.concat %w{buttons timestamp}
|
31
20
|
end
|
21
|
+
products.new = products.edit
|
22
|
+
products.index = Radiant::AdminUI::RegionSet.new do |index|
|
23
|
+
index.head.concat %w{buttons}
|
24
|
+
index.category.concat %w{move name handle modify}
|
25
|
+
index.products.concat %w{body}
|
26
|
+
index.product.concat %w{move icon name sku modify}
|
27
|
+
index.foot.concat %w{add}
|
28
|
+
end
|
29
|
+
products.remove = products.index
|
32
30
|
end
|
33
|
-
|
34
|
-
def load_default_shop_categories_regions
|
35
|
-
returning OpenStruct.new do |categories|
|
36
|
-
categories.edit = Radiant::AdminUI::RegionSet.new do |edit|
|
37
|
-
edit.main.concat %w{edit_header edit_form edit_popups}
|
38
|
-
edit.form.concat %w{edit_name edit_extended_metadata edit_content}
|
39
|
-
edit.form_bottom.concat %w{edit_buttons edit_timestamp}
|
40
|
-
end
|
41
|
-
categories.new = categories.edit
|
42
|
-
categories.remove = categories.index
|
43
|
-
end
|
44
|
-
end
|
31
|
+
end
|
45
32
|
end
|
46
33
|
|
47
34
|
end
|