shoppe 0.0.15 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (199) hide show
  1. data/README.rdoc +1 -0
  2. data/Rakefile +21 -1
  3. data/app/assets/javascripts/shoppe/application.coffee +5 -0
  4. data/app/assets/stylesheets/shoppe/application.scss +16 -3
  5. data/app/assets/stylesheets/shoppe/elements.scss +8 -0
  6. data/app/assets/stylesheets/shoppe/printable.scss +67 -0
  7. data/app/controllers/shoppe/application_controller.rb +1 -10
  8. data/app/controllers/shoppe/orders_controller.rb +4 -0
  9. data/app/controllers/shoppe/sessions_controller.rb +1 -0
  10. data/app/controllers/shoppe/settings_controller.rb +12 -0
  11. data/app/controllers/shoppe/users_controller.rb +2 -2
  12. data/app/controllers/shoppe/variants_controller.rb +1 -1
  13. data/app/helpers/shoppe/application_helper.rb +63 -8
  14. data/app/mailers/shoppe/order_mailer.rb +5 -7
  15. data/app/mailers/shoppe/user_mailer.rb +2 -2
  16. data/app/models/shoppe/country.rb +17 -1
  17. data/app/models/shoppe/delivery_service.rb +15 -0
  18. data/app/models/shoppe/delivery_service_price.rb +17 -0
  19. data/app/models/shoppe/order.rb +82 -9
  20. data/app/models/shoppe/order_item.rb +18 -0
  21. data/app/models/shoppe/product.rb +26 -1
  22. data/app/models/shoppe/product/product_attributes.rb +1 -1
  23. data/app/models/shoppe/product/variants.rb +3 -3
  24. data/app/models/shoppe/product_attribute.rb +15 -0
  25. data/app/models/shoppe/product_category.rb +12 -0
  26. data/app/models/shoppe/setting.rb +59 -0
  27. data/app/models/shoppe/stock_level_adjustment.rb +15 -0
  28. data/app/models/shoppe/tax_rate.rb +13 -1
  29. data/app/models/shoppe/user.rb +13 -0
  30. data/app/views/layouts/shoppe/application.html.haml +2 -1
  31. data/app/views/layouts/shoppe/printable.html.haml +11 -0
  32. data/app/views/shoppe/delivery_service_prices/index.html.haml +1 -1
  33. data/app/views/shoppe/order_mailer/accepted.text.erb +2 -2
  34. data/app/views/shoppe/order_mailer/received.text.erb +2 -2
  35. data/app/views/shoppe/order_mailer/rejected.text.erb +2 -2
  36. data/app/views/shoppe/order_mailer/shipped.text.erb +2 -2
  37. data/app/views/shoppe/orders/despatch_note.html.haml +45 -0
  38. data/app/views/shoppe/orders/index.html.haml +2 -2
  39. data/app/views/shoppe/orders/show.html.haml +21 -11
  40. data/app/views/shoppe/settings/edit.html.haml +19 -0
  41. data/app/views/shoppe/user_mailer/new_password.text.erb +1 -1
  42. data/app/views/shoppe/variants/form.html.haml +4 -0
  43. data/config/locales/en.yml +34 -0
  44. data/config/routes.rb +5 -0
  45. data/db/migrate/20130926094549_create_shoppe_initial_schema.rb +92 -33
  46. data/db/seeds.rb +1 -1
  47. data/lib/shoppe.rb +13 -35
  48. data/lib/shoppe/engine.rb +6 -6
  49. data/lib/shoppe/settings.rb +28 -0
  50. data/lib/shoppe/settings_loader.rb +16 -0
  51. data/lib/shoppe/setup_generator.rb +0 -4
  52. data/lib/shoppe/version.rb +1 -1
  53. data/test/{dummy → app}/README.rdoc +0 -0
  54. data/test/{dummy → app}/Rakefile +0 -0
  55. data/test/{dummy → app}/app/assets/javascripts/application.js +0 -0
  56. data/test/{dummy → app}/app/assets/stylesheets/application.css +0 -0
  57. data/test/{dummy → app}/app/controllers/application_controller.rb +0 -0
  58. data/test/{dummy → app}/app/helpers/application_helper.rb +0 -0
  59. data/test/{dummy → app}/app/views/layouts/application.html.erb +0 -0
  60. data/test/{dummy → app}/bin/bundle +0 -0
  61. data/test/{dummy → app}/bin/rails +0 -0
  62. data/test/{dummy → app}/bin/rake +0 -0
  63. data/test/{dummy → app}/config.ru +0 -0
  64. data/test/{dummy → app}/config/application.rb +0 -0
  65. data/test/{dummy → app}/config/boot.rb +0 -0
  66. data/test/app/config/database.example.yml +30 -0
  67. data/test/{dummy → app}/config/database.yml +9 -5
  68. data/test/{dummy → app}/config/environment.rb +0 -0
  69. data/test/{dummy → app}/config/environments/development.rb +0 -0
  70. data/test/{dummy → app}/config/environments/production.rb +0 -0
  71. data/test/{dummy → app}/config/environments/test.rb +0 -0
  72. data/test/{dummy → app}/config/initializers/backtrace_silencers.rb +0 -0
  73. data/test/{dummy → app}/config/initializers/filter_parameter_logging.rb +0 -0
  74. data/test/{dummy → app}/config/initializers/inflections.rb +0 -0
  75. data/test/{dummy → app}/config/initializers/mime_types.rb +0 -0
  76. data/test/{dummy → app}/config/initializers/secret_token.rb +0 -0
  77. data/test/app/config/initializers/session_store.rb +3 -0
  78. data/test/{dummy → app}/config/initializers/wrap_parameters.rb +0 -0
  79. data/test/{dummy → app}/config/locales/en.yml +0 -0
  80. data/test/{dummy → app}/config/routes.rb +0 -0
  81. data/{config/shoppe.example.yml → test/app/config/shoppe.yml} +0 -0
  82. data/test/{dummy → app}/db/development.sqlite3 +0 -0
  83. data/test/{dummy → app}/db/migrate/20131017165217_create_nifty_attachments_table.rb +0 -0
  84. data/test/{dummy → app}/db/migrate/20131017165222_create_nifty_key_value_store_table.rb +0 -0
  85. data/test/{dummy → app}/db/schema.rb +31 -16
  86. data/test/{dummy → app}/db/test.sqlite3 +0 -0
  87. data/test/app/log/development.log +8093 -0
  88. data/test/{dummy → app}/log/test.log +0 -0
  89. data/test/{dummy → app}/public/404.html +0 -0
  90. data/test/{dummy → app}/public/422.html +0 -0
  91. data/test/{dummy → app}/public/500.html +0 -0
  92. data/test/{dummy → app}/public/favicon.ico +0 -0
  93. data/test/app/tmp/cache/assets/development/sass/7c98994848dbb534749f971b176724aa382339bb/dialog.scssc +0 -0
  94. data/test/app/tmp/cache/assets/development/sass/edac894564dae62b78e653a08d1c41f10ade93f9/application.scssc +0 -0
  95. data/test/app/tmp/cache/assets/development/sass/edac894564dae62b78e653a08d1c41f10ade93f9/dialog.scssc +0 -0
  96. data/test/app/tmp/cache/assets/development/sass/edac894564dae62b78e653a08d1c41f10ade93f9/elements.scssc +0 -0
  97. data/test/app/tmp/cache/assets/development/sass/edac894564dae62b78e653a08d1c41f10ade93f9/reset.scssc +0 -0
  98. data/test/app/tmp/cache/assets/development/sass/edac894564dae62b78e653a08d1c41f10ade93f9/sub.scssc +0 -0
  99. data/test/app/tmp/cache/assets/development/sass/edac894564dae62b78e653a08d1c41f10ade93f9/variables.scssc +0 -0
  100. data/test/app/tmp/cache/assets/development/sprockets/06d540cec125e08e63a898c35e8235d6 +0 -0
  101. data/test/app/tmp/cache/assets/development/sprockets/0a6bca3e510625f255083bd154cc470b +0 -0
  102. data/test/app/tmp/cache/assets/development/sprockets/0d8942b2279b6bc7c68b3db3e2e4c342 +0 -0
  103. data/test/app/tmp/cache/assets/development/sprockets/122a65fdcbb923c3c1cd95549ef52f43 +0 -0
  104. data/test/app/tmp/cache/assets/development/sprockets/140840b7aefa4bf5beda2c32e20374a6 +0 -0
  105. data/test/app/tmp/cache/assets/development/sprockets/160ddfa6141944c4a03757fe91643137 +0 -0
  106. data/test/app/tmp/cache/assets/development/sprockets/1bb0d399b6b81fc3b47ff794b066873f +0 -0
  107. data/test/app/tmp/cache/assets/development/sprockets/1e1679158bd397a720be46fa3a5876a3 +0 -0
  108. data/test/app/tmp/cache/assets/development/sprockets/2a75ba35f8e751887ba89a914363fefd +0 -0
  109. data/test/app/tmp/cache/assets/development/sprockets/2cc6ef740b5691af5ee246c0dbc68f14 +0 -0
  110. data/test/app/tmp/cache/assets/development/sprockets/2f80004fb2e2ce07283a83ac15cf920a +0 -0
  111. data/test/app/tmp/cache/assets/development/sprockets/322295abdd8625fcce4da08f9565cc63 +0 -0
  112. data/test/app/tmp/cache/assets/development/sprockets/421b79f445cd87f3532a5c445877cbec +0 -0
  113. data/test/app/tmp/cache/assets/development/sprockets/4528fe4a109cad1ff031659cd9eeae17 +0 -0
  114. data/test/app/tmp/cache/assets/development/sprockets/45a9c7dfe9986570daa4c972277375ec +0 -0
  115. data/test/app/tmp/cache/assets/development/sprockets/48b2cd7153bbc442eaa84c3e24e963e0 +0 -0
  116. data/test/app/tmp/cache/assets/development/sprockets/4c3fef5a3e293ed6b6df3d869f54e1d1 +0 -0
  117. data/test/app/tmp/cache/assets/development/sprockets/4c8cb5cfd87990ebddbaa5b5fd594be5 +0 -0
  118. data/test/app/tmp/cache/assets/development/sprockets/4cefa37a52d669d3ca7e6aa1e1aaf435 +0 -0
  119. data/test/app/tmp/cache/assets/development/sprockets/4ea4f5c13aaeda9a7d39684ab72fa710 +0 -0
  120. data/test/app/tmp/cache/assets/development/sprockets/4ecd1cb66cb36718daadcfba0aa42c1e +0 -0
  121. data/test/app/tmp/cache/assets/development/sprockets/4ed3cbd180c275b98627eaeea4c9c838 +0 -0
  122. data/test/app/tmp/cache/assets/development/sprockets/519aa2b3c3ab8fd8f065c56507111878 +0 -0
  123. data/test/app/tmp/cache/assets/development/sprockets/51d409a48872319ac6a731aa880e6368 +0 -0
  124. data/test/app/tmp/cache/assets/development/sprockets/55bae604bcb5ccf7d9e0ed0fd61953b6 +0 -0
  125. data/test/app/tmp/cache/assets/development/sprockets/5805d2c402f412642d86ec03a7ec4a3d +0 -0
  126. data/test/app/tmp/cache/assets/development/sprockets/5cd772b44cdeae4d3b37b62193e946eb +0 -0
  127. data/test/app/tmp/cache/assets/development/sprockets/5f32b259cbcc52156d2fe21c185d9390 +0 -0
  128. data/test/app/tmp/cache/assets/development/sprockets/656ea3403f27a33b86d5bf9e8a0c0e46 +0 -0
  129. data/test/app/tmp/cache/assets/development/sprockets/679705affe2ad274da1ad48cb5137c21 +0 -0
  130. data/test/app/tmp/cache/assets/development/sprockets/69a687de4cbb95365bf8aa2037d63726 +0 -0
  131. data/test/app/tmp/cache/assets/development/sprockets/69d5224a79e874431294e8adf04e7d65 +0 -0
  132. data/test/app/tmp/cache/assets/development/sprockets/6bc5a76ff13bc4daebb7e164a4b64196 +0 -0
  133. data/test/app/tmp/cache/assets/development/sprockets/6c1a5456c2e5d87285dd1910762fe01e +0 -0
  134. data/test/app/tmp/cache/assets/development/sprockets/6d52ff2c9298014f2d648eb9e04a61a6 +0 -0
  135. data/test/app/tmp/cache/assets/development/sprockets/7938636d16e11b754d4dd046b89863c4 +0 -0
  136. data/test/app/tmp/cache/assets/development/sprockets/7ce7981501e05438faa017eb2e197379 +0 -0
  137. data/test/app/tmp/cache/assets/development/sprockets/7e232a7b4ac10fe1350e2b9b05ab0b02 +0 -0
  138. data/test/app/tmp/cache/assets/development/sprockets/81d7800826e89041f377af8570b8324f +0 -0
  139. data/test/app/tmp/cache/assets/development/sprockets/81f524fed55fe63e95c1aeccb5d83571 +0 -0
  140. data/test/app/tmp/cache/assets/development/sprockets/85984636ee801f63af86b35d7697d4c5 +0 -0
  141. data/test/app/tmp/cache/assets/development/sprockets/88de2cf8ce5990c5fa59f7c9f4599a65 +0 -0
  142. data/test/app/tmp/cache/assets/development/sprockets/8932a78ffe18ad2e3bb7ceb90ac4b933 +0 -0
  143. data/test/app/tmp/cache/assets/development/sprockets/8d6fd863923e78438318b02bf83be1c4 +0 -0
  144. data/test/app/tmp/cache/assets/development/sprockets/8f43db1e57a90ffbae3be00a895d5a09 +0 -0
  145. data/test/app/tmp/cache/assets/development/sprockets/91e11940ab63a407af03d21720ac2951 +0 -0
  146. data/test/app/tmp/cache/assets/development/sprockets/938abfdc262a8ab42e768545640bfb2a +0 -0
  147. data/test/app/tmp/cache/assets/development/sprockets/9e760b9565b110e433b7e42f827cb5f8 +0 -0
  148. data/test/app/tmp/cache/assets/development/sprockets/9e8fbfd56e8ef705ba94bb03b5b3696e +0 -0
  149. data/test/app/tmp/cache/assets/development/sprockets/9ebbf73fb48cdf8bc07a8bfdd6d14328 +0 -0
  150. data/test/app/tmp/cache/assets/development/sprockets/9f240d481b0818a6da0b1a1aaaac2b54 +0 -0
  151. data/test/app/tmp/cache/assets/development/sprockets/a2b956b30a80f996b5aeb1b2f226775c +0 -0
  152. data/test/app/tmp/cache/assets/development/sprockets/a5b5ed9849e8019160b73aa554132b37 +0 -0
  153. data/test/app/tmp/cache/assets/development/sprockets/a692ba7ed6cff183bb840c2622233c87 +0 -0
  154. data/test/app/tmp/cache/assets/development/sprockets/a951f4ceb83ae691f002b4f6183bc1ed +0 -0
  155. data/test/app/tmp/cache/assets/development/sprockets/accc4dc17ef18d0b510917a005340da5 +0 -0
  156. data/test/app/tmp/cache/assets/development/sprockets/b2db166e9974feb35358e7fcce87cb39 +0 -0
  157. data/test/app/tmp/cache/assets/development/sprockets/b519a4f6c5b5a0d9236bdca14e0eb00d +0 -0
  158. data/test/app/tmp/cache/assets/development/sprockets/b5cbeb3def40b118469fff2d80c1b596 +0 -0
  159. data/test/app/tmp/cache/assets/development/sprockets/b6f65271a0e77b349529ce9148dd2782 +0 -0
  160. data/test/app/tmp/cache/assets/development/sprockets/b9ad7ea18b7e55c3626a15d1dae142ed +0 -0
  161. data/test/app/tmp/cache/assets/development/sprockets/bc384ea2fdcc667aa4282209caba921f +0 -0
  162. data/test/app/tmp/cache/assets/development/sprockets/bcf06bf434bb3d3a5769036d6e24b301 +0 -0
  163. data/test/app/tmp/cache/assets/development/sprockets/bd83357635155d3457747e92e47da0ed +0 -0
  164. data/test/app/tmp/cache/assets/development/sprockets/c39634555e4eba3595350eeea648ddf4 +0 -0
  165. data/test/app/tmp/cache/assets/development/sprockets/c3ef336ca8f7e64969d8bfdcf837ad10 +0 -0
  166. data/test/app/tmp/cache/assets/development/sprockets/c55037904a95162828e5d0b087677878 +0 -0
  167. data/test/app/tmp/cache/assets/development/sprockets/c733f1a2fe9d05a3a634ff64a394f64b +0 -0
  168. data/test/app/tmp/cache/assets/development/sprockets/c83a337688a52890ba93372fea6ec932 +0 -0
  169. data/test/app/tmp/cache/assets/development/sprockets/ca92d0dbc43c066af9b31f2bc26d038d +0 -0
  170. data/test/app/tmp/cache/assets/development/sprockets/cae2fc80bfbc81ec7b6c11a72be18c98 +0 -0
  171. data/test/app/tmp/cache/assets/development/sprockets/cd665363677ffcef0dde972284e8d942 +0 -0
  172. data/test/app/tmp/cache/assets/development/sprockets/d5154a1eda9cfbfe54e091d6ead1ac5f +0 -0
  173. data/test/app/tmp/cache/assets/development/sprockets/daa7fa7a610bc5951cc3c4403f290eb6 +0 -0
  174. data/test/app/tmp/cache/assets/development/sprockets/dabc0e94bc1e37007351ac756dd2dd6a +0 -0
  175. data/test/app/tmp/cache/assets/development/sprockets/edf3c55a27678996371bffe56298925b +0 -0
  176. data/test/app/tmp/cache/assets/development/sprockets/f0f04c3b2b0091fa3ca4a1edacc23a1c +0 -0
  177. data/test/app/tmp/cache/assets/development/sprockets/f8610737fbfdcb85db95ae7c6a70514e +0 -0
  178. data/test/app/tmp/restart.txt +0 -0
  179. data/test/shoppe_test.rb +0 -5
  180. data/test/test_helper.rb +1 -1
  181. metadata +298 -98
  182. data/app/helpers/shoppe/shoppe_helper.rb +0 -30
  183. data/db/migrate/20131012123829_create_shoppe_product_attributes.rb +0 -11
  184. data/db/migrate/20131012163301_add_public_boolean_to_product_attributes.rb +0 -5
  185. data/db/migrate/20131013123937_add_cost_prices_to_various_objects.rb +0 -8
  186. data/db/migrate/20131013131658_add_stock_control_boolean_to_products.rb +0 -5
  187. data/db/migrate/20131017144430_create_shoppe_stock_level_adjustments.rb +0 -18
  188. data/db/migrate/20131017180920_create_shoppe_countries.rb +0 -16
  189. data/db/migrate/20131017183211_create_shoppe_tax_rates.rb +0 -26
  190. data/db/migrate/20131020204719_add_countries_to_tax_rates_and_delivery_prices.rb +0 -6
  191. data/db/migrate/20131021135208_add_notes_to_orders.rb +0 -5
  192. data/db/migrate/20131022090919_refactor_order_items_to_allow_any_product.rb +0 -6
  193. data/db/migrate/20131022092904_rename_product_title_to_name.rb +0 -5
  194. data/db/migrate/20131022093538_stock_level_adjustments_should_be_polymorphic.rb +0 -6
  195. data/db/migrate/20131022135331_add_parent_id_to_products.rb +0 -5
  196. data/db/migrate/20131022145653_cost_price_should_be_default_to_zero.rb +0 -9
  197. data/test/dummy/config/initializers/session_store.rb +0 -3
  198. data/test/dummy/config/shoppe.yml +0 -7
  199. data/test/dummy/log/development.log +0 -1162
@@ -8,5 +8,5 @@ We will e-mail you again when your order has been accepted.
8
8
 
9
9
  Many thanks,
10
10
 
11
- <%=Shoppe.config[:store_name]%>
12
- <%=Shoppe.config[:email_address]%>
11
+ <%=Shoppe.settings.store_name%>
12
+ <%=Shoppe.settings.email_address%>
@@ -6,5 +6,5 @@ Unfortunately, this attached order was rejected. This is most likely to our over
6
6
 
7
7
  Many thanks,
8
8
 
9
- <%=Shoppe.config[:store_name]%>
10
- <%=Shoppe.config[:email_address]%>
9
+ <%=Shoppe.settings.store_name%>
10
+ <%=Shoppe.settings.email_address%>
@@ -12,5 +12,5 @@ You can the delivery online at:
12
12
 
13
13
  Many thanks,
14
14
 
15
- <%=Shoppe.config[:store_name]%>
16
- <%=Shoppe.config[:email_address]%>
15
+ <%=Shoppe.settings.store_name%>
16
+ <%=Shoppe.settings.email_address%>
@@ -0,0 +1,45 @@
1
+ - @page_title = "Order #{@order.number}"
2
+
3
+ .despatchNote
4
+ %header
5
+ %h1= Shoppe.settings.store_name
6
+ %h2= t('.despatch_note')
7
+ .address
8
+ %p.name= @order.delivery_name
9
+ %p= @order.delivery_address1
10
+ %p= @order.delivery_address2
11
+ %p= @order.delivery_address3
12
+ %p= @order.delivery_address4
13
+ %p= @order.delivery_postcode
14
+ %p= @order.delivery_country.try(:name)
15
+
16
+ %table.details
17
+ %tr
18
+ %th= t('.order_number')
19
+ %th= t('.order_placed')
20
+ %th= t('.total_weight')
21
+ %th= t('.telephone')
22
+ %tr
23
+ %td= @order.number
24
+ %td= @order.received_at.to_s(:long)
25
+ %td= number_to_weight @order.total_weight
26
+ %td= @order.phone_number
27
+
28
+ %table.items
29
+ %thead
30
+ %tr
31
+ %th= t('.quantity')
32
+ %th= t('.product')
33
+ %th= t('.sku')
34
+ %th= t('.weight')
35
+ %th= t('.packed?')
36
+ %tbody
37
+ - for item in @order.order_items
38
+ %tr
39
+ %td= item.quantity
40
+ %td= item.ordered_item.full_name
41
+ %td= item.ordered_item.sku
42
+ %td= number_to_weight item.weight
43
+ %td.check
44
+
45
+ %p.footer= t('.footer', :default => "Thank you for your order!")
@@ -13,8 +13,8 @@
13
13
  %dd= f.text_field :id_eq
14
14
  %dt= f.label :first_name_or_last_name_or_company_cont, "Customer"
15
15
  %dd= f.text_field :first_name_or_last_name_or_company_cont
16
- %dt= f.label :address1_or_address2_or_address3_or_address4_or_postcode_cont, "Address"
17
- %dd= f.text_field :address1_or_address2_or_address3_or_address4_or_postcode_cont
16
+ %dt= f.label :address1_or_address2_or_address3_or_address4_or_postcode_cont, "Billing Address"
17
+ %dd= f.text_field :billing_address1_or_billing_address2_or_billing_address3_or_billing_address4_or_billing_postcode_cont
18
18
  %dt= f.label :consignment_number_cont, "Consignment Number"
19
19
  %dd= f.text_field :consignment_number_cont
20
20
  %dt= f.label :received_at_eq, "Received between"
@@ -1,7 +1,9 @@
1
1
  - @page_title = 'Order #' + @order.number
2
2
 
3
3
  = content_for :header do
4
- %p.buttons= link_to "Back to orders", :orders, :class => 'button'
4
+ %p.buttons
5
+ = link_to "Despatch Note", [:despatch_note, @order], :class => 'button', :rel => 'print'
6
+ = link_to "Back to orders", :orders, :class => 'button grey'
5
7
  %h2.orders Order <b>##{@order.number}</b>
6
8
 
7
9
  #order
@@ -12,14 +14,22 @@
12
14
  %dd= @order.first_name + ' ' + @order.last_name
13
15
  %dt Company
14
16
  %dd= @order.company.blank? ? '-' : @order.company
15
- %dt Address
16
- %dd= @order.address1
17
- %dd= @order.address2
18
- %dd= @order.address3
19
- %dd= @order.address4
20
- %dt Postcode
21
- %dd= @order.postcode
22
- %dd= @order.country.try(:name)
17
+ %dt Billing#{@order.separate_delivery_address? ? '' : '/Delivery'} Address
18
+ %dd= @order.billing_address1
19
+ %dd= @order.billing_address2
20
+ %dd= @order.billing_address3
21
+ %dd= @order.billing_address4
22
+ %dd= @order.billing_postcode
23
+ %dd= @order.billing_country.try(:name)
24
+ - if @order.separate_delivery_address?
25
+ %dt Delivery Address
26
+ %dd= @order.delivery_name
27
+ %dd= @order.delivery_address1
28
+ %dd= @order.delivery_address2
29
+ %dd= @order.delivery_address3
30
+ %dd= @order.delivery_address4
31
+ %dd= @order.delivery_postcode
32
+ %dd= @order.delivery_country.try(:name)
23
33
  .right
24
34
  %dl
25
35
  %dt E-Mail Address
@@ -27,7 +37,7 @@
27
37
  %dt Telephone
28
38
  %dd= @order.phone_number
29
39
  %dt Weight
30
- %dd #{@order.total_weight}kg
40
+ %dd= number_to_weight @order.total_weight
31
41
  %dt Build Time
32
42
  %dd= distance_of_time_in_words(@order.created_at, @order.received_at)
33
43
 
@@ -98,7 +108,7 @@
98
108
  %th SKU
99
109
  %th.money Cost
100
110
  %th.money Price
101
- %th.money= Shoppe.config[:tax_name]
111
+ %th.money= Shoppe.settings.tax_name
102
112
  %th.money Sub-Total
103
113
  %tbody
104
114
  - for item in @order.order_items
@@ -0,0 +1,19 @@
1
+ - @page_title = "Settings"
2
+
3
+ = content_for :header do
4
+ %h2.settings Settings
5
+
6
+ = form_tag :url => settings_path do |f|
7
+
8
+ - Shoppe.setting_groups.each do |group, fields|
9
+ = field_set_tag t(group) do
10
+ - fields.each do |f|
11
+ %dl.sided
12
+ %dt= settings_label f
13
+ %dd
14
+ = settings_field f
15
+ - if v = t("shoppe.settings.help")[f]
16
+ %p.help= v
17
+
18
+ %p.submit.sided
19
+ = submit_tag "Save Settings", :class => 'button green'
@@ -1,6 +1,6 @@
1
1
  Hello <%=@user.first_name%>
2
2
 
3
- Your new password for Shoppe on <%=Shoppe.config[:store_name]%> is: <%=@user.password%>
3
+ Your new password for Shoppe on <%=Shoppe.settings.store_name%> is: <%=@user.password%>
4
4
 
5
5
  You can login using your e-mail address.
6
6
 
@@ -56,6 +56,10 @@
56
56
  = f.check_box :active
57
57
  = f.label :active, "If checked, this product will be displayed within the public store"
58
58
  %dl.half
59
+ %dt= f.label :default, "Default varient?"
60
+ %dd.checkbox
61
+ = f.check_box :default
62
+ = f.label :default, "If checked, this varient will be the default"
59
63
 
60
64
  %p.submit
61
65
  - unless @variant.new_record?
@@ -0,0 +1,34 @@
1
+ en:
2
+ shoppe:
3
+
4
+ settings:
5
+
6
+ types:
7
+ # Force certain settings to certain type
8
+ demo_mode: boolean
9
+
10
+ labels:
11
+ # Labels for fields go here
12
+ email_address: Store E-Mail Address
13
+
14
+ options:
15
+ # Options for boolean settings
16
+ demo_mode:
17
+ affirmative: Enabled
18
+ negative: Disabled
19
+
20
+ help:
21
+ # Help text for individual fields
22
+ store_name: This is the name of your store which will be used through the Shoppe admin interface as well as in the default outbound e-mail messages.
23
+ email_address: The e-mail address to use when sending outbound messages. Must just be an e-mail address.
24
+ currency_unit: The symbol to be displayed before all numbers which relate to money. Only applies to the admin interface and must be implemented separately in your base application.
25
+ tax_name: The name for "Tax" which will be displayed in your admin interface. Commonly replaced with VAT in European countries.
26
+ demo_mode: If enabled, your Shoppe admin interface will allow any users to login and will not permit changes to your users. This should be used with caution and never enabled for a production store.
27
+
28
+ defaults:
29
+ store_name: Widgets Inc.
30
+ email_address: sales@example.com
31
+ currency_unit: $
32
+ tax_name: Tax
33
+ demo_mode: false
34
+
@@ -11,6 +11,7 @@ Shoppe::Engine.routes.draw do
11
11
  post :reject, :on => :member
12
12
  post :ship, :on => :member
13
13
  post :pay, :on => :member
14
+ get :despatch_note, :on => :member
14
15
  end
15
16
  resources :stock_level_adjustments, :only => [:index, :create]
16
17
  resources :delivery_services do
@@ -19,6 +20,10 @@ Shoppe::Engine.routes.draw do
19
20
  resources :tax_rates
20
21
  resources :users
21
22
  resources :attachments, :only => :destroy
23
+
24
+ get 'settings'=> 'settings#edit'
25
+ post 'settings' => 'settings#update'
26
+
22
27
  get 'login' => 'sessions#new'
23
28
  post 'login' => 'sessions#create'
24
29
  match 'login/reset' => 'sessions#reset', :via => [:get, :post]
@@ -1,17 +1,29 @@
1
1
  class CreateShoppeInitialSchema < ActiveRecord::Migration
2
2
  def up
3
- create_table "shoppe_delivery_service_prices", force: true do |t|
3
+ create_table "shoppe_countries" do |t|
4
+ t.string "name"
5
+ t.string "code2"
6
+ t.string "code3"
7
+ t.string "continent"
8
+ t.string "tld"
9
+ t.string "currency"
10
+ t.boolean "eu_member", default: false
11
+ end
12
+
13
+ create_table "shoppe_delivery_service_prices" do |t|
4
14
  t.integer "delivery_service_id"
5
15
  t.string "code"
6
16
  t.decimal "price", precision: 8, scale: 2
7
- t.decimal "tax_rate", precision: 8, scale: 2
17
+ t.decimal "cost_price", precision: 8, scale: 2
18
+ t.integer "tax_rate_id"
8
19
  t.decimal "min_weight", precision: 8, scale: 2
9
20
  t.decimal "max_weight", precision: 8, scale: 2
10
21
  t.datetime "created_at"
11
22
  t.datetime "updated_at"
23
+ t.text "country_ids"
12
24
  end
13
25
 
14
- create_table "shoppe_delivery_services", force: true do |t|
26
+ create_table "shoppe_delivery_services" do |t|
15
27
  t.string "name"
16
28
  t.string "code"
17
29
  t.boolean "default", default: false
@@ -22,28 +34,31 @@ class CreateShoppeInitialSchema < ActiveRecord::Migration
22
34
  t.string "tracking_url"
23
35
  end
24
36
 
25
- create_table "shoppe_order_items", force: true do |t|
37
+ create_table "shoppe_order_items" do |t|
26
38
  t.integer "order_id"
27
- t.integer "product_id"
28
- t.integer "quantity", default: 1
29
- t.decimal "unit_price", precision: 8, scale: 2
30
- t.decimal "tax_amount", precision: 8, scale: 2
31
- t.decimal "tax_rate", precision: 8, scale: 2
32
- t.decimal "weight", precision: 8, scale: 3, default: 0.0
39
+ t.integer "ordered_item_id"
40
+ t.string "ordered_item_type"
41
+ t.integer "quantity", default: 1
42
+ t.decimal "unit_price", precision: 8, scale: 2
43
+ t.decimal "unit_cost_price", precision: 8, scale: 2
44
+ t.decimal "tax_amount", precision: 8, scale: 2
45
+ t.decimal "tax_rate", precision: 8, scale: 2
46
+ t.decimal "weight", precision: 8, scale: 3, default: 0.0
33
47
  t.datetime "created_at"
34
48
  t.datetime "updated_at"
35
49
  end
36
50
 
37
- create_table "shoppe_orders", force: true do |t|
51
+ create_table "shoppe_orders" do |t|
38
52
  t.string "token"
39
53
  t.string "first_name"
40
54
  t.string "last_name"
41
55
  t.string "company"
42
- t.string "address1"
43
- t.string "address2"
44
- t.string "address3"
45
- t.string "address4"
46
- t.string "postcode"
56
+ t.string "billing_address1"
57
+ t.string "billing_address2"
58
+ t.string "billing_address3"
59
+ t.string "billing_address4"
60
+ t.string "billing_postcode"
61
+ t.integer "billing_country_id"
47
62
  t.string "email_address"
48
63
  t.string "phone_number"
49
64
  t.string "status"
@@ -53,9 +68,10 @@ class CreateShoppeInitialSchema < ActiveRecord::Migration
53
68
  t.datetime "created_at"
54
69
  t.datetime "updated_at"
55
70
  t.integer "delivery_service_id"
56
- t.decimal "delivery_price", precision: 8, scale: 2
57
- t.decimal "delivery_tax_rate", precision: 8, scale: 2
58
- t.decimal "delivery_tax_amount", precision: 8, scale: 2
71
+ t.decimal "delivery_price", precision: 8, scale: 2
72
+ t.decimal "delivery_cost_price", precision: 8, scale: 2
73
+ t.decimal "delivery_tax_rate", precision: 8, scale: 2
74
+ t.decimal "delivery_tax_amount", precision: 8, scale: 2
59
75
  t.datetime "paid_at"
60
76
  t.integer "accepted_by"
61
77
  t.integer "shipped_by"
@@ -63,12 +79,31 @@ class CreateShoppeInitialSchema < ActiveRecord::Migration
63
79
  t.datetime "rejected_at"
64
80
  t.integer "rejected_by"
65
81
  t.string "ip_address"
66
- t.string "country"
67
82
  t.string "payment_reference"
68
83
  t.string "payment_method"
84
+ t.text "notes"
85
+ t.boolean "separate_delivery_address", default: false
86
+ t.string "delivery_name"
87
+ t.string "delivery_address1"
88
+ t.string "delivery_address2"
89
+ t.string "delivery_address3"
90
+ t.string "delivery_address4"
91
+ t.string "deilvery_postcode"
92
+ t.integer "delivery_country_id"
69
93
  end
70
94
 
71
- create_table "shoppe_product_categories", force: true do |t|
95
+ create_table "shoppe_product_attributes" do |t|
96
+ t.integer "product_id"
97
+ t.string "key"
98
+ t.string "value"
99
+ t.integer "position", default: 1
100
+ t.boolean "searchable", default: true
101
+ t.datetime "created_at"
102
+ t.datetime "updated_at"
103
+ t.boolean "public", default: true
104
+ end
105
+
106
+ create_table "shoppe_product_categories" do |t|
72
107
  t.string "name"
73
108
  t.string "permalink"
74
109
  t.text "description"
@@ -76,9 +111,10 @@ class CreateShoppeInitialSchema < ActiveRecord::Migration
76
111
  t.datetime "updated_at"
77
112
  end
78
113
 
79
- create_table "shoppe_products", force: true do |t|
114
+ create_table "shoppe_products" do |t|
115
+ t.integer "parent_id"
80
116
  t.integer "product_category_id"
81
- t.string "title"
117
+ t.string "name"
82
118
  t.string "sku"
83
119
  t.string "permalink"
84
120
  t.text "description"
@@ -86,15 +122,42 @@ class CreateShoppeInitialSchema < ActiveRecord::Migration
86
122
  t.boolean "active", default: true
87
123
  t.decimal "weight", precision: 8, scale: 3, default: 0.0
88
124
  t.decimal "price", precision: 8, scale: 2, default: 0.0
89
- t.decimal "tax_rate", precision: 8, scale: 2, default: 0.0
90
- t.integer "stock", default: 0
125
+ t.decimal "cost_price", precision: 8, scale: 2, default: 0.0
126
+ t.integer "tax_rate_id"
91
127
  t.datetime "created_at"
92
128
  t.datetime "updated_at"
93
129
  t.boolean "featured", default: false
94
130
  t.text "in_the_box"
131
+ t.boolean "stock_control", default: true
132
+ t.boolean "default", default: false
133
+ end
134
+
135
+ create_table "shoppe_settings" do |t|
136
+ t.string "key"
137
+ t.string "value"
138
+ t.string "value_type"
95
139
  end
96
140
 
97
- create_table "shoppe_users", force: true do |t|
141
+ create_table "shoppe_stock_level_adjustments" do |t|
142
+ t.integer "item_id"
143
+ t.string "item_type"
144
+ t.string "description"
145
+ t.integer "adjustment", default: 0
146
+ t.string "parent_type"
147
+ t.integer "parent_id"
148
+ t.datetime "created_at"
149
+ t.datetime "updated_at"
150
+ end
151
+
152
+ create_table "shoppe_tax_rates" do |t|
153
+ t.string "name"
154
+ t.decimal "rate", precision: 8, scale: 2
155
+ t.datetime "created_at"
156
+ t.datetime "updated_at"
157
+ t.text "country_ids"
158
+ end
159
+
160
+ create_table "shoppe_users" do |t|
98
161
  t.string "first_name"
99
162
  t.string "last_name"
100
163
  t.string "email_address"
@@ -105,12 +168,8 @@ class CreateShoppeInitialSchema < ActiveRecord::Migration
105
168
  end
106
169
 
107
170
  def down
108
- drop_table :shoppe_delivery_service_prices
109
- drop_table :shoppe_delivery_services
110
- drop_table :shoppe_order_items
111
- drop_table :shoppe_orders
112
- drop_table :shoppe_product_categories
113
- drop_table :shoppe_products
114
- drop_table :shoppe_users
171
+ [:users, :tax_rates, :stock_level_adjustments, :settings, :products, :product_categories, :product_attributes, :orders, :order_items, :delivery_services, :delivery_service_prices, :countries].each do |table|
172
+ drop_table "shoppe_#{table}"
173
+ end
115
174
  end
116
175
  end
@@ -101,7 +101,7 @@ pro.product_attributes.create!(:key => 'Lines', :value => '10', :position => 1)
101
101
  pro.product_attributes.create!(:key => 'Colour Screen?', :value => 'Yes', :position => 1)
102
102
  pro.product_attributes.create!(:key => 'Power over ethernet?', :value => 'Yes', :position => 1)
103
103
 
104
- v1 = pro.variants.create(:name => "White/Grey", :sku => "SM-870-GREY", :price => 230.00, :cost_price => 220, :tax_rate => tax_rate, :weight => 1.35)
104
+ v1 = pro.variants.create(:name => "White/Grey", :sku => "SM-870-GREY", :price => 230.00, :cost_price => 220, :tax_rate => tax_rate, :weight => 1.35, :default => true)
105
105
  v1.default_image_file = get_file('snom-870-grey.jpg')
106
106
  v1.save!
107
107
  v1.stock_level_adjustments.create(:description => 'Initial Stock', :adjustment => 4)
@@ -1,3 +1,6 @@
1
+ require "coffee-rails"
2
+ require "sass-rails"
3
+ require "jquery-rails"
1
4
  require 'haml'
2
5
  require 'bcrypt'
3
6
  require 'dynamic_form'
@@ -14,51 +17,26 @@ module Shoppe
14
17
  class Error < StandardError; end
15
18
 
16
19
  class << self
20
+
17
21
  def root
18
22
  File.expand_path('../../', __FILE__)
19
23
  end
20
24
 
21
- def config
22
- @config ||= begin
23
- path = Rails.root.join('config', 'shoppe.yml')
24
- if File.exist?(path)
25
- config = YAML.load_file(path).with_indifferent_access
26
- setup_config(config)
27
- config
28
- else
29
- raise InvalidConfiguration, "Shoppe configuration file missing at #{path}"
30
- end
31
- end
25
+ def settings
26
+ Thread.current[:shoppe_settings] ||= Shoppe::Settings.new(Shoppe::Setting.to_hash)
32
27
  end
33
28
 
34
- def setup_config(config)
35
- ActionMailer::Base.smtp_settings = config[:smtp_settings] if config[:smtp_settings]
29
+ def reset_settings
30
+ Thread.current[:shoppe_settings] = nil
36
31
  end
37
32
 
38
- def validate_live_config(*requirements)
39
- validate_config(self.config, [], *requirements)
33
+ def add_setting_group(group, fields = [])
34
+ setting_groups[group] ||= []
35
+ setting_groups[group] = setting_groups[group] | fields
40
36
  end
41
37
 
42
- def validate_config(config, scope, *requirements)
43
- for req in requirements
44
- case req
45
- when String, Symbol
46
- unless config.keys.include?(req.to_s)
47
- raise Shoppe::Errors::InvalidConfiguration, "Missing configuration option '#{scope.join('.')}.#{req}' in shoppe.yml"
48
- end
49
- when Array
50
- validate_config(config, scope, *req)
51
- when Hash
52
- req.each do |key, value|
53
- if config[key] && config[key].is_a?(Hash)
54
- scope << key
55
- validate_config(config[key], scope, *value)
56
- else
57
- validate_config(config, scope, key)
58
- end
59
- end
60
- end
61
- end
38
+ def setting_groups
39
+ @setting_groups ||= {}
62
40
  end
63
41
 
64
42
  end