kylekthompson_shoppe 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
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/kylekthompson_shoppe/chosen-sprite.png +0 -0
  6. data/app/assets/images/kylekthompson_shoppe/chosen-sprite@2x.png +0 -0
  7. data/app/assets/images/kylekthompson_shoppe/document.svg +1 -0
  8. data/app/assets/images/kylekthompson_shoppe/icons/bag.svg +1 -0
  9. data/app/assets/images/kylekthompson_shoppe/icons/balance.svg +1 -0
  10. data/app/assets/images/kylekthompson_shoppe/icons/box.svg +1 -0
  11. data/app/assets/images/kylekthompson_shoppe/icons/building.svg +1 -0
  12. data/app/assets/images/kylekthompson_shoppe/icons/chart.svg +1 -0
  13. data/app/assets/images/kylekthompson_shoppe/icons/chat.svg +1 -0
  14. data/app/assets/images/kylekthompson_shoppe/icons/checkbox.svg +1 -0
  15. data/app/assets/images/kylekthompson_shoppe/icons/checkbox2.svg +1 -0
  16. data/app/assets/images/kylekthompson_shoppe/icons/cloud.svg +1 -0
  17. data/app/assets/images/kylekthompson_shoppe/icons/cone.svg +1 -0
  18. data/app/assets/images/kylekthompson_shoppe/icons/credit_card.svg +1 -0
  19. data/app/assets/images/kylekthompson_shoppe/icons/currency.svg +1 -0
  20. data/app/assets/images/kylekthompson_shoppe/icons/edit.svg +14 -0
  21. data/app/assets/images/kylekthompson_shoppe/icons/flowchart.svg +1 -0
  22. data/app/assets/images/kylekthompson_shoppe/icons/gift.svg +1 -0
  23. data/app/assets/images/kylekthompson_shoppe/icons/globe.svg +1 -0
  24. data/app/assets/images/kylekthompson_shoppe/icons/id.svg +1 -0
  25. data/app/assets/images/kylekthompson_shoppe/icons/id2.svg +1 -0
  26. data/app/assets/images/kylekthompson_shoppe/icons/locked.svg +1 -0
  27. data/app/assets/images/kylekthompson_shoppe/icons/report.svg +1 -0
  28. data/app/assets/images/kylekthompson_shoppe/icons/search.svg +1 -0
  29. data/app/assets/images/kylekthompson_shoppe/icons/support.svg +1 -0
  30. data/app/assets/images/kylekthompson_shoppe/icons/tags.svg +1 -0
  31. data/app/assets/images/kylekthompson_shoppe/icons/toolbox.svg +1 -0
  32. data/app/assets/images/kylekthompson_shoppe/icons/unlocked.svg +1 -0
  33. data/app/assets/images/kylekthompson_shoppe/icons/wallet.svg +1 -0
  34. data/app/assets/images/kylekthompson_shoppe/kylekthompson_shoppe.svg +25 -0
  35. data/app/assets/images/kylekthompson_shoppe/logo.svg +47 -0
  36. data/app/assets/images/kylekthompson_shoppe/move.svg +1 -0
  37. data/app/assets/images/kylekthompson_shoppe/square.svg +9 -0
  38. data/app/assets/images/kylekthompson_shoppe/statuses/accepted.svg +14 -0
  39. data/app/assets/images/kylekthompson_shoppe/statuses/paid.svg +16 -0
  40. data/app/assets/images/kylekthompson_shoppe/statuses/received.svg +15 -0
  41. data/app/assets/images/kylekthompson_shoppe/statuses/rejected.svg +14 -0
  42. data/app/assets/images/kylekthompson_shoppe/statuses/shipped.svg +14 -0
  43. data/app/assets/images/kylekthompson_shoppe/table-tear-off.png +0 -0
  44. data/app/assets/javascripts/kylekthompson_shoppe/application.coffee +123 -0
  45. data/app/assets/javascripts/kylekthompson_shoppe/chosen.jquery.js +1166 -0
  46. data/app/assets/javascripts/kylekthompson_shoppe/jquery_ui.js +6 -0
  47. data/app/assets/javascripts/kylekthompson_shoppe/mousetrap.js +9 -0
  48. data/app/assets/javascripts/kylekthompson_shoppe/order_form.coffee +47 -0
  49. data/app/assets/stylesheets/kylekthompson_shoppe/application.scss +601 -0
  50. data/app/assets/stylesheets/kylekthompson_shoppe/chosen.scss +424 -0
  51. data/app/assets/stylesheets/kylekthompson_shoppe/dialog.scss +25 -0
  52. data/app/assets/stylesheets/kylekthompson_shoppe/elements.scss +79 -0
  53. data/app/assets/stylesheets/kylekthompson_shoppe/printable.scss +67 -0
  54. data/app/assets/stylesheets/kylekthompson_shoppe/reset.scss +93 -0
  55. data/app/assets/stylesheets/kylekthompson_shoppe/sub.scss +106 -0
  56. data/app/assets/stylesheets/kylekthompson_shoppe/variables.scss +1 -0
  57. data/app/controllers/kylekthompson_shoppe/addresses_controller.rb +47 -0
  58. data/app/controllers/kylekthompson_shoppe/application_controller.rb +46 -0
  59. data/app/controllers/kylekthompson_shoppe/attachments_controller.rb +14 -0
  60. data/app/controllers/kylekthompson_shoppe/countries_controller.rb +47 -0
  61. data/app/controllers/kylekthompson_shoppe/customers_controller.rb +55 -0
  62. data/app/controllers/kylekthompson_shoppe/dashboard_controller.rb +9 -0
  63. data/app/controllers/kylekthompson_shoppe/delivery_service_prices_controller.rb +45 -0
  64. data/app/controllers/kylekthompson_shoppe/delivery_services_controller.rb +47 -0
  65. data/app/controllers/kylekthompson_shoppe/orders_controller.rb +119 -0
  66. data/app/controllers/kylekthompson_shoppe/payments_controller.rb +33 -0
  67. data/app/controllers/kylekthompson_shoppe/product_categories_controller.rb +47 -0
  68. data/app/controllers/kylekthompson_shoppe/product_category_localisations_controller.rb +58 -0
  69. data/app/controllers/kylekthompson_shoppe/product_localisations_controller.rb +58 -0
  70. data/app/controllers/kylekthompson_shoppe/products_controller.rb +58 -0
  71. data/app/controllers/kylekthompson_shoppe/sessions_controller.rb +34 -0
  72. data/app/controllers/kylekthompson_shoppe/settings_controller.rb +16 -0
  73. data/app/controllers/kylekthompson_shoppe/stock_level_adjustments_controller.rb +40 -0
  74. data/app/controllers/kylekthompson_shoppe/tax_rates_controller.rb +49 -0
  75. data/app/controllers/kylekthompson_shoppe/users_controller.rb +53 -0
  76. data/app/controllers/kylekthompson_shoppe/variants_controller.rb +50 -0
  77. data/app/helpers/kylekthompson_shoppe/application_helper.rb +60 -0
  78. data/app/helpers/kylekthompson_shoppe/product_category_helper.rb +36 -0
  79. data/app/mailers/kylekthompson_shoppe/order_mailer.rb +25 -0
  80. data/app/mailers/kylekthompson_shoppe/user_mailer.rb +10 -0
  81. data/app/models/kylekthompson_shoppe/address.rb +44 -0
  82. data/app/models/kylekthompson_shoppe/country.rb +27 -0
  83. data/app/models/kylekthompson_shoppe/customer.rb +41 -0
  84. data/app/models/kylekthompson_shoppe/delivery_service.rb +33 -0
  85. data/app/models/kylekthompson_shoppe/delivery_service_price.rb +31 -0
  86. data/app/models/kylekthompson_shoppe/order/actions.rb +94 -0
  87. data/app/models/kylekthompson_shoppe/order/billing.rb +105 -0
  88. data/app/models/kylekthompson_shoppe/order/delivery.rb +229 -0
  89. data/app/models/kylekthompson_shoppe/order/states.rb +69 -0
  90. data/app/models/kylekthompson_shoppe/order.rb +100 -0
  91. data/app/models/kylekthompson_shoppe/order_item.rb +239 -0
  92. data/app/models/kylekthompson_shoppe/payment.rb +86 -0
  93. data/app/models/kylekthompson_shoppe/product/product_attributes.rb +20 -0
  94. data/app/models/kylekthompson_shoppe/product/variants.rb +51 -0
  95. data/app/models/kylekthompson_shoppe/product.rb +189 -0
  96. data/app/models/kylekthompson_shoppe/product_attribute.rb +66 -0
  97. data/app/models/kylekthompson_shoppe/product_categorization.rb +14 -0
  98. data/app/models/kylekthompson_shoppe/product_category.rb +75 -0
  99. data/app/models/kylekthompson_shoppe/setting.rb +68 -0
  100. data/app/models/kylekthompson_shoppe/stock_level_adjustment.rb +19 -0
  101. data/app/models/kylekthompson_shoppe/tax_rate.rb +46 -0
  102. data/app/models/kylekthompson_shoppe/user.rb +49 -0
  103. data/app/validators/permalink_validator.rb +7 -0
  104. data/app/views/kylekthompson_shoppe/addresses/_form.html.haml +33 -0
  105. data/app/views/kylekthompson_shoppe/addresses/edit.html.haml +5 -0
  106. data/app/views/kylekthompson_shoppe/addresses/new.html.haml +5 -0
  107. data/app/views/kylekthompson_shoppe/countries/_form.html.haml +35 -0
  108. data/app/views/kylekthompson_shoppe/countries/edit.html.haml +6 -0
  109. data/app/views/kylekthompson_shoppe/countries/index.html.haml +25 -0
  110. data/app/views/kylekthompson_shoppe/countries/new.html.haml +7 -0
  111. data/app/views/kylekthompson_shoppe/customers/_addresses.html.haml +20 -0
  112. data/app/views/kylekthompson_shoppe/customers/_form.html.haml +30 -0
  113. data/app/views/kylekthompson_shoppe/customers/_search_form.html.haml +13 -0
  114. data/app/views/kylekthompson_shoppe/customers/edit.html.haml +5 -0
  115. data/app/views/kylekthompson_shoppe/customers/index.html.haml +32 -0
  116. data/app/views/kylekthompson_shoppe/customers/new.html.haml +5 -0
  117. data/app/views/kylekthompson_shoppe/customers/show.html.haml +53 -0
  118. data/app/views/kylekthompson_shoppe/delivery_service_prices/_form.html.haml +44 -0
  119. data/app/views/kylekthompson_shoppe/delivery_service_prices/edit.html.haml +6 -0
  120. data/app/views/kylekthompson_shoppe/delivery_service_prices/index.html.haml +23 -0
  121. data/app/views/kylekthompson_shoppe/delivery_service_prices/new.html.haml +6 -0
  122. data/app/views/kylekthompson_shoppe/delivery_services/_form.html.haml +38 -0
  123. data/app/views/kylekthompson_shoppe/delivery_services/edit.html.haml +9 -0
  124. data/app/views/kylekthompson_shoppe/delivery_services/index.html.haml +27 -0
  125. data/app/views/kylekthompson_shoppe/delivery_services/new.html.haml +6 -0
  126. data/app/views/kylekthompson_shoppe/order_mailer/accepted.text.erb +12 -0
  127. data/app/views/kylekthompson_shoppe/order_mailer/received.text.erb +9 -0
  128. data/app/views/kylekthompson_shoppe/order_mailer/rejected.text.erb +10 -0
  129. data/app/views/kylekthompson_shoppe/order_mailer/shipped.text.erb +16 -0
  130. data/app/views/kylekthompson_shoppe/orders/_form.html.haml +58 -0
  131. data/app/views/kylekthompson_shoppe/orders/_order_details.html.haml +57 -0
  132. data/app/views/kylekthompson_shoppe/orders/_order_items.html.haml +38 -0
  133. data/app/views/kylekthompson_shoppe/orders/_order_items_form.html.haml +61 -0
  134. data/app/views/kylekthompson_shoppe/orders/_payments_form.html.haml +15 -0
  135. data/app/views/kylekthompson_shoppe/orders/_payments_table.html.haml +37 -0
  136. data/app/views/kylekthompson_shoppe/orders/_search_form.html.haml +24 -0
  137. data/app/views/kylekthompson_shoppe/orders/_status_bar.html.haml +35 -0
  138. data/app/views/kylekthompson_shoppe/orders/despatch_note.html.haml +45 -0
  139. data/app/views/kylekthompson_shoppe/orders/edit.html.haml +21 -0
  140. data/app/views/kylekthompson_shoppe/orders/index.html.haml +39 -0
  141. data/app/views/kylekthompson_shoppe/orders/new.html.haml +14 -0
  142. data/app/views/kylekthompson_shoppe/orders/show.html.haml +25 -0
  143. data/app/views/kylekthompson_shoppe/payments/refund.html.haml +13 -0
  144. data/app/views/kylekthompson_shoppe/product_categories/_form.html.haml +50 -0
  145. data/app/views/kylekthompson_shoppe/product_categories/edit.html.haml +8 -0
  146. data/app/views/kylekthompson_shoppe/product_categories/index.html.haml +27 -0
  147. data/app/views/kylekthompson_shoppe/product_categories/new.html.haml +6 -0
  148. data/app/views/kylekthompson_shoppe/product_category_localisations/form.html.haml +29 -0
  149. data/app/views/kylekthompson_shoppe/product_category_localisations/index.html.haml +26 -0
  150. data/app/views/kylekthompson_shoppe/product_localisations/form.html.haml +32 -0
  151. data/app/views/kylekthompson_shoppe/product_localisations/index.html.haml +26 -0
  152. data/app/views/kylekthompson_shoppe/products/_form.html.haml +118 -0
  153. data/app/views/kylekthompson_shoppe/products/_table.html.haml +42 -0
  154. data/app/views/kylekthompson_shoppe/products/edit.html.haml +9 -0
  155. data/app/views/kylekthompson_shoppe/products/import.html.haml +67 -0
  156. data/app/views/kylekthompson_shoppe/products/index.html.haml +9 -0
  157. data/app/views/kylekthompson_shoppe/products/new.html.haml +7 -0
  158. data/app/views/kylekthompson_shoppe/sessions/new.html.haml +12 -0
  159. data/app/views/kylekthompson_shoppe/sessions/reset.html.haml +12 -0
  160. data/app/views/kylekthompson_shoppe/settings/edit.html.haml +19 -0
  161. data/app/views/kylekthompson_shoppe/shared/error.html.haml +6 -0
  162. data/app/views/kylekthompson_shoppe/stock_level_adjustments/index.html.haml +40 -0
  163. data/app/views/kylekthompson_shoppe/tax_rates/form.html.haml +28 -0
  164. data/app/views/kylekthompson_shoppe/tax_rates/index.html.haml +17 -0
  165. data/app/views/kylekthompson_shoppe/user_mailer/new_password.text.erb +9 -0
  166. data/app/views/kylekthompson_shoppe/users/_form.html.haml +27 -0
  167. data/app/views/kylekthompson_shoppe/users/edit.html.haml +5 -0
  168. data/app/views/kylekthompson_shoppe/users/index.html.haml +17 -0
  169. data/app/views/kylekthompson_shoppe/users/new.html.haml +7 -0
  170. data/app/views/kylekthompson_shoppe/variants/form.html.haml +68 -0
  171. data/app/views/kylekthompson_shoppe/variants/index.html.haml +33 -0
  172. data/app/views/layouts/kylekthompson_shoppe/application.html.haml +34 -0
  173. data/app/views/layouts/kylekthompson_shoppe/printable.html.haml +11 -0
  174. data/app/views/layouts/kylekthompson_shoppe/sub.html.haml +10 -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_kylekthompson_shoppe_initial_schema.rb +175 -0
  183. data/db/migrate/20131024201501_add_address_type_to_kylekthompson_shoppe_tax_rates.rb +5 -0
  184. data/db/migrate/20131024204815_create_kylekthompson_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_kylekthompson_shoppe_customers.rb +14 -0
  187. data/db/migrate/20141026175622_add_indexes_to_kylekthompson_shoppe_order_items.rb +6 -0
  188. data/db/migrate/20141026175943_add_indexes_to_kylekthompson_shoppe_orders.rb +7 -0
  189. data/db/migrate/20141026180333_add_indexes_to_kylekthompson_shoppe_payments.rb +6 -0
  190. data/db/migrate/20141026180835_add_indexes_to_kylekthompson_shoppe_product_attributes.rb +7 -0
  191. data/db/migrate/20141026180952_add_indexes_to_kylekthompson_shoppe_product_categories.rb +5 -0
  192. data/db/migrate/20141026181040_add_indexes_to_kylekthompson_shoppe_products.rb +8 -0
  193. data/db/migrate/20141026181312_add_indexes_to_kylekthompson_shoppe_settings.rb +5 -0
  194. data/db/migrate/20141026181354_add_indexes_to_kylekthompson_shoppe_stock_level_adjustments.rb +6 -0
  195. data/db/migrate/20141026181559_add_indexes_to_kylekthompson_shoppe_users.rb +5 -0
  196. data/db/migrate/20141026181716_add_indexes_to_kylekthompson_shoppe_delivery_services.rb +9 -0
  197. data/db/migrate/20141026181717_allow_multiple_kylekthompson_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_kylekthompson_shoppe_addresses.rb +17 -0
  200. data/db/migrate/20150315215633_add_customer_to_kylekthompson_shoppe_orders.rb +5 -0
  201. data/db/migrate/20150513171350_create_kylekthompson_shoppe_product_category_translation_table.rb +17 -0
  202. data/db/migrate/20150519173350_create_kylekthompson_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/kylekthompson_shoppe/associated_countries.rb +20 -0
  219. data/lib/kylekthompson_shoppe/country_importer.rb +15 -0
  220. data/lib/kylekthompson_shoppe/default_navigation.rb +21 -0
  221. data/lib/kylekthompson_shoppe/engine.rb +55 -0
  222. data/lib/kylekthompson_shoppe/error.rb +21 -0
  223. data/lib/kylekthompson_shoppe/errors/inappropriate_delivery_service.rb +6 -0
  224. data/lib/kylekthompson_shoppe/errors/insufficient_stock_to_fulfil.rb +15 -0
  225. data/lib/kylekthompson_shoppe/errors/invalid_configuration.rb +6 -0
  226. data/lib/kylekthompson_shoppe/errors/not_enough_stock.rb +15 -0
  227. data/lib/kylekthompson_shoppe/errors/payment_declined.rb +6 -0
  228. data/lib/kylekthompson_shoppe/errors/refund_failed.rb +6 -0
  229. data/lib/kylekthompson_shoppe/errors/unorderable_item.rb +6 -0
  230. data/lib/kylekthompson_shoppe/navigation_manager.rb +81 -0
  231. data/lib/kylekthompson_shoppe/orderable_item.rb +39 -0
  232. data/lib/kylekthompson_shoppe/settings.rb +26 -0
  233. data/lib/kylekthompson_shoppe/settings_loader.rb +16 -0
  234. data/lib/kylekthompson_shoppe/setup_generator.rb +10 -0
  235. data/lib/kylekthompson_shoppe/version.rb +3 -0
  236. data/lib/kylekthompson_shoppe/view_helpers.rb +16 -0
  237. data/lib/kylekthompson_shoppe.rb +60 -0
  238. data/lib/tasks/kylekthompson_shoppe.rake +29 -0
  239. metadata +662 -0
@@ -0,0 +1,5 @@
1
+ class AddAddressTypeToKylekthompsonShoppeTaxRates < ActiveRecord::Migration
2
+ def change
3
+ add_column :kylekthompson_shoppe_tax_rates, :address_type, :string
4
+ end
5
+ end
@@ -0,0 +1,32 @@
1
+ class CreateKylekthompsonShoppePayments < ActiveRecord::Migration
2
+ def up
3
+ create_table :kylekthompson_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 :kylekthompson_shoppe_orders, :paid_at
15
+ remove_column :kylekthompson_shoppe_orders, :payment_reference
16
+ remove_column :kylekthompson_shoppe_orders, :payment_method
17
+
18
+ add_column :kylekthompson_shoppe_orders, :amount_paid, :decimal, :precision => 8, :scale => 2, :default => 0.0
19
+ add_column :kylekthompson_shoppe_orders, :exported, :boolean, :default => false
20
+ add_column :kylekthompson_shoppe_orders, :invoice_number, :string
21
+ end
22
+
23
+ def down
24
+ drop_table :kylekthompson_shoppe_payments
25
+ add_column :kylekthompson_shoppe_orders, :paid_at, :datetime
26
+ add_column :kylekthompson_shoppe_orders, :payment_reference, :string
27
+ add_column :kylekthompson_shoppe_orders, :payment_method, :string
28
+ remove_column :kylekthompson_shoppe_orders, :amount_paid
29
+ remove_column :kylekthompson_shoppe_orders, :exported
30
+ remove_column :kylekthompson_shoppe_orders, :invoice_number
31
+ end
32
+ end
@@ -0,0 +1,9 @@
1
+ class RemoveDefaultOnOrderItemWeight < ActiveRecord::Migration
2
+ def up
3
+ change_column_default :kylekthompson_shoppe_order_items, :weight, nil
4
+ end
5
+
6
+ def down
7
+ change_column_default :kylekthompson_shoppe_order_items, :weight, 0.0
8
+ end
9
+ end
@@ -0,0 +1,14 @@
1
+ class CreateKylekthompsonShoppeCustomers < ActiveRecord::Migration
2
+ def change
3
+ create_table :kylekthompson_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 AddIndexesToKylekthompsonShoppeOrderItems < ActiveRecord::Migration
2
+ def change
3
+ add_index :kylekthompson_shoppe_order_items, [:ordered_item_id, :ordered_item_type], name: 'index_kylekthompson_shoppe_order_items_ordered_item'
4
+ add_index :kylekthompson_shoppe_order_items, :order_id
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ class AddIndexesToKylekthompsonShoppeOrders < ActiveRecord::Migration
2
+ def change
3
+ add_index :kylekthompson_shoppe_orders, :token
4
+ add_index :kylekthompson_shoppe_orders, :delivery_service_id
5
+ add_index :kylekthompson_shoppe_orders, :received_at
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ class AddIndexesToKylekthompsonShoppePayments < ActiveRecord::Migration
2
+ def change
3
+ add_index :kylekthompson_shoppe_payments, :order_id
4
+ add_index :kylekthompson_shoppe_payments, :parent_payment_id
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ class AddIndexesToKylekthompsonShoppeProductAttributes < ActiveRecord::Migration
2
+ def change
3
+ add_index :kylekthompson_shoppe_product_attributes, :product_id
4
+ add_index :kylekthompson_shoppe_product_attributes, :key
5
+ add_index :kylekthompson_shoppe_product_attributes, :position
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ class AddIndexesToKylekthompsonShoppeProductCategories < ActiveRecord::Migration
2
+ def change
3
+ add_index :kylekthompson_shoppe_product_categories, :permalink
4
+ end
5
+ end
@@ -0,0 +1,8 @@
1
+ class AddIndexesToKylekthompsonShoppeProducts < ActiveRecord::Migration
2
+ def change
3
+ add_index :kylekthompson_shoppe_products, :parent_id
4
+ add_index :kylekthompson_shoppe_products, :sku
5
+ add_index :kylekthompson_shoppe_products, :product_category_id
6
+ add_index :kylekthompson_shoppe_products, :permalink
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ class AddIndexesToKylekthompsonShoppeSettings < ActiveRecord::Migration
2
+ def change
3
+ add_index :kylekthompson_shoppe_settings, :key
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ class AddIndexesToKylekthompsonShoppeStockLevelAdjustments < ActiveRecord::Migration
2
+ def change
3
+ add_index :kylekthompson_shoppe_stock_level_adjustments, [:item_id, :item_type], name: 'index_kylekthompson_shoppe_stock_level_adjustments_items'
4
+ add_index :kylekthompson_shoppe_stock_level_adjustments, [:parent_id, :parent_type], name: 'index_kylekthompson_shoppe_stock_level_adjustments_parent'
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ class AddIndexesToKylekthompsonShoppeUsers < ActiveRecord::Migration
2
+ def change
3
+ add_index :kylekthompson_shoppe_users, :email_address
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ class AddIndexesToKylekthompsonShoppeDeliveryServices < ActiveRecord::Migration
2
+ def change
3
+ add_index :kylekthompson_shoppe_delivery_services, :active
4
+ add_index :kylekthompson_shoppe_delivery_service_prices, :delivery_service_id
5
+ add_index :kylekthompson_shoppe_delivery_service_prices, :min_weight
6
+ add_index :kylekthompson_shoppe_delivery_service_prices, :max_weight
7
+ add_index :kylekthompson_shoppe_delivery_service_prices, :price
8
+ end
9
+ end
@@ -0,0 +1,46 @@
1
+ class AllowMultipleKylekthompsonShoppeProductsPerKylekthompsonShoppeProductCategory < 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 :kylekthompson_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 :kylekthompson_shoppe_product_categorizations, :product_id, name: 'categorization_by_product_id'
10
+ add_index :kylekthompson_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
+ KylekthompsonShoppe::Product.class_eval do
13
+ belongs_to :old_category,
14
+ :class_name => "KylekthompsonShoppe::ProductCategory",
15
+ :foreign_key => "product_category_id"
16
+ end
17
+ # migrate over to our new join table
18
+ KylekthompsonShoppe::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 :kylekthompson_shoppe_products, :product_category_id if index_exists?(:kylekthompson_shoppe_products, :product_category_id)
24
+ remove_column :kylekthompson_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 :kylekthompson_shoppe_products, :product_category_id, :integer
30
+ add_index :kylekthompson_shoppe_products, :product_category_id
31
+ # define the old belongs_to association once again as we're going to re-add our goodies
32
+ KylekthompsonShoppe::Product.class_eval do
33
+ belongs_to :new_category,
34
+ :class_name => "KylekthompsonShoppe::ProductCategory",
35
+ :foreign_key => "product_category_id"
36
+ end
37
+ # migrate over from the new table to the old association
38
+ KylekthompsonShoppe::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 :kylekthompson_shoppe_product_categorizations
45
+ end
46
+ end
@@ -0,0 +1,30 @@
1
+ class AddNestedToProductCategories < ActiveRecord::Migration
2
+ def up
3
+ add_column :kylekthompson_shoppe_product_categories, :parent_id, :integer
4
+ add_column :kylekthompson_shoppe_product_categories, :lft, :integer
5
+ add_column :kylekthompson_shoppe_product_categories, :rgt, :integer
6
+ add_column :kylekthompson_shoppe_product_categories, :depth, :integer
7
+
8
+ add_index :kylekthompson_shoppe_product_categories, :lft
9
+ add_index :kylekthompson_shoppe_product_categories, :rgt
10
+
11
+ add_column :kylekthompson_shoppe_product_categories, :ancestral_permalink, :string
12
+ add_column :kylekthompson_shoppe_product_categories, :permalink_includes_ancestors, :boolean, default: false
13
+
14
+ KylekthompsonShoppe::ProductCategory.reset_column_information
15
+ KylekthompsonShoppe::ProductCategory.rebuild!
16
+ end
17
+
18
+ def down
19
+ remove_column :kylekthompson_shoppe_product_categories, :ancestral_permalink
20
+ remove_column :kylekthompson_shoppe_product_categories, :permalink_includes_ancestors
21
+
22
+ remove_index :kylekthompson_shoppe_product_categories, :lft
23
+ remove_index :kylekthompson_shoppe_product_categories, :rgt
24
+
25
+ remove_column :kylekthompson_shoppe_product_categories, :parent_id
26
+ remove_column :kylekthompson_shoppe_product_categories, :lft
27
+ remove_column :kylekthompson_shoppe_product_categories, :rgt
28
+ remove_column :kylekthompson_shoppe_product_categories, :depth
29
+ end
30
+ end
@@ -0,0 +1,17 @@
1
+ class CreateKylekthompsonShoppeAddresses < ActiveRecord::Migration
2
+ def change
3
+ create_table :kylekthompson_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 AddCustomerToKylekthompsonShoppeOrders < ActiveRecord::Migration
2
+ def change
3
+ add_column :kylekthompson_shoppe_orders, :customer_id, :integer
4
+ end
5
+ end
@@ -0,0 +1,17 @@
1
+ class CreateKylekthompsonShoppeProductCategoryTranslationTable < ActiveRecord::Migration
2
+ def up
3
+ KylekthompsonShoppe::ProductCategory.create_translation_table! :name => :string, :permalink => :string, :description => :text
4
+
5
+ KylekthompsonShoppe::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
+ KylekthompsonShoppe::ProductCategory.drop_translation_table!
16
+ end
17
+ end
@@ -0,0 +1,18 @@
1
+ class CreateKylekthompsonShoppeProductTranslationTable < ActiveRecord::Migration
2
+ def up
3
+ KylekthompsonShoppe::Product.create_translation_table! :name => :string, :permalink => :string, :description => :text, :short_description => :text
4
+
5
+ KylekthompsonShoppe::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
+ KylekthompsonShoppe::Product.drop_translation_table!
17
+ end
18
+ end
data/db/schema.rb ADDED
@@ -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 "kylekthompson_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 "kylekthompson_shoppe_addresses", ["customer_id"], name: "index_kylekthompson_shoppe_addresses_on_customer_id", using: :btree
52
+
53
+ create_table "kylekthompson_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 "kylekthompson_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 "kylekthompson_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 "kylekthompson_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 "kylekthompson_shoppe_delivery_service_prices", ["delivery_service_id"], name: "index_kylekthompson_shoppe_delivery_service_prices_on_delivery_service_id", using: :btree
101
+ add_index "kylekthompson_shoppe_delivery_service_prices", ["max_weight"], name: "index_kylekthompson_shoppe_delivery_service_prices_on_max_weight", using: :btree
102
+ add_index "kylekthompson_shoppe_delivery_service_prices", ["min_weight"], name: "index_kylekthompson_shoppe_delivery_service_prices_on_min_weight", using: :btree
103
+ add_index "kylekthompson_shoppe_delivery_service_prices", ["price"], name: "index_kylekthompson_shoppe_delivery_service_prices_on_price", using: :btree
104
+
105
+ create_table "kylekthompson_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 "kylekthompson_shoppe_delivery_services", ["active"], name: "index_kylekthompson_shoppe_delivery_services_on_active", using: :btree
117
+
118
+ create_table "kylekthompson_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 "kylekthompson_shoppe_order_items", ["order_id"], name: "index_kylekthompson_shoppe_order_items_on_order_id", using: :btree
133
+ add_index "kylekthompson_shoppe_order_items", ["ordered_item_id", "ordered_item_type"], name: "index_kylekthompson_shoppe_order_items_ordered_item", using: :btree
134
+
135
+ create_table "kylekthompson_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 "kylekthompson_shoppe_orders", ["delivery_service_id"], name: "index_kylekthompson_shoppe_orders_on_delivery_service_id", using: :btree
181
+ add_index "kylekthompson_shoppe_orders", ["received_at"], name: "index_kylekthompson_shoppe_orders_on_received_at", using: :btree
182
+ add_index "kylekthompson_shoppe_orders", ["token"], name: "index_kylekthompson_shoppe_orders_on_token", using: :btree
183
+
184
+ create_table "kylekthompson_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 "kylekthompson_shoppe_payments", ["order_id"], name: "index_kylekthompson_shoppe_payments_on_order_id", using: :btree
199
+ add_index "kylekthompson_shoppe_payments", ["parent_payment_id"], name: "index_kylekthompson_shoppe_payments_on_parent_payment_id", using: :btree
200
+
201
+ create_table "kylekthompson_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 "kylekthompson_shoppe_product_attributes", ["key"], name: "index_kylekthompson_shoppe_product_attributes_on_key", using: :btree
213
+ add_index "kylekthompson_shoppe_product_attributes", ["position"], name: "index_kylekthompson_shoppe_product_attributes_on_position", using: :btree
214
+ add_index "kylekthompson_shoppe_product_attributes", ["product_id"], name: "index_kylekthompson_shoppe_product_attributes_on_product_id", using: :btree
215
+
216
+ create_table "kylekthompson_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 "kylekthompson_shoppe_product_categories", ["lft"], name: "index_kylekthompson_shoppe_product_categories_on_lft", using: :btree
231
+ add_index "kylekthompson_shoppe_product_categories", ["permalink"], name: "index_kylekthompson_shoppe_product_categories_on_permalink", using: :btree
232
+ add_index "kylekthompson_shoppe_product_categories", ["rgt"], name: "index_kylekthompson_shoppe_product_categories_on_rgt", using: :btree
233
+
234
+ create_table "kylekthompson_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 "kylekthompson_shoppe_product_categorizations", ["product_category_id"], name: "categorization_by_product_category_id", using: :btree
240
+ add_index "kylekthompson_shoppe_product_categorizations", ["product_id"], name: "categorization_by_product_id", using: :btree
241
+
242
+ create_table "kylekthompson_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 "kylekthompson_shoppe_products", ["parent_id"], name: "index_kylekthompson_shoppe_products_on_parent_id", using: :btree
263
+ add_index "kylekthompson_shoppe_products", ["permalink"], name: "index_kylekthompson_shoppe_products_on_permalink", using: :btree
264
+ add_index "kylekthompson_shoppe_products", ["sku"], name: "index_kylekthompson_shoppe_products_on_sku", using: :btree
265
+
266
+ create_table "kylekthompson_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 "kylekthompson_shoppe_settings", ["key"], name: "index_kylekthompson_shoppe_settings_on_key", using: :btree
273
+
274
+ create_table "kylekthompson_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 "kylekthompson_shoppe_stock_level_adjustments", ["item_id", "item_type"], name: "index_kylekthompson_shoppe_stock_level_adjustments_items", using: :btree
286
+ add_index "kylekthompson_shoppe_stock_level_adjustments", ["parent_id", "parent_type"], name: "index_kylekthompson_shoppe_stock_level_adjustments_parent", using: :btree
287
+
288
+ create_table "kylekthompson_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 "kylekthompson_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 "kylekthompson_shoppe_users", ["email_address"], name: "index_kylekthompson_shoppe_users_on_email_address", using: :btree
307
+
308
+ end