radiant-shop-extension 0.11.6 → 0.90.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (227) hide show
  1. data/HISTORY.md +21 -3
  2. data/LICENSE +42 -0
  3. data/README.md +62 -25
  4. data/Rakefile +4 -5
  5. data/VERSION +1 -1
  6. data/app/controllers/admin/shop/categories_controller.rb +1 -0
  7. data/app/controllers/admin/shop/orders_controller.rb +1 -1
  8. data/app/controllers/admin/shop/products_controller.rb +18 -7
  9. data/app/helpers/shop_helper.rb +8 -0
  10. data/app/models/form_address.rb +5 -5
  11. data/app/models/form_checkout.rb +25 -17
  12. data/app/models/form_line_item.rb +1 -1
  13. data/app/models/shop_category.rb +22 -7
  14. data/app/models/shop_customer.rb +1 -1
  15. data/app/models/shop_line_item.rb +26 -26
  16. data/app/models/shop_order.rb +0 -2
  17. data/app/models/shop_product.rb +15 -18
  18. data/app/views/.DS_Store +0 -0
  19. data/app/views/admin/shop/categories/edit/meta/_status.html.haml +3 -0
  20. data/app/views/admin/shop/products/edit/_foot.html.haml +1 -8
  21. data/app/views/admin/shop/products/edit/meta/_layout.html.haml +6 -0
  22. data/app/views/admin/shop/products/edit/meta/_status.html.haml +3 -0
  23. data/app/views/admin/shop/products/index/_product.html.haml +1 -1
  24. data/config/locales/en.yml +8 -7
  25. data/config/routes.rb +4 -16
  26. data/db/migrate/20101011063133_setup_shop.rb +94 -0
  27. data/db/seeds/forms.rb +113 -154
  28. data/db/seeds/layouts.rb +67 -103
  29. data/db/seeds/pages.rb +101 -0
  30. data/db/seeds/products.rb +29 -0
  31. data/db/seeds/snippets.rb +36 -21
  32. data/lib/shop/controllers/application_controller.rb +5 -3
  33. data/lib/shop/models/form_extension.rb +1 -2
  34. data/lib/shop/models/page.rb +0 -1
  35. data/lib/shop/models/user.rb +0 -1
  36. data/lib/shop/tags/card.rb +8 -2
  37. data/lib/shop/tags/cart.rb +5 -1
  38. data/lib/shop/tags/helpers.rb +35 -60
  39. data/lib/shop/tags/item.rb +2 -16
  40. data/lib/shop/tags/product.rb +7 -0
  41. data/lib/tasks/shop_extension_tasks.rake +9 -4
  42. data/public/javascripts/admin/extensions/shop/products/edit.js +0 -25
  43. data/radiant-shop-extension.gemspec +25 -201
  44. data/shop_extension.rb +18 -19
  45. data/spec/datasets/forms.rb +25 -28
  46. data/spec/datasets/shop_categories.rb +2 -2
  47. data/spec/datasets/shop_config.rb +24 -0
  48. data/spec/datasets/shop_customers.rb +1 -0
  49. data/spec/datasets/shop_line_items.rb +21 -3
  50. data/spec/datasets/shop_products.rb +4 -1
  51. data/spec/datasets/tags.rb +19 -0
  52. data/spec/lib/shop/models/page_spec.rb +1 -1
  53. data/spec/lib/shop/tags/card_spec.rb +30 -4
  54. data/spec/lib/shop/tags/cart_spec.rb +29 -12
  55. data/spec/lib/shop/tags/helpers_spec.rb +45 -66
  56. data/spec/lib/shop/tags/item_spec.rb +6 -10
  57. data/spec/lib/shop/tags/product_spec.rb +27 -2
  58. data/spec/models/form_address_spec.rb +9 -8
  59. data/spec/models/form_checkout_spec.rb +28 -22
  60. data/spec/models/shop_category_spec.rb +2 -10
  61. data/spec/models/shop_line_item_spec.rb +71 -34
  62. data/spec/models/shop_order_spec.rb +5 -5
  63. data/spec/models/shop_product_attachment_spec.rb +1 -0
  64. data/spec/models/shop_product_spec.rb +4 -47
  65. data/spec/spec.opts +3 -5
  66. metadata +60 -248
  67. data/Gemfile +0 -26
  68. data/Gemfile.lock +0 -75
  69. data/MIT-LICENSE +0 -20
  70. data/app/controllers/admin/shop/discounts/discountables_controller.rb +0 -44
  71. data/app/controllers/admin/shop/discounts_controller.rb +0 -64
  72. data/app/controllers/admin/shop/packages/packings_controller.rb +0 -90
  73. data/app/controllers/admin/shop/packages_controller.rb +0 -63
  74. data/app/controllers/admin/shop/products/variant_templates_controller.rb +0 -27
  75. data/app/controllers/admin/shop/products/variants_controller.rb +0 -60
  76. data/app/controllers/admin/shop/variants_controller.rb +0 -48
  77. data/app/models/form_discount.rb +0 -39
  78. data/app/models/shop_discount.rb +0 -37
  79. data/app/models/shop_discountable.rb +0 -64
  80. data/app/models/shop_group.rb +0 -15
  81. data/app/models/shop_grouping.rb +0 -6
  82. data/app/models/shop_package.rb +0 -74
  83. data/app/models/shop_packing.rb +0 -22
  84. data/app/models/shop_product_variant.rb +0 -34
  85. data/app/models/shop_variant.rb +0 -23
  86. data/app/views/admin/pages/_shop_category.html.haml +0 -4
  87. data/app/views/admin/pages/_shop_product.html.haml +0 -4
  88. data/app/views/admin/shop/discounts/edit/_foot.html.haml +0 -16
  89. data/app/views/admin/shop/discounts/edit/_form.html.haml +0 -15
  90. data/app/views/admin/shop/discounts/edit/_head.html.haml +0 -4
  91. data/app/views/admin/shop/discounts/edit/_inputs.html.haml +0 -2
  92. data/app/views/admin/shop/discounts/edit/_meta.html.haml +0 -8
  93. data/app/views/admin/shop/discounts/edit/_parts.html.haml +0 -9
  94. data/app/views/admin/shop/discounts/edit/_popups.html.haml +0 -4
  95. data/app/views/admin/shop/discounts/edit/buttons/_browse_categories.html.haml +0 -1
  96. data/app/views/admin/shop/discounts/edit/buttons/_browse_products.html.haml +0 -1
  97. data/app/views/admin/shop/discounts/edit/inputs/_amount.html.haml +0 -3
  98. data/app/views/admin/shop/discounts/edit/inputs/_code.html.haml +0 -3
  99. data/app/views/admin/shop/discounts/edit/inputs/_name.html.haml +0 -3
  100. data/app/views/admin/shop/discounts/edit/meta/_finish.html.haml +0 -5
  101. data/app/views/admin/shop/discounts/edit/meta/_start.html.haml +0 -5
  102. data/app/views/admin/shop/discounts/edit/parts/_categories.html.haml +0 -3
  103. data/app/views/admin/shop/discounts/edit/parts/_products.html.haml +0 -3
  104. data/app/views/admin/shop/discounts/edit/popups/_browse_categories.html.haml +0 -6
  105. data/app/views/admin/shop/discounts/edit/popups/_browse_products.html.haml +0 -6
  106. data/app/views/admin/shop/discounts/edit/shared/_category.html.haml +0 -11
  107. data/app/views/admin/shop/discounts/edit/shared/_product.html.haml +0 -12
  108. data/app/views/admin/shop/discounts/edit.html.haml +0 -11
  109. data/app/views/admin/shop/discounts/index/_discount.html.haml +0 -13
  110. data/app/views/admin/shop/discounts/index/_foot.html.haml +0 -5
  111. data/app/views/admin/shop/discounts/index/_head.html.haml +0 -2
  112. data/app/views/admin/shop/discounts/index/buttons/_new_discount.html.haml +0 -1
  113. data/app/views/admin/shop/discounts/index.html.haml +0 -13
  114. data/app/views/admin/shop/discounts/new.html.haml +0 -11
  115. data/app/views/admin/shop/discounts/remove.html.haml +0 -12
  116. data/app/views/admin/shop/packages/edit/_foot.html.haml +0 -17
  117. data/app/views/admin/shop/packages/edit/_form.html.haml +0 -15
  118. data/app/views/admin/shop/packages/edit/_head.html.haml +0 -4
  119. data/app/views/admin/shop/packages/edit/_inputs.html.haml +0 -2
  120. data/app/views/admin/shop/packages/edit/_meta.html.haml +0 -8
  121. data/app/views/admin/shop/packages/edit/_parts.html.haml +0 -9
  122. data/app/views/admin/shop/packages/edit/_popups.html.haml +0 -4
  123. data/app/views/admin/shop/packages/edit/buttons/_browse_products.html.haml +0 -1
  124. data/app/views/admin/shop/packages/edit/inputs/_name.html.haml +0 -3
  125. data/app/views/admin/shop/packages/edit/inputs/_price.html.haml +0 -3
  126. data/app/views/admin/shop/packages/edit/meta/_sku.html.haml +0 -5
  127. data/app/views/admin/shop/packages/edit/parts/_description.html.haml +0 -1
  128. data/app/views/admin/shop/packages/edit/parts/_products.html.haml +0 -3
  129. data/app/views/admin/shop/packages/edit/popups/_browse_products.html.haml +0 -7
  130. data/app/views/admin/shop/packages/edit/shared/_product.html.haml +0 -8
  131. data/app/views/admin/shop/packages/edit.html.haml +0 -11
  132. data/app/views/admin/shop/packages/index/_foot.html.haml +0 -8
  133. data/app/views/admin/shop/packages/index/_head.html.haml +0 -2
  134. data/app/views/admin/shop/packages/index/_package.html.haml +0 -9
  135. data/app/views/admin/shop/packages/index/buttons/_new_package.html.haml +0 -1
  136. data/app/views/admin/shop/packages/index.html.haml +0 -13
  137. data/app/views/admin/shop/packages/new.html.haml +0 -11
  138. data/app/views/admin/shop/packages/remove.html.haml +0 -12
  139. data/app/views/admin/shop/products/edit/buttons/_browse_templates.html.haml +0 -1
  140. data/app/views/admin/shop/products/edit/buttons/_new_variant.html.haml +0 -1
  141. data/app/views/admin/shop/products/edit/parts/_variants.html.haml +0 -3
  142. data/app/views/admin/shop/products/edit/popups/_browse_templates.html.haml +0 -6
  143. data/app/views/admin/shop/products/edit/popups/_new_variant.html.haml +0 -16
  144. data/app/views/admin/shop/products/edit/shared/_template.html.haml +0 -6
  145. data/app/views/admin/shop/products/edit/shared/_variant.html.haml +0 -10
  146. data/app/views/admin/shop/products/index/buttons/_variants.html.haml +0 -1
  147. data/app/views/admin/shop/variants/edit/_foot.html.haml +0 -9
  148. data/app/views/admin/shop/variants/edit/_form.html.haml +0 -13
  149. data/app/views/admin/shop/variants/edit/_head.html.haml +0 -4
  150. data/app/views/admin/shop/variants/edit/_inputs.html.haml +0 -2
  151. data/app/views/admin/shop/variants/edit/_meta.html.haml +0 -8
  152. data/app/views/admin/shop/variants/edit/_parts.html.haml +0 -9
  153. data/app/views/admin/shop/variants/edit/_popups.html.haml +0 -4
  154. data/app/views/admin/shop/variants/edit/inputs/_name.html.haml +0 -3
  155. data/app/views/admin/shop/variants/edit/inputs/_options.html.haml +0 -3
  156. data/app/views/admin/shop/variants/edit.html.haml +0 -11
  157. data/app/views/admin/shop/variants/index/_foot.html.haml +0 -5
  158. data/app/views/admin/shop/variants/index/_head.html.haml +0 -2
  159. data/app/views/admin/shop/variants/index/_variant.html.haml +0 -9
  160. data/app/views/admin/shop/variants/index/buttons/_add_variant.html.haml +0 -1
  161. data/app/views/admin/shop/variants/index/buttons/_categories.html.haml +0 -1
  162. data/app/views/admin/shop/variants/index.html.haml +0 -13
  163. data/app/views/admin/shop/variants/new.html.haml +0 -11
  164. data/app/views/admin/shop/variants/remove.html.haml +0 -12
  165. data/app/views/shop/categories/show.html.haml +0 -1
  166. data/app/views/shop/orders/show.html.haml +0 -1
  167. data/app/views/shop/products/index.html.haml +0 -1
  168. data/app/views/shop/products/show.html.haml +0 -1
  169. data/cucumber.yml +0 -1
  170. data/db/migrate/20100311053701_initial.rb +0 -153
  171. data/db/migrate/20100927041219_remove_payment_methods.rb +0 -16
  172. data/db/migrate/20100927041624_change_payments_add_gateway.rb +0 -11
  173. data/db/migrate/20100927140446_change_payment_add_card_type_card_number.rb +0 -11
  174. data/db/migrate/20100929011106_fix_relationship_foreign_keys.rb +0 -101
  175. data/db/migrate/20100929011607_drop_shop_addressables.rb +0 -25
  176. data/db/migrate/20100929030510_create_shop_groups.rb +0 -19
  177. data/db/migrate/20100929080301_shop_groups_change_add_description.rb +0 -11
  178. data/db/migrate/20100929081200_create_variants.rb +0 -20
  179. data/db/migrate/20100929143531_change_variants_add_updated_by.rb +0 -25
  180. data/db/migrate/20100929145641_change_created_by_to_id.rb +0 -75
  181. data/db/migrate/20100929235221_change_category_add_variant_id.rb +0 -9
  182. data/db/migrate/20100930235221_create_packages.rb +0 -31
  183. data/db/migrate/20101005231713_create_page_ids.rb +0 -11
  184. data/db/migrate/20101006051214_create_pages_for_products_and_categories.rb +0 -73
  185. data/db/migrate/20101007111845_add_default_position_to_attachment.rb +0 -9
  186. data/db/migrate/20101010071143_create_discounts.rb +0 -29
  187. data/db/migrate/20101010072225_modify_categories_remove_variant.rb +0 -9
  188. data/db/migrate/20101010130034_change_discountables_add_observer.rb +0 -15
  189. data/db/migrate/20101011063133_change_orders_set_limits_to_null.rb +0 -11
  190. data/features/support/env.rb +0 -16
  191. data/features/support/paths.rb +0 -14
  192. data/lib/shop/interface/packages.rb +0 -34
  193. data/lib/shop/interface/variants.rb +0 -34
  194. data/lib/shop/tags/package.rb +0 -95
  195. data/lib/shop/tags/product_variant.rb +0 -52
  196. data/lib/shop/tags/responses.rb +0 -34
  197. data/mockups/balsamiq/products-retro_fun_tshirt-more.bmml +0 -0
  198. data/mockups/balsamiq/products-retro_fun_tshirt.bmml +0 -0
  199. data/mockups/discounts/new-edit.bmml +0 -492
  200. data/public/javascripts/admin/extensions/shop/discounts/edit.js +0 -76
  201. data/public/javascripts/admin/extensions/shop/packages/edit.js +0 -109
  202. data/public/stylesheets/sass/admin/extensions/shop/discounts/edit.sass +0 -125
  203. data/public/stylesheets/sass/admin/extensions/shop/packages/edit.sass +0 -162
  204. data/spec/controllers/admin/shop/discounts/discountables_controller_spec.rb +0 -73
  205. data/spec/controllers/admin/shop/discounts_controller_spec.rb +0 -81
  206. data/spec/controllers/admin/shop/packages/packings_controller_spec.rb +0 -188
  207. data/spec/controllers/admin/shop/packages_controller_spec.rb +0 -32
  208. data/spec/controllers/admin/shop/products/variant_templates_controller_spec.rb +0 -53
  209. data/spec/controllers/admin/shop/products/variants_controller_spec.rb +0 -116
  210. data/spec/controllers/admin/shop/variants_controller_spec.rb +0 -67
  211. data/spec/datasets/shop_discountables.rb +0 -22
  212. data/spec/datasets/shop_discounts.rb +0 -29
  213. data/spec/datasets/shop_groups.rb +0 -15
  214. data/spec/datasets/shop_packages.rb +0 -25
  215. data/spec/datasets/shop_product_variants.rb +0 -22
  216. data/spec/datasets/shop_variants.rb +0 -17
  217. data/spec/lib/shop/tags/package_spec.rb +0 -342
  218. data/spec/lib/shop/tags/product_variant_spec.rb +0 -175
  219. data/spec/lib/shop/tags/responses_spec.rb +0 -129
  220. data/spec/models/form_discount_spec.rb +0 -63
  221. data/spec/models/shop_discount_spec.rb +0 -130
  222. data/spec/models/shop_discountable_spec.rb +0 -114
  223. data/spec/models/shop_group_spec.rb +0 -38
  224. data/spec/models/shop_package_spec.rb +0 -117
  225. data/spec/models/shop_packing_spec.rb +0 -67
  226. data/spec/models/shop_product_variant_spec.rb +0 -92
  227. data/spec/models/shop_variant_spec.rb +0 -32
@@ -1,109 +0,0 @@
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,125 +0,0 @@
1
- ul.discounteds, .availables
2
- padding:
3
- top: 10px
4
-
5
- li.discounted, .available
6
- float: left
7
- position: relative
8
- padding: 10px
9
- height: 100px
10
- width: 100px
11
- margin:
12
- right: 10px
13
- border:
14
- radius: 6px
15
- -moz:
16
- border:
17
- radius: 6px
18
- -webkit:
19
- border:
20
- radius: 6px
21
- cursor: move
22
- overflow: hidden
23
- *
24
- vertical:
25
- align: middle
26
-
27
- .wrapper
28
- display: table-cell
29
- height: 100px
30
- width: 100px
31
- text:
32
- align: center
33
- vertical:
34
- align: middle
35
-
36
- img
37
- width: 100px
38
- max:
39
- height: 100px
40
-
41
- .name
42
- line-height: 12px
43
- font-size: 12px
44
- position: absolute
45
- display: block
46
- width: 96%
47
- top: 37.5px
48
- left: 0
49
- padding: 4px 2%
50
- overflow: hidden
51
- text-align: center
52
-
53
- .sku, .handle
54
- visibility: hidden
55
- font-size: 10px
56
- line-height: 12px
57
- position: absolute
58
- display: block
59
- width: 96%
60
- bottom: 12.5px
61
- left: 0
62
- padding: 4px 2%
63
- overflow: hidden
64
- text-align: center
65
- color: #757575
66
-
67
- &:hover
68
- background:
69
- color: #f9f6fe
70
-
71
- .sku, .handle
72
- visibility: visible
73
-
74
- .name
75
- background-color: #f9f6fe
76
-
77
- ul.discounteds
78
- overflow: hidden
79
-
80
- li.discounted
81
-
82
- .actions
83
- position: absolute
84
- display: block
85
- width: 100%
86
- top: 0
87
- left: 0
88
-
89
- .delete
90
- position: absolute
91
- top: 4px
92
- right: -4px
93
- width: 20px
94
- height: 20px
95
- overflow: hidden
96
- display: block
97
- cursor: pointer
98
- background:
99
- image: url('/images/admin/minus_disabled.png')
100
- repeat: no-repeat
101
- position: 0 0
102
- cursor: pointer
103
-
104
- &:hover
105
- background:
106
- image: url('/images/admin/minus.png')
107
-
108
- ul.availables
109
- /* This makes the scroll look nice */
110
- margin:
111
- right: -10px
112
- top: -10px
113
- padding:
114
- left: 15px
115
- bottom: 10px
116
- width: 680px
117
- max-height: 350px
118
- overflow-y: scroll
119
-
120
- li.available
121
-
122
- .actions
123
-
124
- .delete
125
- display: none
@@ -1,162 +0,0 @@
1
- ol#package_products
2
- overflow: hidden
3
- padding:
4
- top: 10px
5
-
6
- li.product
7
- float: left
8
- position: relative
9
- padding: 10px
10
- height: 100px
11
- width: 100px
12
- margin:
13
- right: 10px
14
- border:
15
- radius: 6px
16
- -moz:
17
- border:
18
- radius: 6px
19
- -webkit:
20
- border:
21
- radius: 6px
22
- cursor: move
23
- overflow: hidden
24
- *
25
- vertical:
26
- align: middle
27
-
28
- .wrapper
29
- display: table-cell
30
- height: 100px
31
- width: 100px
32
- text:
33
- align: center
34
- vertical:
35
- align: middle
36
-
37
- img
38
- width: 100px
39
- max:
40
- height: 100px
41
-
42
- .title
43
- font-size: 10px
44
- position: absolute
45
- display: block
46
- width: 96%
47
- top: 37.5px
48
- left: 0
49
- padding: 4px 2%
50
- overflow: hidden
51
-
52
- .quantity
53
- visibility: hidden
54
- font-size: 10px
55
- position: absolute
56
- display: block
57
- width: 30px
58
- bottom: 14px
59
- left: 18px
60
- padding: 2px 0
61
-
62
- .save_quantity
63
- width: 45px
64
- visibility: hidden
65
- position: absolute
66
- right: 14px
67
- bottom: 14px
68
-
69
- .actions
70
- position: absolute
71
- display: block
72
- width: 100%
73
- top: 0
74
- left: 0
75
-
76
- .delete
77
- position: absolute
78
- right: 2px
79
- top: 4px
80
- width: 20px
81
- height: 20px
82
- overflow: hidden
83
- display: block
84
- cursor: pointer
85
- background:
86
- image: url('/images/admin/minus_disabled.png')
87
- repeat: no-repeat
88
- position: 0 0
89
- cursor: pointer
90
-
91
- &:hover
92
- background:
93
- image: url('/images/admin/minus.png')
94
-
95
- &:hover
96
- background:
97
- color: #f9f6fe
98
-
99
- .title, .quantity, .save_quantity
100
- visibility: visible
101
-
102
- .title
103
- background-color: #f9f6fe
104
-
105
- #browse_products_popup
106
- position: relative
107
- overflow: hidden
108
-
109
- ul#available_products
110
- width: 700px
111
- padding: 5px 0 10px
112
- overflow: hidden
113
- position: relative
114
-
115
- li.product
116
- position: relative
117
- background-color: #f9f6fe
118
- display: block
119
- float: left
120
- height: 70px
121
- width: 70px
122
- padding: 10px
123
- margin: 0 5px 5px
124
- border:
125
- radius: 6px
126
- -moz:
127
- border:
128
- radius: 6px
129
- -webkit:
130
- border:
131
- radius: 6px
132
- cursor: pointer
133
-
134
- *
135
- vertical:
136
- align: middle
137
-
138
- .wrapper
139
- display: table-cell
140
- height: 70px
141
- width: 70px
142
- text:
143
- align: center
144
- vertical:
145
- algin: middle
146
-
147
- img
148
- width: 70px
149
-
150
- .title
151
- font-size: 10px
152
- position: absolute
153
- display: block
154
- width: 96%
155
- top: 37.5px
156
- left: 0
157
- background-color: #f9f6fe
158
- padding: 4px 2%
159
- overflow: hidden
160
-
161
- .actions, .quantity, .save_quantity
162
- display: none
@@ -1,73 +0,0 @@
1
- require 'spec/spec_helper'
2
-
3
- describe Admin::Shop::Discounts::DiscountablesController do
4
-
5
- dataset :users, :shop_discountables
6
-
7
- before :each do
8
- login_as :admin
9
- @discountable = shop_discountables(:ten_percent_bread)
10
- end
11
-
12
- describe '#create' do
13
- before :each do
14
- @discounted = shop_products(:warm_bread)
15
- end
16
- context 'packing could not be created' do
17
- before :each do
18
- stub(ShopDiscountable).new { @discountable }
19
- mock(@discountable).save! { raise ActiveRecord::RecordNotSaved }
20
- end
21
-
22
- context 'js' do
23
- it 'should return error notice and failure status' do
24
- post :create, :discount_id => @discountable.discount.id, :discounted_id => @discounted.id, :discounted_type => @discounted.class.name, :format => 'js'
25
-
26
- response.body.should === 'Could not attach Discount.'
27
- response.should_not be_success
28
- end
29
- end
30
- end
31
-
32
- context 'packing successfully created' do
33
- context 'js' do
34
- it 'should render the collection partial and success status' do
35
- post :create, :discount_id => @discountable.discount.id, :discounted_id => @discounted.id, :discounted_type => @discounted.class.name, :format => 'js'
36
-
37
- response.should be_success
38
- assigns(:shop_discountable).is_a?(ShopDiscountable).should === true
39
- response.should render_template('admin/shop/discounts/edit/shared/_product')
40
- end
41
- end
42
- end
43
- end
44
-
45
- describe '#destroy' do
46
- context 'discountable not destroyed' do
47
- before :each do
48
- stub(ShopDiscountable).find(@discountable.id.to_s) { @discountable }
49
- stub(@discountable).destroy { raise ActiveRecord::RecordNotFound }
50
- end
51
-
52
- context 'js' do
53
- it 'should render an error and failure status' do
54
- delete :destroy, :discount_id => @discountable.discount.id, :id => @discountable.id, :format => 'js'
55
-
56
- response.should_not be_success
57
- response.body.should === 'Could not remove Discount.'
58
- end
59
- end
60
- end
61
-
62
- context 'discountable successfully destroyed' do
63
- context 'js' do
64
- it 'should render success message and success status' do
65
- delete :destroy, :discount_id => @discountable.discount.id, :id => @discountable.id, :format => 'js'
66
- response.should be_success
67
- response.should render_template('admin/shop/discounts/edit/shared/_category')
68
- end
69
- end
70
- end
71
- end
72
-
73
- end
@@ -1,81 +0,0 @@
1
- require 'spec/spec_helper'
2
-
3
- describe Admin::Shop::DiscountsController do
4
-
5
- dataset :users, :shop_discounts
6
-
7
- before(:each) do
8
- login_as :admin
9
- end
10
-
11
- describe 'index' do
12
- context 'instance variables' do
13
- it 'should be assigned' do
14
- get :index
15
-
16
- assigns(:inputs).should === []
17
- assigns(:meta).should === []
18
- assigns(:buttons).should === ['new_discount']
19
- assigns(:parts).should === []
20
- assigns(:popups).should === []
21
- end
22
- end
23
- end
24
-
25
- describe '#new' do
26
- context 'instance variables' do
27
- it 'should be assigned' do
28
- get :new
29
-
30
- assigns(:inputs).should === ['name','amount','code']
31
- assigns(:meta).should === ['start','finish']
32
- assigns(:buttons).should === []
33
- assigns(:parts).should === []
34
- assigns(:popups).should === []
35
- end
36
- end
37
- end
38
-
39
- describe '#edit' do
40
- context 'instance variables' do
41
- it 'should be assigned' do
42
- get :edit, :id => shop_discounts(:ten_percent).id
43
-
44
- assigns(:inputs).should === ['name','amount','code']
45
- assigns(:meta).should === ['start','finish']
46
- assigns(:buttons).should === ['browse_categories', 'browse_products']
47
- assigns(:parts).should === ['categories', 'products']
48
- assigns(:popups).should === ['browse_categories', 'browse_products']
49
- end
50
- end
51
- end
52
-
53
- describe '#create' do
54
- context 'instance variables' do
55
- it 'should be assigned' do
56
- post :create, :shop_variant => {}
57
-
58
- assigns(:inputs).should === ['name','amount','code']
59
- assigns(:meta).should === ['start','finish']
60
- assigns(:buttons).should === []
61
- assigns(:parts).should === []
62
- assigns(:popups).should === []
63
- end
64
- end
65
- end
66
-
67
- describe '#update' do
68
- context 'instance variables' do
69
- it 'should be assigned' do
70
- put :update, :id => shop_discounts(:ten_percent).id, :shop_variant => {}
71
-
72
- assigns(:inputs).should === ['name','amount','code']
73
- assigns(:meta).should === ['start','finish']
74
- assigns(:buttons).should === ['browse_categories', 'browse_products']
75
- assigns(:parts).should === ['categories', 'products']
76
- assigns(:popups).should === ['browse_categories', 'browse_products']
77
- end
78
- end
79
- end
80
-
81
- end