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
data/README.md
CHANGED
@@ -29,4 +29,8 @@ pppps: love heart
|
|
29
29
|
config.gem 'ruby-debug', :version => '0.10.3'
|
30
30
|
config.gem 'webrat', :version => '0.7.1'
|
31
31
|
config.gem 'rr', :version => '0.10.11'
|
32
|
-
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# Migrating in Development
|
35
|
+
|
36
|
+
rm db/development.sqlite3.db; rake db:migrate; rake radiant:extensions:scoped:migrate; rake radiant:extensions:settings:migrate; rake radiant:extensions:drag:migrate; rake radiant:extensions:forms:migrate; rake radiant:extensions:images:migrate; rake radiant:extensions:shop:migrate; rake radiant:extensions:shop_mg:migrate; rake radiant:extensions:export:load;
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.11.0
|
@@ -7,34 +7,17 @@ class Admin::Shop::CategoriesController < Admin::ResourceController
|
|
7
7
|
before_filter :config_edit, :only => [ :edit, :update ]
|
8
8
|
before_filter :assets_global
|
9
9
|
|
10
|
-
before_filter :
|
10
|
+
before_filter :set_layouts_and_page, :only => [ :new ]
|
11
11
|
|
12
12
|
# GET /admin/shop/products/categories
|
13
13
|
# GET /admin/shop/products/categories.js
|
14
14
|
# GET /admin/shop/products/categories.json AJAX and HTML
|
15
15
|
#----------------------------------------------------------------------------
|
16
16
|
def index
|
17
|
-
@shop_categories = ShopCategory.search(params[:search])
|
18
|
-
|
19
17
|
respond_to do |format|
|
20
18
|
format.html { redirect_to admin_shop_products_path }
|
21
|
-
format.js { render
|
22
|
-
format.json { render
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
# GET /admin/shop/products/categories/1/products
|
27
|
-
# GET /admin/shop/products/categories/1/products.js
|
28
|
-
# GET /admin/shop/products/categories/1/products.json AJAX and HTML
|
29
|
-
#----------------------------------------------------------------------------
|
30
|
-
def products
|
31
|
-
@shop_category = ShopCategory.find(params[:id])
|
32
|
-
@shop_products = @shop_category.products
|
33
|
-
|
34
|
-
respond_to do |format|
|
35
|
-
format.html { render :template => '/admin/shop/products/index' }
|
36
|
-
format.js { render :partial => '/admin/shop/products/index/product', :collection => @shop_products }
|
37
|
-
format.json { render :json => @shop_products.to_json(ShopProduct.params) }
|
19
|
+
format.js { render :partial => '/admin/shop/categories/index/category', :collection => @shop_categories }
|
20
|
+
format.json { render :json => @shop_categories.to_json }
|
38
21
|
end
|
39
22
|
end
|
40
23
|
|
@@ -47,15 +30,10 @@ class Admin::Shop::CategoriesController < Admin::ResourceController
|
|
47
30
|
error = 'Could not sort Categories.'
|
48
31
|
|
49
32
|
begin
|
50
|
-
|
51
|
-
|
52
|
-
@shop_categories.each_with_index do |id, index|
|
53
|
-
ShopCategory.find(id).update_attributes!({:position => index+1})
|
54
|
-
end
|
33
|
+
ShopCategory.sort(CGI::parse(params[:categories])["categories[]"])
|
55
34
|
|
56
35
|
respond_to do |format|
|
57
36
|
format.html {
|
58
|
-
flash[:notice] = notice
|
59
37
|
redirect_to admin_shop_products_path
|
60
38
|
}
|
61
39
|
format.js { render :text => notice, :status => :ok }
|
@@ -87,14 +65,12 @@ class Admin::Shop::CategoriesController < Admin::ResourceController
|
|
87
65
|
@shop_category.save!
|
88
66
|
|
89
67
|
respond_to do |format|
|
90
|
-
format.html {
|
91
|
-
|
92
|
-
|
93
|
-
redirect_to edit_admin_shop_category_path(@shop_category) if params[:continue]
|
68
|
+
format.html {
|
69
|
+
redirect_to [:edit_admin, @shop_category] if params[:continue]
|
94
70
|
redirect_to admin_shop_categories_path unless params[:continue]
|
95
71
|
}
|
96
72
|
format.js { render :partial => '/admin/shop/categories/index/category', :locals => { :product => @shop_category } }
|
97
|
-
format.json { render :json => @shop_category.to_json
|
73
|
+
format.json { render :json => @shop_category.to_json }
|
98
74
|
end
|
99
75
|
rescue
|
100
76
|
respond_to do |format|
|
@@ -120,13 +96,12 @@ class Admin::Shop::CategoriesController < Admin::ResourceController
|
|
120
96
|
@shop_category.update_attributes!(params[:shop_category])
|
121
97
|
|
122
98
|
respond_to do |format|
|
123
|
-
format.html {
|
124
|
-
flash[:notice] = notice
|
99
|
+
format.html {
|
125
100
|
redirect_to edit_admin_shop_category_path(@shop_category) if params[:continue]
|
126
101
|
redirect_to admin_shop_categories_path unless params[:continue]
|
127
102
|
}
|
128
103
|
format.js { render :partial => '/admin/shop/categories/index/category', :locals => { :product => @shop_category } }
|
129
|
-
format.json { render :json => @shop_category.to_json
|
104
|
+
format.json { render :json => @shop_category.to_json }
|
130
105
|
end
|
131
106
|
rescue
|
132
107
|
respond_to do |format|
|
@@ -146,60 +121,52 @@ class Admin::Shop::CategoriesController < Admin::ResourceController
|
|
146
121
|
#----------------------------------------------------------------------------
|
147
122
|
def destroy
|
148
123
|
notice = 'Category deleted successfully.'
|
149
|
-
error = 'Could not delete Category.'
|
150
124
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
format.js { render :text => notice, :status => :ok }
|
160
|
-
format.json { render :json => { :notice => notice }, :status => :ok }
|
161
|
-
end
|
162
|
-
rescue
|
163
|
-
respond_to do |format|
|
164
|
-
format.html {
|
165
|
-
flash[:error] = error
|
166
|
-
render :remove
|
167
|
-
}
|
168
|
-
format.js { render :text => error, :status => :unprocessable_entity }
|
169
|
-
format.json { render :json => { :error => error }, :status => :unprocessable_entity }
|
170
|
-
end
|
125
|
+
@shop_category.destroy
|
126
|
+
|
127
|
+
respond_to do |format|
|
128
|
+
format.html {
|
129
|
+
redirect_to admin_shop_categories_path
|
130
|
+
}
|
131
|
+
format.js { render :text => notice, :status => :ok }
|
132
|
+
format.json { render :json => { :notice => notice }, :status => :ok }
|
171
133
|
end
|
172
134
|
end
|
173
135
|
|
174
136
|
private
|
175
137
|
|
176
138
|
def config_global
|
139
|
+
@inputs ||= []
|
177
140
|
@meta ||= []
|
178
141
|
@buttons ||= []
|
179
142
|
@parts ||= []
|
180
143
|
@popups ||= []
|
144
|
+
|
145
|
+
@inputs << 'name'
|
146
|
+
|
147
|
+
@meta << 'handle'
|
148
|
+
@meta << 'layouts'
|
149
|
+
@meta << 'page'
|
150
|
+
|
151
|
+
@parts << 'description'
|
181
152
|
end
|
182
153
|
|
183
154
|
def config_new
|
184
|
-
@meta << 'layouts'
|
185
|
-
@meta << 'handle'
|
186
|
-
|
187
|
-
@parts << 'description'
|
188
155
|
end
|
189
156
|
|
190
157
|
def config_edit
|
191
|
-
@meta << 'layouts'
|
192
|
-
@meta << 'handle'
|
193
|
-
|
194
|
-
@parts << 'description'
|
195
158
|
end
|
196
159
|
|
197
160
|
def assets_global
|
198
161
|
include_stylesheet 'admin/extensions/shop/edit'
|
199
162
|
end
|
200
163
|
|
201
|
-
def
|
202
|
-
@shop_category.
|
164
|
+
def set_layouts_and_page
|
165
|
+
@shop_category.page = Page.new(
|
166
|
+
:layout_id => Layout.find_by_name(Radiant::Config['shop.layout_category']).id,
|
167
|
+
:parent_id => Radiant::Config['shop.root_page_id'],
|
168
|
+
:parts => [PagePart.new]
|
169
|
+
)
|
203
170
|
@shop_category.product_layout = Layout.find_by_name(Radiant::Config['shop.product_layout'])
|
204
171
|
end
|
205
172
|
|
@@ -11,23 +11,24 @@ class Admin::Shop::CustomersController < Admin::ResourceController
|
|
11
11
|
private
|
12
12
|
|
13
13
|
def config_global
|
14
|
+
@inputs ||= []
|
14
15
|
@meta ||= []
|
15
16
|
@buttons ||= []
|
16
17
|
@parts ||= []
|
17
18
|
@popups ||= []
|
19
|
+
|
20
|
+
@inputs << 'name'
|
21
|
+
@inputs << 'email'
|
22
|
+
|
23
|
+
@meta << 'login'
|
24
|
+
@meta << 'password'
|
25
|
+
@meta << 'password_confirmation'
|
18
26
|
end
|
19
27
|
|
20
28
|
def config_new
|
21
|
-
@meta << 'login'
|
22
|
-
@meta << 'password'
|
23
|
-
@meta << 'password_confirmation'
|
24
29
|
end
|
25
30
|
|
26
31
|
def config_edit
|
27
|
-
@meta << 'login'
|
28
|
-
@meta << 'password'
|
29
|
-
@meta << 'password_confirmation'
|
30
|
-
|
31
32
|
@parts << 'orders'
|
32
33
|
@parts << 'addresses'
|
33
34
|
end
|
@@ -1,171 +1,49 @@
|
|
1
1
|
class Admin::Shop::OrdersController < Admin::ResourceController
|
2
2
|
model_class ShopOrder
|
3
|
+
|
4
|
+
before_filter :config_global
|
5
|
+
before_filter :config_index, :only => [ :index ]
|
6
|
+
before_filter :config_new, :only => [ :new, :create ]
|
7
|
+
before_filter :config_edit, :only => [ :edit, :update ]
|
8
|
+
before_filter :assets_global
|
9
|
+
before_filter :assets_index, :only => [ :index ]
|
10
|
+
before_filter :assets_edit, :only => [ :edit, :update ]
|
3
11
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
attr_hash = {
|
14
|
-
:methods => [:sub_total, :balance],
|
15
|
-
:include => {
|
16
|
-
:customer => {
|
17
|
-
:include => {
|
18
|
-
:addresses => {:only => [ :street, :city, :state, :zip, :country, :unit, :atype ]}
|
19
|
-
},
|
20
|
-
:only => [:id, :name, :email, :organization]
|
21
|
-
},
|
22
|
-
:line_items => {
|
23
|
-
:methods => [:total],
|
24
|
-
:include => {
|
25
|
-
:product => {:only => [:id, :sku, :description, :handle, :price, :title]},
|
26
|
-
},
|
27
|
-
:only => [:id, :quantity]
|
28
|
-
}
|
29
|
-
},
|
30
|
-
:only => [:id, :status, :created_at, :updated_at]
|
31
|
-
}
|
12
|
+
private
|
13
|
+
|
14
|
+
def config_global
|
15
|
+
@inputs ||= []
|
16
|
+
@meta ||= []
|
17
|
+
@buttons ||= []
|
18
|
+
@parts ||= []
|
19
|
+
@popups ||= []
|
20
|
+
end
|
32
21
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
22
|
+
def config_index
|
23
|
+
@buttons << 'shipped'
|
24
|
+
@buttons << 'paid'
|
25
|
+
@buttons << 'new'
|
26
|
+
@buttons << 'all'
|
38
27
|
end
|
39
|
-
|
40
|
-
|
41
|
-
# GET /admin/shop/orders/1
|
42
|
-
# GET /admin/shop/orders/1.js
|
43
|
-
# GET /admin/shop/orders/1.xml
|
44
|
-
# GET /admin/shop/orders/1.json AJAX and HTML
|
45
|
-
#----------------------------------------------------------------------------
|
46
|
-
def show
|
47
|
-
@shop_order = ShopOrder.find(params[:id])
|
48
|
-
attr_hash = {
|
49
|
-
:methods => [:sub_total, :balance],
|
50
|
-
:include => {
|
51
|
-
:customer => {
|
52
|
-
:include => {
|
53
|
-
:addresses => {:only => [ :street, :city, :state, :zip, :country, :unit, :atype ]}
|
54
|
-
},
|
55
|
-
:only => [:id, :name, :email, :organization]
|
56
|
-
},
|
57
|
-
:line_items => {
|
58
|
-
:methods => [:total],
|
59
|
-
:include => {
|
60
|
-
:product => {:only => [:id, :sku, :description, :handle, :price, :title]},
|
61
|
-
},
|
62
|
-
:only => [:id, :quantity]
|
63
|
-
}
|
64
|
-
},
|
65
|
-
:only => [:id, :status, :created_at, :updated_at]
|
66
|
-
}
|
67
|
-
respond_to do |format|
|
68
|
-
format.html { render }
|
69
|
-
format.js { render :partial => '/admin/shop/orders/order', :locals => { :order => @shop_order } }
|
70
|
-
format.xml { render :xml => @shop_order.to_xml(attr_hash) }
|
71
|
-
format.json { render :json => @shop_order.to_json(attr_hash) }
|
28
|
+
|
29
|
+
def config_new
|
72
30
|
end
|
73
|
-
end
|
74
|
-
|
75
|
-
# POST /admin/shop/orders
|
76
|
-
# POST /admin/shop/orders.js
|
77
|
-
# POST /admin/shop/orders.xml
|
78
|
-
# POST /admin/shop/orders.json AJAX and HTML
|
79
|
-
#----------------------------------------------------------------------------
|
80
|
-
def create
|
81
|
-
@shop_order = ShopOrder.new(params[:shop_order])
|
82
31
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
redirect_to admin_shop_orders_path
|
88
|
-
}
|
89
|
-
format.js { render :partial => '/admin/shop/orders/excerpt', :locals => { :excerpt => @shop_order } }
|
90
|
-
format.xml { redirect_to "/admin/shop/orders/#{@shop_order.id}.xml" }
|
91
|
-
format.json { redirect_to "/admin/shop/orders/#{@shop_order.id}.json" }
|
92
|
-
end
|
93
|
-
else
|
94
|
-
respond_to do |format|
|
95
|
-
format.html {
|
96
|
-
flash[:error] = "Unable to create new customer."
|
97
|
-
render
|
98
|
-
}
|
99
|
-
format.js { render :text => @shop_order.errors.to_json, :status => :unprocessable_entity }
|
100
|
-
format.xml { render :xml => @shop_order.errors.to_xml, :status => :unprocessable_entity }
|
101
|
-
format.json { render :json => @shop_order.errors.to_json, :status => :unprocessable_entity }
|
102
|
-
end
|
32
|
+
def config_edit
|
33
|
+
@parts << 'items'
|
34
|
+
@parts << 'addresses' if @shop_order.billing.present?
|
35
|
+
@parts << 'customer' if @shop_order.customer.present?
|
103
36
|
end
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
# PUT /shop/orders/1.json AJAX and HTML
|
109
|
-
#-----------------------------------------------------------------------------
|
110
|
-
def update
|
111
|
-
@shop_order = ShopOrder.find(params[:id])
|
112
|
-
if @shop_order.update_attributes!(params[:shop_order])
|
113
|
-
respond_to do |format|
|
114
|
-
format.html {
|
115
|
-
flash[:notice] = "Order updated successfully."
|
116
|
-
redirect_to admin_shop_customers_path
|
117
|
-
}
|
118
|
-
format.js { render :partial => '/admin/shop/orders/excerpt', :locals => { :excerpt => @shop_order } }
|
119
|
-
format.xml { redirect_to "/admin/shop/orders/#{@shop_order.id}.xml" }
|
120
|
-
format.json { redirect_to "/admin/shop/orders/#{@shop_order.id}.json" }
|
121
|
-
end
|
122
|
-
else
|
123
|
-
respond_to do |format|
|
124
|
-
format.html {
|
125
|
-
flash[:error] = "Unable to update order."
|
126
|
-
render
|
127
|
-
}
|
128
|
-
format.js { render :text => @shop_order.errors.to_s, :status => :unprocessable_entity }
|
129
|
-
format.xml { render :xml => @shop_order.errors.to_xml, :status => :unprocessable_entity }
|
130
|
-
format.json { render :json => @shop_order.errors.to_json, :status => :unprocessable_entity }
|
131
|
-
end
|
37
|
+
|
38
|
+
def assets_global
|
39
|
+
include_stylesheet 'admin/extensions/shop/edit'
|
40
|
+
include_stylesheet 'admin/extensions/shop/index'
|
132
41
|
end
|
133
|
-
end
|
134
|
-
|
135
|
-
# DELETE /admin/shop/orders/1
|
136
|
-
# DELETE /admin/shop/orders/1.js
|
137
|
-
# DELETE /admin/shop/orders/1.xml
|
138
|
-
# DELETE /admin/shop/orders/1.json AJAX and HTML
|
139
|
-
#----------------------------------------------------------------------------
|
140
|
-
def destroy
|
141
|
-
# Need to rewrite this method to check for errors and return xml or json.
|
142
|
-
# For some reason the answer isn't obvious to me.
|
143
|
-
@shop_order = ShopOrder.find(params[:id])
|
144
42
|
|
145
|
-
|
146
|
-
@message = "Order deleted successfully."
|
147
|
-
@shop_order.destroy
|
148
|
-
|
149
|
-
respond_to do |format|
|
150
|
-
format.html {
|
151
|
-
flash[:notice] = @message
|
152
|
-
redirect_to admin_shop_orders_path
|
153
|
-
}
|
154
|
-
format.js { render :text => @message, :status => 200 }
|
155
|
-
format.xml { render :xml => {:message => @message}, :status => 200 }
|
156
|
-
format.json { render :json => {:message => @message}, :status => 200 }
|
157
|
-
end
|
158
|
-
else
|
159
|
-
@message = "Unable to delete order."
|
160
|
-
respond_to do |format|
|
161
|
-
format.html {
|
162
|
-
flash[:error] = @message
|
163
|
-
}
|
164
|
-
format.js { render :text => @message, :status => :unprocessable_entity }
|
165
|
-
format.xml { render :xml => {:message => @message}, :status => :unprocessable_entity }
|
166
|
-
format.json { render :json => {:message => @message}, :status => :unprocessable_entity }
|
167
|
-
end
|
43
|
+
def assets_index
|
168
44
|
end
|
169
|
-
|
170
|
-
|
45
|
+
|
46
|
+
def assets_edit
|
47
|
+
end
|
48
|
+
|
171
49
|
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
class Admin::Shop::Packages::PackingsController < Admin::ResourceController
|
2
|
+
model_class ShopPacking
|
3
|
+
|
4
|
+
def sort
|
5
|
+
notice = 'Products successfully sorted.'
|
6
|
+
error = 'Could not sort products.'
|
7
|
+
|
8
|
+
begin
|
9
|
+
@shop_packings = CGI::parse(params[:packings])["package_products[]"]
|
10
|
+
|
11
|
+
@shop_packings.each_with_index do |id, index|
|
12
|
+
ShopPacking.find(id).update_attributes!({ :position, index+1 })
|
13
|
+
end
|
14
|
+
|
15
|
+
respond_to do |format|
|
16
|
+
format.html {
|
17
|
+
redirect_to admin_shop_packages_path
|
18
|
+
}
|
19
|
+
format.js { render :text => notice, :status => :ok }
|
20
|
+
format.json { render :json => { :notice => notice }, :status => :ok }
|
21
|
+
end
|
22
|
+
rescue
|
23
|
+
respond_to do |format|
|
24
|
+
format.html {
|
25
|
+
flash[:error] = error
|
26
|
+
redirect_to admin_shop_packages_path
|
27
|
+
}
|
28
|
+
format.js { render :text => error, :status => :unprocessable_entity }
|
29
|
+
format.json { render :json => { :error => error }, :status => :unprocessable_entity }
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def create
|
35
|
+
notice = 'Product successfully attached.'
|
36
|
+
error = 'Could not attach product.'
|
37
|
+
|
38
|
+
begin
|
39
|
+
@shop_packing.package = ShopPackage.find(params[:package_id])
|
40
|
+
@shop_packing.product = ShopProduct.find(params[:product_id])
|
41
|
+
@shop_packing.save!
|
42
|
+
|
43
|
+
respond_to do |format|
|
44
|
+
format.js { render :partial => 'admin/shop/packages/edit/shared/product', :locals => { :product => @shop_packing.product, :packing => @shop_packing } }
|
45
|
+
end
|
46
|
+
rescue
|
47
|
+
respond_to do |format|
|
48
|
+
format.js { render :text => error, :status => :unprocessable_entity }
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def update
|
54
|
+
notice = 'Product Quantity successfully updated.'
|
55
|
+
error = 'Could not update Product Quantity.'
|
56
|
+
|
57
|
+
begin
|
58
|
+
@shop_packing.update_attributes!({ :quantity => params[:quantity] })
|
59
|
+
respond_to do |format|
|
60
|
+
format.js { render :text => notice, :status => :ok }
|
61
|
+
end
|
62
|
+
rescue
|
63
|
+
respond_to do |format|
|
64
|
+
format.js { render :text => error, :status => :unprocessable_entity }
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
def destroy
|
71
|
+
notice = 'Product successfully removed.'
|
72
|
+
error = 'Could not remove product.'
|
73
|
+
|
74
|
+
begin
|
75
|
+
@shop_product = @shop_packing.product
|
76
|
+
@shop_package = @shop_packing.package
|
77
|
+
|
78
|
+
@shop_packing.destroy
|
79
|
+
|
80
|
+
respond_to do |format|
|
81
|
+
format.js { render :partial => 'admin/shop/packages/edit/shared/product', :locals => { :product => @shop_product } }
|
82
|
+
end
|
83
|
+
rescue
|
84
|
+
respond_to do |format|
|
85
|
+
format.js { render :text => error, :status => :unprocessable_entity }
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|