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,20 @@
|
|
1
|
+
var Shop = {};
|
2
|
+
|
3
|
+
document.observe("dom:loaded", function() {
|
4
|
+
shop = new Shop();
|
5
|
+
|
6
|
+
Event.addBehavior({
|
7
|
+
'.popup .close:click' : function(e) { Element.closePopup($(this)); }
|
8
|
+
});
|
9
|
+
});
|
10
|
+
|
11
|
+
var Shop = Class.create({
|
12
|
+
|
13
|
+
getRoute: function(route, format, id) {
|
14
|
+
format = format || 'js';
|
15
|
+
id = id || null;
|
16
|
+
result = id ? ROUTES[route].replace(/(:\w+)/, id) : ROUTES[route];
|
17
|
+
return (result + '.' + format);
|
18
|
+
}
|
19
|
+
|
20
|
+
});
|
@@ -0,0 +1,109 @@
|
|
1
|
+
document.observe("dom:loaded", function() {
|
2
|
+
shop_package_edit = new ShopPackageEdit();
|
3
|
+
shop_package_edit.initialize();
|
4
|
+
|
5
|
+
Event.addBehavior({
|
6
|
+
'#available_products .product:click' : function(e) { shop_package_edit.productAttach($(this)) },
|
7
|
+
'#package_products .quantity:blur' : function(e) { shop_package_edit.productUpdate($(this)) },
|
8
|
+
'#package_products .delete:click' : function(e) { shop_package_edit.productRemove($(this)) }
|
9
|
+
})
|
10
|
+
});
|
11
|
+
|
12
|
+
var ShopPackageEdit = Class.create({
|
13
|
+
|
14
|
+
initialize: function() {
|
15
|
+
this.productsSort();
|
16
|
+
},
|
17
|
+
|
18
|
+
productsSort: function() {
|
19
|
+
var route = shop.getRoute('sort_admin_shop_package_packings_path');
|
20
|
+
Sortable.create('package_products', {
|
21
|
+
constraint: false,
|
22
|
+
overlap: 'horizontal',
|
23
|
+
containment: ['package_products'],
|
24
|
+
onUpdate: function(element) {
|
25
|
+
new Ajax.Request(route, {
|
26
|
+
method: 'put',
|
27
|
+
parameters: {
|
28
|
+
'package_id': $('shop_package_id').value,
|
29
|
+
'packings' : Sortable.serialize('package_products')
|
30
|
+
}
|
31
|
+
});
|
32
|
+
}
|
33
|
+
})
|
34
|
+
},
|
35
|
+
|
36
|
+
productAttach: function(element) {
|
37
|
+
var product = element;
|
38
|
+
var route = shop.getRoute('admin_shop_package_packings_path');
|
39
|
+
|
40
|
+
showStatus('Adding Product...');
|
41
|
+
new Ajax.Request(route, {
|
42
|
+
method: 'post',
|
43
|
+
parameters: {
|
44
|
+
'package_id': $('shop_package_id').value,
|
45
|
+
'product_id': element.getAttribute('data-product_id'),
|
46
|
+
},
|
47
|
+
onSuccess: function(data) {
|
48
|
+
$('package_products').insert({ 'bottom' : data.responseText});
|
49
|
+
shop_package_edit.productPostChanges(product);
|
50
|
+
}.bind(element),
|
51
|
+
onFailure: function() {
|
52
|
+
thi.productError();
|
53
|
+
}
|
54
|
+
});
|
55
|
+
},
|
56
|
+
|
57
|
+
productUpdate: function(element) {
|
58
|
+
var product = element.up('.product');
|
59
|
+
var packing_id = product.readAttribute('data-packing_id');
|
60
|
+
var route = shop.getRoute('admin_shop_package_packing_path', 'js', packing_id);
|
61
|
+
|
62
|
+
showStatus('Updating Quantity...');
|
63
|
+
new Ajax.Request(route, {
|
64
|
+
method: 'put',
|
65
|
+
parameters: {
|
66
|
+
'quantity': element.value
|
67
|
+
},
|
68
|
+
onSuccess: function(data) {
|
69
|
+
hideStatus();
|
70
|
+
},
|
71
|
+
onFailure: function(data) {
|
72
|
+
shop_package_edit.errorStatus();
|
73
|
+
}
|
74
|
+
});
|
75
|
+
},
|
76
|
+
|
77
|
+
productRemove: function(element) {
|
78
|
+
var product = element.up('.product');
|
79
|
+
var packing_id = product.readAttribute('data-packing_id');
|
80
|
+
var route = shop.getRoute('admin_shop_package_packing_path', 'js', packing_id);
|
81
|
+
|
82
|
+
showStatus('Removing Product...');
|
83
|
+
element.hide();
|
84
|
+
new Ajax.Request(route, {
|
85
|
+
method: 'delete',
|
86
|
+
onSuccess: function(data) {
|
87
|
+
$('available_products').insert({ 'bottom' : data.responseText });
|
88
|
+
shop_package_edit.productPostChanges(product);
|
89
|
+
},
|
90
|
+
onFailure: function(data) {
|
91
|
+
shop_package_edit.errorStatus();
|
92
|
+
}
|
93
|
+
});
|
94
|
+
},
|
95
|
+
|
96
|
+
productPostChanges: function(element) {
|
97
|
+
element.remove();
|
98
|
+
|
99
|
+
this.productsSort();
|
100
|
+
|
101
|
+
hideStatus();
|
102
|
+
},
|
103
|
+
|
104
|
+
errorStatus: function() {
|
105
|
+
setStatus('Something went wrong, refreshing.');
|
106
|
+
location.reload(true);
|
107
|
+
}
|
108
|
+
|
109
|
+
});
|
@@ -1,43 +1,31 @@
|
|
1
|
-
var ShopProductAssets = {}
|
2
|
-
|
3
1
|
document.observe("dom:loaded", function() {
|
4
|
-
|
5
|
-
|
2
|
+
shop_product_edit = new ShopProductEdit();
|
3
|
+
shop_product_edit.initialize();
|
6
4
|
|
7
5
|
Event.addBehavior({
|
8
|
-
'#
|
9
|
-
'#
|
10
|
-
|
11
|
-
'#image_form:submit' : function(e) { shop.ImageSubmit() },
|
6
|
+
'#image_form:submit' : function(e) { shop_product_edit.imageSubmit() },
|
7
|
+
'#browse_images_popup .image:click' : function(e) { shop_product_edit.imageAttach($(this)) },
|
8
|
+
'#product_attachments .delete:click' : function(e) { shop_product_edit.imageRemove($(this).up('.image')) },
|
12
9
|
|
13
|
-
'#
|
14
|
-
|
15
|
-
})
|
16
|
-
})
|
17
|
-
|
18
|
-
ShopProductAssets.List = Behavior.create({
|
19
|
-
|
20
|
-
onclick: function() {
|
21
|
-
shop.ProductImageCreate(this.element)
|
22
|
-
}
|
23
|
-
|
10
|
+
'#variants .delete:click' : function(e) { shop_product_edit.variantRemove($(this).up('.variant')) }
|
11
|
+
});
|
24
12
|
});
|
25
13
|
|
26
|
-
var
|
14
|
+
var ShopProductEdit = Class.create({
|
27
15
|
|
28
|
-
|
29
|
-
|
30
|
-
this.ProductImagesSort()
|
31
|
-
}
|
16
|
+
initialize: function() {
|
17
|
+
this.imagesSort();
|
32
18
|
},
|
33
19
|
|
34
|
-
|
20
|
+
imagesSort: function() {
|
21
|
+
var route = shop.getRoute('sort_admin_shop_product_images_path');
|
22
|
+
|
35
23
|
Sortable.create('product_attachments', {
|
36
24
|
constraint: false,
|
37
25
|
overlap: 'horizontal',
|
38
26
|
containment: ['product_attachments'],
|
39
27
|
onUpdate: function(element) {
|
40
|
-
new Ajax.Request(
|
28
|
+
new Ajax.Request(route, {
|
41
29
|
method: 'put',
|
42
30
|
parameters: {
|
43
31
|
'product_id': $('shop_product_id').value,
|
@@ -48,68 +36,79 @@ var Shop = Class.create({
|
|
48
36
|
})
|
49
37
|
},
|
50
38
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
39
|
+
imageAttach: function(element) {
|
40
|
+
var route = shop.getRoute('admin_shop_product_images_path');
|
41
|
+
|
42
|
+
showStatus('Adding Image...');
|
43
|
+
element.hide();
|
44
|
+
|
45
|
+
new Ajax.Request(route, {
|
55
46
|
method: 'post',
|
56
47
|
parameters: {
|
57
48
|
'product_id' : $('shop_product_id').value,
|
58
49
|
'attachment[image_id]' : element.getAttribute('data-image_id')
|
59
50
|
},
|
60
51
|
onSuccess: function(data) {
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
element.remove()
|
65
|
-
hideStatus()
|
52
|
+
$('product_attachments').insert({ 'bottom' : data.responseText});
|
53
|
+
shop_product_edit.imagesSort();
|
54
|
+
element.remove();
|
66
55
|
}.bind(element),
|
67
56
|
onFailure: function() {
|
68
|
-
element.show()
|
69
|
-
|
57
|
+
element.show();
|
58
|
+
},
|
59
|
+
onComplete: function() {
|
60
|
+
hideStatus();
|
70
61
|
}
|
71
62
|
});
|
72
63
|
},
|
73
64
|
|
74
|
-
|
65
|
+
imageRemove: function(element) {
|
66
|
+
var attachment_id = element.readAttribute('data-attachment_id');
|
67
|
+
var route = shop.getRoute('admin_shop_product_image_path', 'js', attachment_id);
|
68
|
+
|
75
69
|
showStatus('Removing Image...');
|
76
70
|
element.hide();
|
77
|
-
|
71
|
+
|
72
|
+
new Ajax.Request(route, {
|
78
73
|
method: 'delete',
|
79
74
|
onSuccess: function(data) {
|
80
75
|
$('images').insert({ 'bottom' : data.responseText })
|
81
|
-
element.remove()
|
82
|
-
|
83
|
-
}.bind(this),
|
76
|
+
element.remove();
|
77
|
+
}.bind(element),
|
84
78
|
onFailure: function(data) {
|
85
79
|
element.show();
|
86
|
-
|
87
|
-
|
80
|
+
}.bind(element),
|
81
|
+
onComplete: function() {
|
82
|
+
hideStatus();
|
83
|
+
}
|
88
84
|
});
|
89
85
|
},
|
90
86
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
ImageClose: function() {
|
96
|
-
Element.closePopup('new_image_popup')
|
97
|
-
Element.closePopup('browse_images_popup')
|
87
|
+
variantRemove: function(element) {
|
88
|
+
var variant_id = element.readAttribute('data-variant_id');
|
89
|
+
var route = shop.getRoute('admin_shop_product_variant_path', 'js', variant_id);
|
98
90
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
91
|
+
if(confirm('Are you Sure?')) {
|
92
|
+
showStatus('Removing Variant...');
|
93
|
+
element.hide();
|
94
|
+
|
95
|
+
new Ajax.Request(route, {
|
96
|
+
method: 'delete',
|
97
|
+
onSuccess: function(data) {
|
98
|
+
element.remove();
|
99
|
+
}.bind(element),
|
100
|
+
onFailure: function(data) {
|
101
|
+
element.show();
|
102
|
+
}.bind(element),
|
103
|
+
onComplete: function() {
|
104
|
+
hideStatus();
|
105
|
+
}
|
106
|
+
});
|
107
|
+
}
|
108
|
+
},
|
103
109
|
|
104
|
-
|
105
|
-
|
106
|
-
function urlify(route, id) {
|
107
|
-
var url = route
|
108
|
-
if ( id !== undefined ) {
|
109
|
-
url += '/' + id
|
110
|
+
imageSubmit: function() {
|
111
|
+
showStatus('Uploading Image...');
|
110
112
|
}
|
111
113
|
|
112
|
-
|
113
|
-
|
114
|
-
return url
|
115
|
-
}
|
114
|
+
});
|
@@ -1,60 +1,55 @@
|
|
1
|
-
var ShopProducts = {}
|
2
|
-
|
3
1
|
document.observe("dom:loaded", function() {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
Event.addBehavior({
|
8
|
-
// empty
|
9
|
-
})
|
2
|
+
shop_product_index = new ShopProductIndex();
|
3
|
+
shop_product_index.initialize();
|
10
4
|
})
|
11
5
|
|
12
|
-
var
|
6
|
+
var ShopProductIndex = Class.create({
|
13
7
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
this.CategoriesSort()
|
18
|
-
}
|
8
|
+
initialize: function() {
|
9
|
+
this.sortCategories();
|
10
|
+
this.sortProducts();
|
19
11
|
},
|
20
12
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
13
|
+
sortCategories: function() {
|
14
|
+
var route = shop.getRoute('sort_admin_shop_categories_path');
|
15
|
+
|
16
|
+
Sortable.create('categories', {
|
17
|
+
overlap: 'vertical',
|
18
|
+
only: 'category',
|
19
|
+
handle: 'move',
|
27
20
|
onUpdate: function() {
|
28
|
-
new Ajax.Request(
|
21
|
+
new Ajax.Request(route, {
|
29
22
|
method: 'put',
|
30
23
|
parameters: {
|
31
|
-
'categories':Sortable.serialize('
|
24
|
+
'categories': Sortable.serialize('categories')
|
32
25
|
}
|
33
26
|
})
|
34
27
|
}
|
35
28
|
})
|
36
29
|
},
|
37
30
|
|
38
|
-
|
39
|
-
var
|
40
|
-
|
41
|
-
|
31
|
+
sortProducts: function() {
|
32
|
+
var route = shop.getRoute('sort_admin_shop_products_path');
|
33
|
+
|
34
|
+
var categories = new Array();
|
35
|
+
$$('li.category').each(function(el) {
|
36
|
+
categories.push($(el).id + '_products');
|
42
37
|
})
|
43
38
|
|
44
39
|
categories.each(function(category) {
|
45
40
|
Sortable.create(category, {
|
46
|
-
overlap:
|
47
|
-
only:
|
48
|
-
handle:
|
49
|
-
dropOnEmpty:
|
50
|
-
hoverclass:
|
51
|
-
containment:
|
41
|
+
overlap: 'vertical',
|
42
|
+
only: 'product',
|
43
|
+
handle: 'move',
|
44
|
+
dropOnEmpty: true,
|
45
|
+
hoverclass: 'hover',
|
46
|
+
containment: categories,
|
52
47
|
onUpdate: function() {
|
53
|
-
new Ajax.Request(
|
54
|
-
method:
|
48
|
+
new Ajax.Request(route, {
|
49
|
+
method: 'put',
|
55
50
|
parameters: {
|
56
|
-
'category_id':
|
57
|
-
'products':Sortable.serialize(category)
|
51
|
+
'category_id': $(category).readAttribute('data-id'),
|
52
|
+
'products': Sortable.serialize(category)
|
58
53
|
}
|
59
54
|
})
|
60
55
|
}.bind(this)
|
@@ -2,15 +2,17 @@
|
|
2
2
|
white:
|
3
3
|
space: nowrap
|
4
4
|
|
5
|
-
.drawer_contents
|
6
|
-
|
5
|
+
.drawer_contents
|
6
|
+
|
7
|
+
select
|
8
|
+
width: 100%
|
7
9
|
|
8
|
-
.
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
.date
|
11
|
+
float: left
|
12
|
+
width: 93%
|
13
|
+
heigth: 18px
|
14
|
+
font:
|
15
|
+
size: 16px
|
14
16
|
|
15
17
|
.tabs .close
|
16
18
|
display: none
|
@@ -43,6 +45,30 @@
|
|
43
45
|
&:hover
|
44
46
|
background:
|
45
47
|
image: url('/images/admin/minus.png')
|
48
|
+
|
49
|
+
.popup_content
|
50
|
+
color: #333333
|
51
|
+
|
52
|
+
ol
|
53
|
+
padding: 10px
|
54
|
+
|
55
|
+
li
|
56
|
+
overflow: hidden
|
57
|
+
padding:
|
58
|
+
bottom: 18px
|
59
|
+
&.file
|
60
|
+
padding-bottom: 10px
|
61
|
+
&.submit
|
62
|
+
float: right
|
63
|
+
padding-bottom: 10px
|
64
|
+
label
|
65
|
+
display: block
|
66
|
+
float: left
|
67
|
+
width: 100px
|
68
|
+
padding-top: 6px
|
69
|
+
|
70
|
+
input[type=text]
|
71
|
+
float: left
|
46
72
|
|
47
73
|
h1
|
48
74
|
position: relative
|
@@ -79,8 +105,29 @@ h1
|
|
79
105
|
position: relative
|
80
106
|
top: -2px
|
81
107
|
|
82
|
-
&:hover
|
83
|
-
background: #
|
108
|
+
&:hover, &.active
|
109
|
+
background: #ebebeb
|
84
110
|
color: #000000
|
85
111
|
text:
|
86
|
-
shadow: 1px 1px 1px #
|
112
|
+
shadow: 1px 1px 1px #FFFFFF
|
113
|
+
|
114
|
+
.actions
|
115
|
+
position: relative
|
116
|
+
|
117
|
+
.delete
|
118
|
+
position: absolute
|
119
|
+
width: 20px
|
120
|
+
height: 20px
|
121
|
+
top: 3px
|
122
|
+
right: -20px
|
123
|
+
display: block
|
124
|
+
cursor: pointer
|
125
|
+
background:
|
126
|
+
image: url('/images/admin/minus_disabled.png')
|
127
|
+
repeat: no-repeat
|
128
|
+
position: 0 0
|
129
|
+
cursor: pointer
|
130
|
+
|
131
|
+
&:hover
|
132
|
+
background:
|
133
|
+
image: url('/images/admin/minus.png')
|