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,75 +0,0 @@
1
- class ChangeCreatedByToId < ActiveRecord::Migration
2
- def self.up
3
- add_column :shop_products, :created_by_id, :integer
4
- add_column :shop_products, :updated_by_id, :integer
5
- remove_column :shop_products, :created_by
6
- remove_column :shop_products, :updated_by
7
-
8
- add_column :shop_categories, :created_by_id, :integer
9
- add_column :shop_categories, :updated_by_id, :integer
10
- remove_column :shop_categories, :created_by
11
- remove_column :shop_categories, :updated_by
12
-
13
- add_column :shop_product_attachments, :created_by_id, :integer
14
- add_column :shop_product_attachments, :updated_by_id, :integer
15
- remove_column :shop_product_attachments, :created_by
16
- remove_column :shop_product_attachments, :updated_by
17
-
18
- add_column :shop_addresses, :created_by_id, :integer
19
- add_column :shop_addresses, :updated_by_id, :integer
20
- add_column :shop_addresses, :created_at, :datetime
21
- add_column :shop_addresses, :updated_at, :datetime
22
-
23
- add_column :shop_orders, :created_by_id, :integer
24
- add_column :shop_orders, :updated_by_id, :integer
25
- remove_column :shop_orders, :created_by
26
- remove_column :shop_orders, :updated_by
27
-
28
- add_column :shop_line_items, :created_by_id, :integer
29
- add_column :shop_line_items, :updated_by_id, :integer
30
- remove_column :shop_line_items, :created_by
31
- remove_column :shop_line_items, :updated_by
32
-
33
- add_column :shop_payments, :created_by_id, :integer
34
- add_column :shop_payments, :updated_by_id, :integer
35
- remove_column :shop_payments, :created_by
36
- remove_column :shop_payments, :updated_by
37
- end
38
-
39
- def self.down
40
- remove_column :shop_products, :created_by_id, :integer
41
- remove_column :shop_products, :updated_by_id, :integer
42
- add_column :shop_products, :created_by, :integer
43
- add_column :shop_products, :updated_by, :integer
44
-
45
- remove_column :shop_categories, :created_by_id, :integer
46
- remove_column :shop_categories, :updated_by_id, :integer
47
- add_column :shop_categories, :created_by, :integer
48
- add_column :shop_categories, :updated_by, :integer
49
-
50
- remove_column :shop_product_attachments, :created_by_id, :integer
51
- remove_column :shop_product_attachments, :updated_by_id, :integer
52
- add_column :shop_product_attachments, :created_by, :integer
53
- add_column :shop_product_attachments, :updated_by, :integer
54
-
55
- remove_column :shop_addresses, :created_by_id
56
- remove_column :shop_addresses, :updated_by_id
57
- remove_column :shop_addresses, :created_at
58
- remove_column :shop_addresses, :updated_at
59
-
60
- remove_column :shop_orders, :created_by_id
61
- remove_column :shop_orders, :updated_by_id
62
- add_column :shop_orders, :created_by, :integer
63
- add_column :shop_orders, :updated_by, :integer
64
-
65
- remove_column :shop_line_items, :created_by_id
66
- remove_column :shop_line_items, :updated_by_id
67
- add_column :shop_line_items, :created_by, :integer
68
- add_column :shop_line_items, :updated_by, :integer
69
-
70
- remove_column :shop_payments, :created_by_id
71
- remove_column :shop_payments, :updated_by_id
72
- add_column :shop_payments, :created_by, :integer
73
- add_column :shop_payments, :updated_by, :integer
74
- end
75
- end
@@ -1,9 +0,0 @@
1
- class ChangeCategoryAddVariantId < ActiveRecord::Migration
2
- def self.up
3
- add_column :shop_categories, :variant_id, :integer
4
- end
5
-
6
- def self.down
7
- remove_column :shop_categories, :variant_id
8
- end
9
- end
@@ -1,31 +0,0 @@
1
- class CreatePackages < ActiveRecord::Migration
2
- def self.up
3
- create_table :shop_packages do |t|
4
- t.string :name
5
- t.string :sku
6
- t.text :description
7
- t.boolean :is_active, :default => true
8
-
9
- t.decimal :price
10
-
11
- t.integer :created_by
12
- t.integer :updated_by
13
-
14
- t.timestamps
15
- end
16
-
17
- create_table :shop_packings do |t|
18
- t.integer :quantity, :default => 1
19
- t.integer :position
20
-
21
- t.integer :product_id
22
- t.integer :package_id
23
- end
24
-
25
- end
26
-
27
- def self.down
28
- drop_table :shop_packages
29
- drop_table :shop_packings
30
- end
31
- end
@@ -1,11 +0,0 @@
1
- class CreatePageIds < ActiveRecord::Migration
2
- def self.up
3
- add_column :shop_products, :page_id, :integer
4
- add_column :shop_categories, :page_id, :integer
5
- end
6
-
7
- def self.down
8
- remove_column :shop_products, :page_id, :integer
9
- remove_column :shop_categories, :page_id, :integer
10
- end
11
- end
@@ -1,73 +0,0 @@
1
- class CreatePagesForProductsAndCategories < ActiveRecord::Migration
2
-
3
- class ShopProduct < ActiveRecord::Base
4
- belongs_to :page
5
- belongs_to :category, :class_name => 'ShopCategory', :foreign_key => :category_id
6
- accepts_nested_attributes_for :page
7
- end
8
-
9
- class ShopCategory < ActiveRecord::Base
10
- belongs_to :page
11
-
12
- accepts_nested_attributes_for :page
13
- end
14
-
15
- def self.up
16
- ShopCategory.all.each do |c|
17
- c.update_attributes(
18
- :page => Page.create(
19
- :title => c.name,
20
- :slug => c.handle,
21
- :breadcrumb => c.handle,
22
- :status_id => 100,
23
- :parent_id => Radiant::Config['shop.root_page_id'],
24
- :layout_id => c.layout_id,
25
- :class_name => 'ShopCategoryPage',
26
- :published_at => Time.now,
27
- :parts => [PagePart.create(
28
- :name => 'description',
29
- :content => c.description
30
- )]
31
- )
32
- )
33
- end
34
-
35
- ShopProduct.all.each do |p|
36
- p.update_attributes(
37
- :page => Page.create(
38
- :title => p.name,
39
- :slug => p.sku,
40
- :breadcrumb => p.sku,
41
- :status_id => 100,
42
- :parent_id => ShopCategory.find(p.category_id).page_id,
43
- :layout_id => p.category.product_layout_id,
44
- :class_name => 'ShopProductPage',
45
- :published_at => Time.now,
46
- :parts => [PagePart.create(
47
- :name => 'description',
48
- :content => p.description
49
- )]
50
- )
51
- )
52
- end
53
-
54
- remove_column :shop_products, :name
55
- remove_column :shop_products, :sku
56
- remove_column :shop_products, :description
57
- remove_column :shop_products, :is_active
58
- remove_column :shop_products, :position
59
- remove_column :shop_products, :category_id
60
- remove_column :shop_products, :layout_id
61
-
62
- remove_column :shop_categories, :name
63
- remove_column :shop_categories, :handle
64
- remove_column :shop_categories, :description
65
- remove_column :shop_categories, :layout_id
66
- remove_column :shop_categories, :position
67
- remove_column :shop_categories, :is_active
68
- end
69
-
70
- def self.down
71
- # There is no going back from this adventure
72
- end
73
- end
@@ -1,9 +0,0 @@
1
- class AddDefaultPositionToAttachment < ActiveRecord::Migration
2
- def self.up
3
- change_column :shop_product_attachments, :position, :integer, :default => 1, :allow_null => false
4
- end
5
-
6
- def self.down
7
- change_column :shop_product_attachments, :position, :integer
8
- end
9
- end
@@ -1,29 +0,0 @@
1
- class CreateDiscounts < ActiveRecord::Migration
2
- def self.up
3
- create_table :shop_discounts do |t|
4
- t.string :name
5
- t.string :code
6
- t.decimal :amount
7
-
8
- t.datetime :starts_at
9
- t.datetime :finishes_at
10
-
11
- t.integer :created_by
12
- t.integer :updated_by
13
-
14
- t.timestamps
15
- end
16
-
17
- create_table :shop_discountables do |t|
18
- t.integer :discount_id
19
- t.integer :discounted_id
20
- t.string :discounted_type
21
- end
22
-
23
- end
24
-
25
- def self.down
26
- remove_table :shop_discounts
27
- remove_table :shop_discounteds
28
- end
29
- end
@@ -1,9 +0,0 @@
1
- class ModifyCategoriesRemoveVariant < ActiveRecord::Migration
2
- def self.up
3
- remove_column :shop_categories, :variant_id
4
- end
5
-
6
- def self.down
7
- add_column :shop_categories, :variant_id, :integer
8
- end
9
- end
@@ -1,15 +0,0 @@
1
- class ChangeDiscountablesAddObserver < ActiveRecord::Migration
2
- def self.up
3
- add_column :shop_discountables, :created_by, :integer
4
- add_column :shop_discountables, :created_at, :datetime
5
- add_column :shop_discountables, :updated_by, :integer
6
- add_column :shop_discountables, :updated_at, :datetime
7
- end
8
-
9
- def self.down
10
- remove_column :shop_discountables, :created_by
11
- remove_column :shop_discountables, :created_at
12
- remove_column :shop_discountables, :updated_at
13
- remove_column :shop_discountables, :updated_by
14
- end
15
- end
@@ -1,11 +0,0 @@
1
- class ChangeOrdersSetLimitsToNull < ActiveRecord::Migration
2
- def self.up
3
- change_column :shop_discounts, :starts_at, :datetime, :default => nil
4
- change_column :shop_discounts, :finishes_at, :datetime, :default => nil
5
- end
6
-
7
- def self.down
8
- change_column :shop_discounts, :starts_at, :datetime
9
- change_column :shop_discounts, :finishes_at, :datetime
10
- end
11
- end
@@ -1,16 +0,0 @@
1
- # Sets up the Rails environment for Cucumber
2
- ENV["RAILS_ENV"] = "test"
3
- # Extension root
4
- extension_env = File.expand_path(File.dirname(__FILE__) + '/../../../../../config/environment')
5
- require extension_env+'.rb'
6
-
7
- Dir.glob(File.join(RADIANT_ROOT, "features", "**", "*.rb")).each {|step| require step}
8
-
9
- Cucumber::Rails::World.class_eval do
10
- include Dataset
11
- datasets_directory "#{RADIANT_ROOT}/spec/datasets"
12
- Dataset::Resolver.default = Dataset::DirectoryResolver.new("#{RADIANT_ROOT}/spec/datasets", File.dirname(__FILE__) + '/../../spec/datasets', File.dirname(__FILE__) + '/../datasets')
13
- self.datasets_database_dump_path = "#{Rails.root}/tmp/dataset"
14
-
15
- # dataset :shop_cart
16
- end
@@ -1,14 +0,0 @@
1
- def path_to(page_name)
2
- case page_name
3
-
4
- when /the homepage/i
5
- root_path
6
-
7
- when /login/i
8
- login_path
9
- # Add more page name => path mappings here
10
-
11
- else
12
- raise "Can't find mapping from \"#{page_name}\" to a path."
13
- end
14
- end
@@ -1,34 +0,0 @@
1
- module Shop
2
- module Interface
3
- module Packages
4
-
5
- def self.included(base)
6
- base.send :include, InstanceMethods
7
- end
8
-
9
- module InstanceMethods
10
- attr_accessor :packages
11
-
12
- protected
13
-
14
- def load_default_shop_packages_regions
15
- returning OpenStruct.new do |packages|
16
- packages.edit = Radiant::AdminUI::RegionSet.new do |edit|
17
- edit.main.concat %w{head form popups}
18
- edit.form.concat %w{inputs meta parts foot}
19
- edit.foot.concat %w{buttons timestamp}
20
- end
21
- packages.new = packages.edit
22
- packages.index = Radiant::AdminUI::RegionSet.new do |index|
23
- index.head.concat %w{}
24
- index.body.concat %w{name modify}
25
- index.foot.concat %w{buttons}
26
- end
27
- packages.remove = packages.index
28
- end
29
- end
30
- end
31
-
32
- end
33
- end
34
- end
@@ -1,34 +0,0 @@
1
- module Shop
2
- module Interface
3
- module Variants
4
-
5
- def self.included(base)
6
- base.send :include, InstanceMethods
7
- end
8
-
9
- module InstanceMethods
10
- attr_accessor :variants
11
-
12
- protected
13
-
14
- def load_default_shop_variants_regions
15
- returning OpenStruct.new do |variants|
16
- variants.edit = Radiant::AdminUI::RegionSet.new do |edit|
17
- edit.main.concat %w{head form popups}
18
- edit.form.concat %w{inputs meta parts foot}
19
- edit.foot.concat %w{buttons timestamp}
20
- end
21
- variants.new = variants.edit
22
- variants.index = Radiant::AdminUI::RegionSet.new do |index|
23
- index.head.concat %w{}
24
- index.body.concat %w{name modify}
25
- index.foot.concat %w{buttons}
26
- end
27
- variants.remove = variants.index
28
- end
29
- end
30
- end
31
-
32
- end
33
- end
34
- end
@@ -1,95 +0,0 @@
1
- module Shop
2
- module Tags
3
- module Package
4
- include Radiant::Taggable
5
- include ActionView::Helpers::NumberHelper
6
-
7
- tag 'shop:packages' do |tag|
8
- tag.locals.shop_packages = Helpers.current_packages(tag)
9
- tag.expand
10
- end
11
-
12
- desc %{ expands if there are packages within the context }
13
- tag 'shop:packages:if_packages' do |tag|
14
- tag.expand if tag.locals.shop_packages.present?
15
- end
16
-
17
- desc %{ expands if there are no packages within the context }
18
- tag 'shop:packages:unless_packages' do |tag|
19
- tag.expand unless tag.locals.shop_packages.present?
20
- end
21
-
22
- desc %{ iterates through each package within the scope }
23
- tag 'shop:packages:each' do |tag|
24
- content = ''
25
-
26
- tag.locals.shop_packages.each do |package|
27
- tag.locals.shop_package = package
28
- content << tag.expand
29
- end
30
-
31
- content
32
- end
33
-
34
- tag 'shop:package' do |tag|
35
- tag.locals.shop_package = Helpers.current_package(tag)
36
- tag.expand unless tag.locals.shop_package.nil?
37
- end
38
-
39
- [:id, :name, :sku].each do |symbol|
40
- desc %{ outputs the #{symbol} of the current package }
41
- tag "shop:package:#{symbol}" do |tag|
42
- tag.locals.shop_package.send(symbol)
43
- end
44
- end
45
-
46
- desc %{ outputs the description of the current packaage}
47
- tag "shop:package:description" do |tag|
48
- parse(TextileFilter.filter(tag.locals.shop_package.description))
49
- end
50
-
51
- [:price, :value].each do |symbol|
52
- desc %{ output #{symbol} of product }
53
- tag "shop:package:#{symbol}" do |tag|
54
- attr = tag.attr.symbolize_keys
55
- package = tag.locals.shop_package
56
-
57
- Helpers.currency(package.send(symbol),attr)
58
- end
59
- end
60
-
61
- desc %{ expands if the package has products }
62
- tag 'shop:package:if_products' do |tag|
63
- tag.expand unless tag.locals.shop_package.products.empty?
64
- end
65
-
66
- desc %{ expands if the package do not have products }
67
- tag 'shop:package:unless_products' do |tag|
68
- tag.expand if tag.locals.shop_package.products.empty?
69
- end
70
-
71
- tag 'shop:package:products' do |tag|
72
- tag.expand
73
- end
74
-
75
- desc %{ iterates through each of the products images }
76
- tag 'shop:package:products:each' do |tag|
77
- content = ''
78
-
79
- tag.locals.shop_package.packings.each do |packing|
80
- tag.locals.shop_product = packing.product
81
- tag.locals.shop_packing = packing
82
- content << tag.expand
83
- end
84
-
85
- content
86
- end
87
-
88
- desc %{ outputs the quantity of the current packing }
89
- tag 'shop:package:product:quantity' do |tag|
90
- tag.locals.shop_packing.quantity
91
- end
92
-
93
- end
94
- end
95
- end
@@ -1,52 +0,0 @@
1
- module Shop
2
- module Tags
3
- module ProductVariant
4
- include Radiant::Taggable
5
-
6
- tag 'shop:product:variants' do |tag|
7
- tag.locals.shop_product_variants = Helpers.current_product_variants(tag)
8
-
9
- tag.expand
10
- end
11
-
12
- tag 'shop:product:variants:if_variants' do |tag|
13
- tag.expand if tag.locals.shop_product_variants.present?
14
- end
15
-
16
- tag 'shop:product:variants:unless_variants' do |tag|
17
- tag.expand if tag.locals.shop_product_variants.empty?
18
- end
19
-
20
- tag 'shop:product:variants:each' do |tag|
21
- content = ''
22
-
23
- tag.locals.shop_product_variants.each do |variant|
24
- tag.locals.shop_product_variant = variant
25
- content << tag.expand
26
- end
27
-
28
- content
29
- end
30
-
31
- tag 'shop:product:variant' do |tag|
32
- tag.locals.shop_product_variant = Helpers.current_product_variant(tag)
33
- tag.expand if tag.locals.shop_product_variant.present?
34
- end
35
-
36
- [:id, :name, :sku].each do |symbol|
37
- desc %{ outputs the #{symbol} of the current shop variant }
38
- tag "shop:product:variant:#{symbol}" do |tag|
39
- tag.locals.shop_product_variant.send(symbol)
40
- end
41
- end
42
-
43
- desc %{ output price of variant }
44
- tag 'shop:product:variant:price' do |tag|
45
- attr = tag.attr.symbolize_keys
46
-
47
- Helpers.currency(tag.locals.shop_product_variant.price,attr)
48
- end
49
-
50
- end
51
- end
52
- end
@@ -1,34 +0,0 @@
1
- module Shop
2
- module Tags
3
- module Responses
4
- include Radiant::Taggable
5
-
6
- # Expand if there is a checkout response
7
- desc %{ Expand if there is a checkout response }
8
- tag 'response:checkout' do |tag|
9
- tag.locals.response_checkout = tag.locals.response.result[:results][:checkout]
10
-
11
- tag.expand if tag.locals.response_checkout.present?
12
- end
13
-
14
- # Expand if there is a checkout payment response
15
- desc %{ Expand if there is a checkout payment response }
16
- tag 'response:checkout:payment' do |tag|
17
- tag.expand
18
- end
19
-
20
- # Expand if the payment was successful
21
- desc %{ Expand if the payment was successful }
22
- tag 'response:checkout:payment:if_success' do |tag|
23
- tag.expand if tag.locals.response_checkout[:payment] === true
24
- end
25
-
26
- # Expand if the payment was not successful
27
- desc %{ Expand if the payment was not successful }
28
- tag 'response:checkout:payment:unless_success' do |tag|
29
- tag.expand if tag.locals.response_checkout[:payment] === false
30
- end
31
-
32
- end
33
- end
34
- end
File without changes
File without changes