kylekthompson-shoppe 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (239) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +55 -0
  4. data/Rakefile +36 -0
  5. data/app/assets/images/shoppe/chosen-sprite.png +0 -0
  6. data/app/assets/images/shoppe/chosen-sprite@2x.png +0 -0
  7. data/app/assets/images/shoppe/document.svg +1 -0
  8. data/app/assets/images/shoppe/icons/bag.svg +1 -0
  9. data/app/assets/images/shoppe/icons/balance.svg +1 -0
  10. data/app/assets/images/shoppe/icons/box.svg +1 -0
  11. data/app/assets/images/shoppe/icons/building.svg +1 -0
  12. data/app/assets/images/shoppe/icons/chart.svg +1 -0
  13. data/app/assets/images/shoppe/icons/chat.svg +1 -0
  14. data/app/assets/images/shoppe/icons/checkbox.svg +1 -0
  15. data/app/assets/images/shoppe/icons/checkbox2.svg +1 -0
  16. data/app/assets/images/shoppe/icons/cloud.svg +1 -0
  17. data/app/assets/images/shoppe/icons/cone.svg +1 -0
  18. data/app/assets/images/shoppe/icons/credit_card.svg +1 -0
  19. data/app/assets/images/shoppe/icons/currency.svg +1 -0
  20. data/app/assets/images/shoppe/icons/edit.svg +14 -0
  21. data/app/assets/images/shoppe/icons/flowchart.svg +1 -0
  22. data/app/assets/images/shoppe/icons/gift.svg +1 -0
  23. data/app/assets/images/shoppe/icons/globe.svg +1 -0
  24. data/app/assets/images/shoppe/icons/id.svg +1 -0
  25. data/app/assets/images/shoppe/icons/id2.svg +1 -0
  26. data/app/assets/images/shoppe/icons/locked.svg +1 -0
  27. data/app/assets/images/shoppe/icons/report.svg +1 -0
  28. data/app/assets/images/shoppe/icons/search.svg +1 -0
  29. data/app/assets/images/shoppe/icons/support.svg +1 -0
  30. data/app/assets/images/shoppe/icons/tags.svg +1 -0
  31. data/app/assets/images/shoppe/icons/toolbox.svg +1 -0
  32. data/app/assets/images/shoppe/icons/unlocked.svg +1 -0
  33. data/app/assets/images/shoppe/icons/wallet.svg +1 -0
  34. data/app/assets/images/shoppe/logo.svg +47 -0
  35. data/app/assets/images/shoppe/move.svg +1 -0
  36. data/app/assets/images/shoppe/shoppe.svg +25 -0
  37. data/app/assets/images/shoppe/square.svg +9 -0
  38. data/app/assets/images/shoppe/statuses/accepted.svg +14 -0
  39. data/app/assets/images/shoppe/statuses/paid.svg +16 -0
  40. data/app/assets/images/shoppe/statuses/received.svg +15 -0
  41. data/app/assets/images/shoppe/statuses/rejected.svg +14 -0
  42. data/app/assets/images/shoppe/statuses/shipped.svg +14 -0
  43. data/app/assets/images/shoppe/table-tear-off.png +0 -0
  44. data/app/assets/javascripts/shoppe/application.coffee +123 -0
  45. data/app/assets/javascripts/shoppe/chosen.jquery.js +1166 -0
  46. data/app/assets/javascripts/shoppe/jquery_ui.js +6 -0
  47. data/app/assets/javascripts/shoppe/mousetrap.js +9 -0
  48. data/app/assets/javascripts/shoppe/order_form.coffee +47 -0
  49. data/app/assets/stylesheets/shoppe/application.scss +601 -0
  50. data/app/assets/stylesheets/shoppe/chosen.scss +424 -0
  51. data/app/assets/stylesheets/shoppe/dialog.scss +25 -0
  52. data/app/assets/stylesheets/shoppe/elements.scss +79 -0
  53. data/app/assets/stylesheets/shoppe/printable.scss +67 -0
  54. data/app/assets/stylesheets/shoppe/reset.scss +93 -0
  55. data/app/assets/stylesheets/shoppe/sub.scss +106 -0
  56. data/app/assets/stylesheets/shoppe/variables.scss +1 -0
  57. data/app/controllers/shoppe/addresses_controller.rb +47 -0
  58. data/app/controllers/shoppe/application_controller.rb +46 -0
  59. data/app/controllers/shoppe/attachments_controller.rb +14 -0
  60. data/app/controllers/shoppe/countries_controller.rb +47 -0
  61. data/app/controllers/shoppe/customers_controller.rb +55 -0
  62. data/app/controllers/shoppe/dashboard_controller.rb +9 -0
  63. data/app/controllers/shoppe/delivery_service_prices_controller.rb +45 -0
  64. data/app/controllers/shoppe/delivery_services_controller.rb +47 -0
  65. data/app/controllers/shoppe/orders_controller.rb +119 -0
  66. data/app/controllers/shoppe/payments_controller.rb +33 -0
  67. data/app/controllers/shoppe/product_categories_controller.rb +47 -0
  68. data/app/controllers/shoppe/product_category_localisations_controller.rb +58 -0
  69. data/app/controllers/shoppe/product_localisations_controller.rb +58 -0
  70. data/app/controllers/shoppe/products_controller.rb +58 -0
  71. data/app/controllers/shoppe/sessions_controller.rb +34 -0
  72. data/app/controllers/shoppe/settings_controller.rb +16 -0
  73. data/app/controllers/shoppe/stock_level_adjustments_controller.rb +40 -0
  74. data/app/controllers/shoppe/tax_rates_controller.rb +49 -0
  75. data/app/controllers/shoppe/users_controller.rb +53 -0
  76. data/app/controllers/shoppe/variants_controller.rb +50 -0
  77. data/app/helpers/shoppe/application_helper.rb +60 -0
  78. data/app/helpers/shoppe/product_category_helper.rb +36 -0
  79. data/app/mailers/shoppe/order_mailer.rb +25 -0
  80. data/app/mailers/shoppe/user_mailer.rb +10 -0
  81. data/app/models/shoppe/address.rb +44 -0
  82. data/app/models/shoppe/country.rb +27 -0
  83. data/app/models/shoppe/customer.rb +41 -0
  84. data/app/models/shoppe/delivery_service.rb +33 -0
  85. data/app/models/shoppe/delivery_service_price.rb +31 -0
  86. data/app/models/shoppe/order.rb +100 -0
  87. data/app/models/shoppe/order/actions.rb +94 -0
  88. data/app/models/shoppe/order/billing.rb +105 -0
  89. data/app/models/shoppe/order/delivery.rb +229 -0
  90. data/app/models/shoppe/order/states.rb +69 -0
  91. data/app/models/shoppe/order_item.rb +239 -0
  92. data/app/models/shoppe/payment.rb +86 -0
  93. data/app/models/shoppe/product.rb +189 -0
  94. data/app/models/shoppe/product/product_attributes.rb +20 -0
  95. data/app/models/shoppe/product/variants.rb +51 -0
  96. data/app/models/shoppe/product_attribute.rb +66 -0
  97. data/app/models/shoppe/product_categorization.rb +14 -0
  98. data/app/models/shoppe/product_category.rb +75 -0
  99. data/app/models/shoppe/setting.rb +68 -0
  100. data/app/models/shoppe/stock_level_adjustment.rb +19 -0
  101. data/app/models/shoppe/tax_rate.rb +46 -0
  102. data/app/models/shoppe/user.rb +49 -0
  103. data/app/validators/permalink_validator.rb +7 -0
  104. data/app/views/layouts/shoppe/application.html.haml +34 -0
  105. data/app/views/layouts/shoppe/printable.html.haml +11 -0
  106. data/app/views/layouts/shoppe/sub.html.haml +10 -0
  107. data/app/views/shoppe/addresses/_form.html.haml +33 -0
  108. data/app/views/shoppe/addresses/edit.html.haml +5 -0
  109. data/app/views/shoppe/addresses/new.html.haml +5 -0
  110. data/app/views/shoppe/countries/_form.html.haml +35 -0
  111. data/app/views/shoppe/countries/edit.html.haml +6 -0
  112. data/app/views/shoppe/countries/index.html.haml +25 -0
  113. data/app/views/shoppe/countries/new.html.haml +7 -0
  114. data/app/views/shoppe/customers/_addresses.html.haml +20 -0
  115. data/app/views/shoppe/customers/_form.html.haml +30 -0
  116. data/app/views/shoppe/customers/_search_form.html.haml +13 -0
  117. data/app/views/shoppe/customers/edit.html.haml +5 -0
  118. data/app/views/shoppe/customers/index.html.haml +32 -0
  119. data/app/views/shoppe/customers/new.html.haml +5 -0
  120. data/app/views/shoppe/customers/show.html.haml +53 -0
  121. data/app/views/shoppe/delivery_service_prices/_form.html.haml +44 -0
  122. data/app/views/shoppe/delivery_service_prices/edit.html.haml +6 -0
  123. data/app/views/shoppe/delivery_service_prices/index.html.haml +23 -0
  124. data/app/views/shoppe/delivery_service_prices/new.html.haml +6 -0
  125. data/app/views/shoppe/delivery_services/_form.html.haml +38 -0
  126. data/app/views/shoppe/delivery_services/edit.html.haml +9 -0
  127. data/app/views/shoppe/delivery_services/index.html.haml +27 -0
  128. data/app/views/shoppe/delivery_services/new.html.haml +6 -0
  129. data/app/views/shoppe/order_mailer/accepted.text.erb +12 -0
  130. data/app/views/shoppe/order_mailer/received.text.erb +9 -0
  131. data/app/views/shoppe/order_mailer/rejected.text.erb +10 -0
  132. data/app/views/shoppe/order_mailer/shipped.text.erb +16 -0
  133. data/app/views/shoppe/orders/_form.html.haml +58 -0
  134. data/app/views/shoppe/orders/_order_details.html.haml +57 -0
  135. data/app/views/shoppe/orders/_order_items.html.haml +38 -0
  136. data/app/views/shoppe/orders/_order_items_form.html.haml +61 -0
  137. data/app/views/shoppe/orders/_payments_form.html.haml +15 -0
  138. data/app/views/shoppe/orders/_payments_table.html.haml +37 -0
  139. data/app/views/shoppe/orders/_search_form.html.haml +24 -0
  140. data/app/views/shoppe/orders/_status_bar.html.haml +35 -0
  141. data/app/views/shoppe/orders/despatch_note.html.haml +45 -0
  142. data/app/views/shoppe/orders/edit.html.haml +21 -0
  143. data/app/views/shoppe/orders/index.html.haml +39 -0
  144. data/app/views/shoppe/orders/new.html.haml +14 -0
  145. data/app/views/shoppe/orders/show.html.haml +25 -0
  146. data/app/views/shoppe/payments/refund.html.haml +13 -0
  147. data/app/views/shoppe/product_categories/_form.html.haml +50 -0
  148. data/app/views/shoppe/product_categories/edit.html.haml +8 -0
  149. data/app/views/shoppe/product_categories/index.html.haml +27 -0
  150. data/app/views/shoppe/product_categories/new.html.haml +6 -0
  151. data/app/views/shoppe/product_category_localisations/form.html.haml +29 -0
  152. data/app/views/shoppe/product_category_localisations/index.html.haml +26 -0
  153. data/app/views/shoppe/product_localisations/form.html.haml +32 -0
  154. data/app/views/shoppe/product_localisations/index.html.haml +26 -0
  155. data/app/views/shoppe/products/_form.html.haml +118 -0
  156. data/app/views/shoppe/products/_table.html.haml +42 -0
  157. data/app/views/shoppe/products/edit.html.haml +9 -0
  158. data/app/views/shoppe/products/import.html.haml +67 -0
  159. data/app/views/shoppe/products/index.html.haml +9 -0
  160. data/app/views/shoppe/products/new.html.haml +7 -0
  161. data/app/views/shoppe/sessions/new.html.haml +12 -0
  162. data/app/views/shoppe/sessions/reset.html.haml +12 -0
  163. data/app/views/shoppe/settings/edit.html.haml +19 -0
  164. data/app/views/shoppe/shared/error.html.haml +6 -0
  165. data/app/views/shoppe/stock_level_adjustments/index.html.haml +40 -0
  166. data/app/views/shoppe/tax_rates/form.html.haml +28 -0
  167. data/app/views/shoppe/tax_rates/index.html.haml +17 -0
  168. data/app/views/shoppe/user_mailer/new_password.text.erb +9 -0
  169. data/app/views/shoppe/users/_form.html.haml +27 -0
  170. data/app/views/shoppe/users/edit.html.haml +5 -0
  171. data/app/views/shoppe/users/index.html.haml +17 -0
  172. data/app/views/shoppe/users/new.html.haml +7 -0
  173. data/app/views/shoppe/variants/form.html.haml +68 -0
  174. data/app/views/shoppe/variants/index.html.haml +33 -0
  175. data/config/locales/de.yml +653 -0
  176. data/config/locales/en.yml +744 -0
  177. data/config/locales/es.yml +653 -0
  178. data/config/locales/pl.yml +662 -0
  179. data/config/locales/pt-BR.yml +655 -0
  180. data/config/routes.rb +53 -0
  181. data/db/countries.txt +252 -0
  182. data/db/migrate/20130926094549_create_shoppe_initial_schema.rb +175 -0
  183. data/db/migrate/20131024201501_add_address_type_to_shoppe_tax_rates.rb +5 -0
  184. data/db/migrate/20131024204815_create_shoppe_payments.rb +32 -0
  185. data/db/migrate/20131102143930_remove_default_on_order_item_weight.rb +9 -0
  186. data/db/migrate/20141013192427_create_shoppe_customers.rb +14 -0
  187. data/db/migrate/20141026175622_add_indexes_to_shoppe_order_items.rb +6 -0
  188. data/db/migrate/20141026175943_add_indexes_to_shoppe_orders.rb +7 -0
  189. data/db/migrate/20141026180333_add_indexes_to_shoppe_payments.rb +6 -0
  190. data/db/migrate/20141026180835_add_indexes_to_shoppe_product_attributes.rb +7 -0
  191. data/db/migrate/20141026180952_add_indexes_to_shoppe_product_categories.rb +5 -0
  192. data/db/migrate/20141026181040_add_indexes_to_shoppe_products.rb +8 -0
  193. data/db/migrate/20141026181312_add_indexes_to_shoppe_settings.rb +5 -0
  194. data/db/migrate/20141026181354_add_indexes_to_shoppe_stock_level_adjustments.rb +6 -0
  195. data/db/migrate/20141026181559_add_indexes_to_shoppe_users.rb +5 -0
  196. data/db/migrate/20141026181716_add_indexes_to_shoppe_delivery_services.rb +9 -0
  197. data/db/migrate/20141026181717_allow_multiple_shoppe_products_per_shoppe_product_category.rb +46 -0
  198. data/db/migrate/20141026181718_add_nested_to_product_categories.rb +30 -0
  199. data/db/migrate/20141027215005_create_shoppe_addresses.rb +17 -0
  200. data/db/migrate/20150315215633_add_customer_to_shoppe_orders.rb +5 -0
  201. data/db/migrate/20150513171350_create_shoppe_product_category_translation_table.rb +17 -0
  202. data/db/migrate/20150519173350_create_shoppe_product_translation_table.rb +18 -0
  203. data/db/schema.rb +308 -0
  204. data/db/seeds.rb +137 -0
  205. data/db/seeds_data/poe400.jpg +0 -0
  206. data/db/seeds_data/snom-870-blk.jpg +0 -0
  207. data/db/seeds_data/snom-870-grey.jpg +0 -0
  208. data/db/seeds_data/snom-mm2.jpg +0 -0
  209. data/db/seeds_data/spa303.jpg +0 -0
  210. data/db/seeds_data/t18p.jpg +0 -0
  211. data/db/seeds_data/t20p.jpg +0 -0
  212. data/db/seeds_data/t22p.jpg +0 -0
  213. data/db/seeds_data/t26p.jpg +0 -0
  214. data/db/seeds_data/t41pn.jpg +0 -0
  215. data/db/seeds_data/t46gn.jpg +0 -0
  216. data/db/seeds_data/w52p.jpg +0 -0
  217. data/db/seeds_data/yhs32.jpg +0 -0
  218. data/lib/shoppe.rb +60 -0
  219. data/lib/shoppe/associated_countries.rb +20 -0
  220. data/lib/shoppe/country_importer.rb +15 -0
  221. data/lib/shoppe/default_navigation.rb +21 -0
  222. data/lib/shoppe/engine.rb +55 -0
  223. data/lib/shoppe/error.rb +21 -0
  224. data/lib/shoppe/errors/inappropriate_delivery_service.rb +6 -0
  225. data/lib/shoppe/errors/insufficient_stock_to_fulfil.rb +15 -0
  226. data/lib/shoppe/errors/invalid_configuration.rb +6 -0
  227. data/lib/shoppe/errors/not_enough_stock.rb +15 -0
  228. data/lib/shoppe/errors/payment_declined.rb +6 -0
  229. data/lib/shoppe/errors/refund_failed.rb +6 -0
  230. data/lib/shoppe/errors/unorderable_item.rb +6 -0
  231. data/lib/shoppe/navigation_manager.rb +81 -0
  232. data/lib/shoppe/orderable_item.rb +39 -0
  233. data/lib/shoppe/settings.rb +26 -0
  234. data/lib/shoppe/settings_loader.rb +16 -0
  235. data/lib/shoppe/setup_generator.rb +10 -0
  236. data/lib/shoppe/version.rb +3 -0
  237. data/lib/shoppe/view_helpers.rb +16 -0
  238. data/lib/tasks/shoppe.rake +29 -0
  239. metadata +662 -0
@@ -0,0 +1,5 @@
1
+ class AddAddressTypeToShoppeTaxRates < ActiveRecord::Migration
2
+ def change
3
+ add_column :shoppe_tax_rates, :address_type, :string
4
+ end
5
+ end
@@ -0,0 +1,32 @@
1
+ class CreateShoppePayments < ActiveRecord::Migration
2
+ def up
3
+ create_table :shoppe_payments do |t|
4
+ t.integer :order_id
5
+ t.decimal :amount, :precision => 8, :scale => 2, :default => 0.0
6
+ t.string :reference, :method
7
+ t.boolean :confirmed, :default => true
8
+ t.boolean :refundable, :default => false
9
+ t.decimal :amount_refunded, :precision => 8, :scale => 2, :default => 0.0
10
+ t.integer :parent_payment_id
11
+ t.boolean :exported, :default => false
12
+ t.timestamps
13
+ end
14
+ remove_column :shoppe_orders, :paid_at
15
+ remove_column :shoppe_orders, :payment_reference
16
+ remove_column :shoppe_orders, :payment_method
17
+
18
+ add_column :shoppe_orders, :amount_paid, :decimal, :precision => 8, :scale => 2, :default => 0.0
19
+ add_column :shoppe_orders, :exported, :boolean, :default => false
20
+ add_column :shoppe_orders, :invoice_number, :string
21
+ end
22
+
23
+ def down
24
+ drop_table :shoppe_payments
25
+ add_column :shoppe_orders, :paid_at, :datetime
26
+ add_column :shoppe_orders, :payment_reference, :string
27
+ add_column :shoppe_orders, :payment_method, :string
28
+ remove_column :shoppe_orders, :amount_paid
29
+ remove_column :shoppe_orders, :exported
30
+ remove_column :shoppe_orders, :invoice_number
31
+ end
32
+ end
@@ -0,0 +1,9 @@
1
+ class RemoveDefaultOnOrderItemWeight < ActiveRecord::Migration
2
+ def up
3
+ change_column_default :shoppe_order_items, :weight, nil
4
+ end
5
+
6
+ def down
7
+ change_column_default :shoppe_order_items, :weight, 0.0
8
+ end
9
+ end
@@ -0,0 +1,14 @@
1
+ class CreateShoppeCustomers < ActiveRecord::Migration
2
+ def change
3
+ create_table :shoppe_customers do |t|
4
+ t.string :first_name
5
+ t.string :last_name
6
+ t.string :company
7
+ t.string :email
8
+ t.string :phone
9
+ t.string :mobile
10
+
11
+ t.timestamps
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,6 @@
1
+ class AddIndexesToShoppeOrderItems < ActiveRecord::Migration
2
+ def change
3
+ add_index :shoppe_order_items, [:ordered_item_id, :ordered_item_type], name: 'index_shoppe_order_items_ordered_item'
4
+ add_index :shoppe_order_items, :order_id
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ class AddIndexesToShoppeOrders < ActiveRecord::Migration
2
+ def change
3
+ add_index :shoppe_orders, :token
4
+ add_index :shoppe_orders, :delivery_service_id
5
+ add_index :shoppe_orders, :received_at
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ class AddIndexesToShoppePayments < ActiveRecord::Migration
2
+ def change
3
+ add_index :shoppe_payments, :order_id
4
+ add_index :shoppe_payments, :parent_payment_id
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ class AddIndexesToShoppeProductAttributes < ActiveRecord::Migration
2
+ def change
3
+ add_index :shoppe_product_attributes, :product_id
4
+ add_index :shoppe_product_attributes, :key
5
+ add_index :shoppe_product_attributes, :position
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ class AddIndexesToShoppeProductCategories < ActiveRecord::Migration
2
+ def change
3
+ add_index :shoppe_product_categories, :permalink
4
+ end
5
+ end
@@ -0,0 +1,8 @@
1
+ class AddIndexesToShoppeProducts < ActiveRecord::Migration
2
+ def change
3
+ add_index :shoppe_products, :parent_id
4
+ add_index :shoppe_products, :sku
5
+ add_index :shoppe_products, :product_category_id
6
+ add_index :shoppe_products, :permalink
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ class AddIndexesToShoppeSettings < ActiveRecord::Migration
2
+ def change
3
+ add_index :shoppe_settings, :key
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ class AddIndexesToShoppeStockLevelAdjustments < ActiveRecord::Migration
2
+ def change
3
+ add_index :shoppe_stock_level_adjustments, [:item_id, :item_type], name: 'index_shoppe_stock_level_adjustments_items'
4
+ add_index :shoppe_stock_level_adjustments, [:parent_id, :parent_type], name: 'index_shoppe_stock_level_adjustments_parent'
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ class AddIndexesToShoppeUsers < ActiveRecord::Migration
2
+ def change
3
+ add_index :shoppe_users, :email_address
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ class AddIndexesToShoppeDeliveryServices < ActiveRecord::Migration
2
+ def change
3
+ add_index :shoppe_delivery_services, :active
4
+ add_index :shoppe_delivery_service_prices, :delivery_service_id
5
+ add_index :shoppe_delivery_service_prices, :min_weight
6
+ add_index :shoppe_delivery_service_prices, :max_weight
7
+ add_index :shoppe_delivery_service_prices, :price
8
+ end
9
+ end
@@ -0,0 +1,46 @@
1
+ class AllowMultipleShoppeProductsPerShoppeProductCategory < ActiveRecord::Migration
2
+ def up
3
+ # create our join table first before we migrate
4
+ # we have an id to allow :restrict_with_exception on product_category
5
+ create_table :shoppe_product_categorizations do |t|
6
+ t.integer :product_id, null: false
7
+ t.integer :product_category_id, null: false
8
+ end
9
+ add_index :shoppe_product_categorizations, :product_id, name: 'categorization_by_product_id'
10
+ add_index :shoppe_product_categorizations, :product_category_id, name: 'categorization_by_product_category_id'
11
+ # define the old belongs_to association (as it's no longer on the model)
12
+ Shoppe::Product.class_eval do
13
+ belongs_to :old_category,
14
+ :class_name => "Shoppe::ProductCategory",
15
+ :foreign_key => "product_category_id"
16
+ end
17
+ # migrate over to our new join table
18
+ Shoppe::Product.all.each do |product|
19
+ product.product_categories << product.old_category
20
+ product.save
21
+ end
22
+ # lastly, remove the old product_category_id and associated index
23
+ remove_index :shoppe_products, :product_category_id if index_exists?(:shoppe_products, :product_category_id)
24
+ remove_column :shoppe_products, :product_category_id
25
+ end
26
+
27
+ def down
28
+ # first, we re-add our column so we've got something to populate
29
+ add_column :shoppe_products, :product_category_id, :integer
30
+ add_index :shoppe_products, :product_category_id
31
+ # define the old belongs_to association once again as we're going to re-add our goodies
32
+ Shoppe::Product.class_eval do
33
+ belongs_to :new_category,
34
+ :class_name => "Shoppe::ProductCategory",
35
+ :foreign_key => "product_category_id"
36
+ end
37
+ # migrate over from the new table to the old association
38
+ Shoppe::Product.all.each do |product|
39
+ next unless product.product_categories.count
40
+ product.new_category = product.product_categories.first
41
+ product.save
42
+ end
43
+ # drop our join table
44
+ drop_table :shoppe_product_categorizations
45
+ end
46
+ end
@@ -0,0 +1,30 @@
1
+ class AddNestedToProductCategories < ActiveRecord::Migration
2
+ def up
3
+ add_column :shoppe_product_categories, :parent_id, :integer
4
+ add_column :shoppe_product_categories, :lft, :integer
5
+ add_column :shoppe_product_categories, :rgt, :integer
6
+ add_column :shoppe_product_categories, :depth, :integer
7
+
8
+ add_index :shoppe_product_categories, :lft
9
+ add_index :shoppe_product_categories, :rgt
10
+
11
+ add_column :shoppe_product_categories, :ancestral_permalink, :string
12
+ add_column :shoppe_product_categories, :permalink_includes_ancestors, :boolean, default: false
13
+
14
+ Shoppe::ProductCategory.reset_column_information
15
+ Shoppe::ProductCategory.rebuild!
16
+ end
17
+
18
+ def down
19
+ remove_column :shoppe_product_categories, :ancestral_permalink
20
+ remove_column :shoppe_product_categories, :permalink_includes_ancestors
21
+
22
+ remove_index :shoppe_product_categories, :lft
23
+ remove_index :shoppe_product_categories, :rgt
24
+
25
+ remove_column :shoppe_product_categories, :parent_id
26
+ remove_column :shoppe_product_categories, :lft
27
+ remove_column :shoppe_product_categories, :rgt
28
+ remove_column :shoppe_product_categories, :depth
29
+ end
30
+ end
@@ -0,0 +1,17 @@
1
+ class CreateShoppeAddresses < ActiveRecord::Migration
2
+ def change
3
+ create_table :shoppe_addresses do |t|
4
+ t.belongs_to :customer, index: true
5
+ t.string :address_type
6
+ t.boolean :default
7
+ t.string :address1
8
+ t.string :address2
9
+ t.string :address3
10
+ t.string :address4
11
+ t.string :postcode
12
+ t.integer :country_id
13
+
14
+ t.timestamps
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,5 @@
1
+ class AddCustomerToShoppeOrders < ActiveRecord::Migration
2
+ def change
3
+ add_column :shoppe_orders, :customer_id, :integer
4
+ end
5
+ end
@@ -0,0 +1,17 @@
1
+ class CreateShoppeProductCategoryTranslationTable < ActiveRecord::Migration
2
+ def up
3
+ Shoppe::ProductCategory.create_translation_table! :name => :string, :permalink => :string, :description => :text
4
+
5
+ Shoppe::ProductCategory.all.each do |pc|
6
+ l = pc.translations.new
7
+ l.locale = "en"
8
+ l.name = pc.name
9
+ l.permalink = pc.permalink
10
+ l.description = pc.description
11
+ l.save!
12
+ end
13
+ end
14
+ def down
15
+ Shoppe::ProductCategory.drop_translation_table!
16
+ end
17
+ end
@@ -0,0 +1,18 @@
1
+ class CreateShoppeProductTranslationTable < ActiveRecord::Migration
2
+ def up
3
+ Shoppe::Product.create_translation_table! :name => :string, :permalink => :string, :description => :text, :short_description => :text
4
+
5
+ Shoppe::Product.all.each do |p|
6
+ l = p.translations.new
7
+ l.locale = "en"
8
+ l.name = p.name
9
+ l.permalink = p.permalink
10
+ l.description = p.description
11
+ l.short_description = p.short_description
12
+ l.save!
13
+ end
14
+ end
15
+ def down
16
+ Shoppe::Product.drop_translation_table!
17
+ end
18
+ end
@@ -0,0 +1,308 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended that you check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(version: 20150315223628) do
15
+
16
+ create_table "nifty_attachments", force: true do |t|
17
+ t.integer "parent_id"
18
+ t.string "parent_type"
19
+ t.string "token"
20
+ t.string "digest"
21
+ t.string "role"
22
+ t.string "file_name"
23
+ t.string "file_type"
24
+ t.binary "data", limit: 16777215
25
+ t.datetime "created_at"
26
+ t.datetime "updated_at"
27
+ end
28
+
29
+ create_table "nifty_key_value_store", force: true do |t|
30
+ t.integer "parent_id"
31
+ t.string "parent_type"
32
+ t.string "group"
33
+ t.string "name"
34
+ t.string "value"
35
+ end
36
+
37
+ create_table "shoppe_addresses", force: true do |t|
38
+ t.integer "customer_id"
39
+ t.string "address_type"
40
+ t.boolean "default"
41
+ t.string "address1"
42
+ t.string "address2"
43
+ t.string "address3"
44
+ t.string "address4"
45
+ t.string "postcode"
46
+ t.integer "country_id"
47
+ t.datetime "created_at"
48
+ t.datetime "updated_at"
49
+ end
50
+
51
+ add_index "shoppe_addresses", ["customer_id"], name: "index_shoppe_addresses_on_customer_id", using: :btree
52
+
53
+ create_table "shoppe_attachments", force: true do |t|
54
+ t.integer "parent_id", null: false
55
+ t.string "parent_type", null: false
56
+ t.string "token"
57
+ t.string "file", null: false
58
+ t.string "file_name"
59
+ t.integer "file_size"
60
+ t.string "file_type"
61
+ t.string "role"
62
+ t.datetime "created_at"
63
+ t.datetime "updated_at"
64
+ end
65
+
66
+ create_table "shoppe_countries", force: true do |t|
67
+ t.string "name"
68
+ t.string "code2"
69
+ t.string "code3"
70
+ t.string "continent"
71
+ t.string "tld"
72
+ t.string "currency"
73
+ t.boolean "eu_member", default: false
74
+ end
75
+
76
+ create_table "shoppe_customers", force: true do |t|
77
+ t.string "first_name"
78
+ t.string "last_name"
79
+ t.string "company"
80
+ t.string "email"
81
+ t.string "phone"
82
+ t.string "mobile"
83
+ t.datetime "created_at"
84
+ t.datetime "updated_at"
85
+ end
86
+
87
+ create_table "shoppe_delivery_service_prices", force: true do |t|
88
+ t.integer "delivery_service_id"
89
+ t.string "code"
90
+ t.decimal "price", precision: 8, scale: 2
91
+ t.decimal "cost_price", precision: 8, scale: 2
92
+ t.integer "tax_rate_id"
93
+ t.decimal "min_weight", precision: 8, scale: 2
94
+ t.decimal "max_weight", precision: 8, scale: 2
95
+ t.datetime "created_at"
96
+ t.datetime "updated_at"
97
+ t.text "country_ids"
98
+ end
99
+
100
+ add_index "shoppe_delivery_service_prices", ["delivery_service_id"], name: "index_shoppe_delivery_service_prices_on_delivery_service_id", using: :btree
101
+ add_index "shoppe_delivery_service_prices", ["max_weight"], name: "index_shoppe_delivery_service_prices_on_max_weight", using: :btree
102
+ add_index "shoppe_delivery_service_prices", ["min_weight"], name: "index_shoppe_delivery_service_prices_on_min_weight", using: :btree
103
+ add_index "shoppe_delivery_service_prices", ["price"], name: "index_shoppe_delivery_service_prices_on_price", using: :btree
104
+
105
+ create_table "shoppe_delivery_services", force: true do |t|
106
+ t.string "name"
107
+ t.string "code"
108
+ t.boolean "default", default: false
109
+ t.boolean "active", default: true
110
+ t.datetime "created_at"
111
+ t.datetime "updated_at"
112
+ t.string "courier"
113
+ t.string "tracking_url"
114
+ end
115
+
116
+ add_index "shoppe_delivery_services", ["active"], name: "index_shoppe_delivery_services_on_active", using: :btree
117
+
118
+ create_table "shoppe_order_items", force: true do |t|
119
+ t.integer "order_id"
120
+ t.integer "ordered_item_id"
121
+ t.string "ordered_item_type"
122
+ t.integer "quantity", default: 1
123
+ t.decimal "unit_price", precision: 8, scale: 2
124
+ t.decimal "unit_cost_price", precision: 8, scale: 2
125
+ t.decimal "tax_amount", precision: 8, scale: 2
126
+ t.decimal "tax_rate", precision: 8, scale: 2
127
+ t.decimal "weight", precision: 8, scale: 3
128
+ t.datetime "created_at"
129
+ t.datetime "updated_at"
130
+ end
131
+
132
+ add_index "shoppe_order_items", ["order_id"], name: "index_shoppe_order_items_on_order_id", using: :btree
133
+ add_index "shoppe_order_items", ["ordered_item_id", "ordered_item_type"], name: "index_shoppe_order_items_ordered_item", using: :btree
134
+
135
+ create_table "shoppe_orders", force: true do |t|
136
+ t.string "token"
137
+ t.string "first_name"
138
+ t.string "last_name"
139
+ t.string "company"
140
+ t.string "billing_address1"
141
+ t.string "billing_address2"
142
+ t.string "billing_address3"
143
+ t.string "billing_address4"
144
+ t.string "billing_postcode"
145
+ t.integer "billing_country_id"
146
+ t.string "email_address"
147
+ t.string "phone_number"
148
+ t.string "status"
149
+ t.datetime "received_at"
150
+ t.datetime "accepted_at"
151
+ t.datetime "shipped_at"
152
+ t.datetime "created_at"
153
+ t.datetime "updated_at"
154
+ t.integer "delivery_service_id"
155
+ t.decimal "delivery_price", precision: 8, scale: 2
156
+ t.decimal "delivery_cost_price", precision: 8, scale: 2
157
+ t.decimal "delivery_tax_rate", precision: 8, scale: 2
158
+ t.decimal "delivery_tax_amount", precision: 8, scale: 2
159
+ t.integer "accepted_by"
160
+ t.integer "shipped_by"
161
+ t.string "consignment_number"
162
+ t.datetime "rejected_at"
163
+ t.integer "rejected_by"
164
+ t.string "ip_address"
165
+ t.text "notes"
166
+ t.boolean "separate_delivery_address", default: false
167
+ t.string "delivery_name"
168
+ t.string "delivery_address1"
169
+ t.string "delivery_address2"
170
+ t.string "delivery_address3"
171
+ t.string "delivery_address4"
172
+ t.string "delivery_postcode"
173
+ t.integer "delivery_country_id"
174
+ t.decimal "amount_paid", precision: 8, scale: 2, default: 0.0
175
+ t.boolean "exported", default: false
176
+ t.string "invoice_number"
177
+ t.integer "customer_id"
178
+ end
179
+
180
+ add_index "shoppe_orders", ["delivery_service_id"], name: "index_shoppe_orders_on_delivery_service_id", using: :btree
181
+ add_index "shoppe_orders", ["received_at"], name: "index_shoppe_orders_on_received_at", using: :btree
182
+ add_index "shoppe_orders", ["token"], name: "index_shoppe_orders_on_token", using: :btree
183
+
184
+ create_table "shoppe_payments", force: true do |t|
185
+ t.integer "order_id"
186
+ t.decimal "amount", precision: 8, scale: 2, default: 0.0
187
+ t.string "reference"
188
+ t.string "method"
189
+ t.boolean "confirmed", default: true
190
+ t.boolean "refundable", default: false
191
+ t.decimal "amount_refunded", precision: 8, scale: 2, default: 0.0
192
+ t.integer "parent_payment_id"
193
+ t.boolean "exported", default: false
194
+ t.datetime "created_at"
195
+ t.datetime "updated_at"
196
+ end
197
+
198
+ add_index "shoppe_payments", ["order_id"], name: "index_shoppe_payments_on_order_id", using: :btree
199
+ add_index "shoppe_payments", ["parent_payment_id"], name: "index_shoppe_payments_on_parent_payment_id", using: :btree
200
+
201
+ create_table "shoppe_product_attributes", force: true do |t|
202
+ t.integer "product_id"
203
+ t.string "key"
204
+ t.string "value"
205
+ t.integer "position", default: 1
206
+ t.boolean "searchable", default: true
207
+ t.datetime "created_at"
208
+ t.datetime "updated_at"
209
+ t.boolean "public", default: true
210
+ end
211
+
212
+ add_index "shoppe_product_attributes", ["key"], name: "index_shoppe_product_attributes_on_key", using: :btree
213
+ add_index "shoppe_product_attributes", ["position"], name: "index_shoppe_product_attributes_on_position", using: :btree
214
+ add_index "shoppe_product_attributes", ["product_id"], name: "index_shoppe_product_attributes_on_product_id", using: :btree
215
+
216
+ create_table "shoppe_product_categories", force: true do |t|
217
+ t.string "name"
218
+ t.string "permalink"
219
+ t.text "description"
220
+ t.datetime "created_at"
221
+ t.datetime "updated_at"
222
+ t.integer "parent_id"
223
+ t.integer "lft"
224
+ t.integer "rgt"
225
+ t.integer "depth"
226
+ t.string "ancestral_permalink"
227
+ t.boolean "permalink_includes_ancestors", default: false
228
+ end
229
+
230
+ add_index "shoppe_product_categories", ["lft"], name: "index_shoppe_product_categories_on_lft", using: :btree
231
+ add_index "shoppe_product_categories", ["permalink"], name: "index_shoppe_product_categories_on_permalink", using: :btree
232
+ add_index "shoppe_product_categories", ["rgt"], name: "index_shoppe_product_categories_on_rgt", using: :btree
233
+
234
+ create_table "shoppe_product_categorizations", force: true do |t|
235
+ t.integer "product_id", null: false
236
+ t.integer "product_category_id", null: false
237
+ end
238
+
239
+ add_index "shoppe_product_categorizations", ["product_category_id"], name: "categorization_by_product_category_id", using: :btree
240
+ add_index "shoppe_product_categorizations", ["product_id"], name: "categorization_by_product_id", using: :btree
241
+
242
+ create_table "shoppe_products", force: true do |t|
243
+ t.integer "parent_id"
244
+ t.string "name"
245
+ t.string "sku"
246
+ t.string "permalink"
247
+ t.text "description"
248
+ t.text "short_description"
249
+ t.boolean "active", default: true
250
+ t.decimal "weight", precision: 8, scale: 3, default: 0.0
251
+ t.decimal "price", precision: 8, scale: 2, default: 0.0
252
+ t.decimal "cost_price", precision: 8, scale: 2, default: 0.0
253
+ t.integer "tax_rate_id"
254
+ t.datetime "created_at"
255
+ t.datetime "updated_at"
256
+ t.boolean "featured", default: false
257
+ t.text "in_the_box"
258
+ t.boolean "stock_control", default: true
259
+ t.boolean "default", default: false
260
+ end
261
+
262
+ add_index "shoppe_products", ["parent_id"], name: "index_shoppe_products_on_parent_id", using: :btree
263
+ add_index "shoppe_products", ["permalink"], name: "index_shoppe_products_on_permalink", using: :btree
264
+ add_index "shoppe_products", ["sku"], name: "index_shoppe_products_on_sku", using: :btree
265
+
266
+ create_table "shoppe_settings", force: true do |t|
267
+ t.string "key"
268
+ t.string "value"
269
+ t.string "value_type"
270
+ end
271
+
272
+ add_index "shoppe_settings", ["key"], name: "index_shoppe_settings_on_key", using: :btree
273
+
274
+ create_table "shoppe_stock_level_adjustments", force: true do |t|
275
+ t.integer "item_id"
276
+ t.string "item_type"
277
+ t.string "description"
278
+ t.integer "adjustment", default: 0
279
+ t.string "parent_type"
280
+ t.integer "parent_id"
281
+ t.datetime "created_at"
282
+ t.datetime "updated_at"
283
+ end
284
+
285
+ add_index "shoppe_stock_level_adjustments", ["item_id", "item_type"], name: "index_shoppe_stock_level_adjustments_items", using: :btree
286
+ add_index "shoppe_stock_level_adjustments", ["parent_id", "parent_type"], name: "index_shoppe_stock_level_adjustments_parent", using: :btree
287
+
288
+ create_table "shoppe_tax_rates", force: true do |t|
289
+ t.string "name"
290
+ t.decimal "rate", precision: 8, scale: 2
291
+ t.datetime "created_at"
292
+ t.datetime "updated_at"
293
+ t.text "country_ids"
294
+ t.string "address_type"
295
+ end
296
+
297
+ create_table "shoppe_users", force: true do |t|
298
+ t.string "first_name"
299
+ t.string "last_name"
300
+ t.string "email_address"
301
+ t.string "password_digest"
302
+ t.datetime "created_at"
303
+ t.datetime "updated_at"
304
+ end
305
+
306
+ add_index "shoppe_users", ["email_address"], name: "index_shoppe_users_on_email_address", using: :btree
307
+
308
+ end