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/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,67 @@
1
+ /*
2
+ *= require shoppe/reset
3
+ */
4
+ html { font-family:'Helvetica Neue', Helvetica, Arial, sans-serif; color:#000; font-size:12px;background:#efefef;}
5
+ #content {
6
+ background:#fff;
7
+ margin:5%;
8
+ outline:1px solid #ccc;
9
+ padding:35px;
10
+ }
11
+
12
+ div.despatchNote {
13
+ header {
14
+ float:left;
15
+ h1 {
16
+ font-size:1.8em;
17
+ font-weight:300;
18
+ }
19
+ h2 { margin-top:5px; font-size:2.3em; font-weight:500; }
20
+ width:40%;
21
+ }
22
+
23
+ .address {
24
+ border:1px solid #000;
25
+ padding:25px;
26
+ margin-left:45%;
27
+ line-height:1.5;
28
+ font-size:1.3em;
29
+ p.name { font-size:1.2em; font-weight:500;}
30
+ }
31
+ table.details {
32
+ width:100%;
33
+ margin:25px 0;
34
+ td, th {
35
+ border:1px solid #000;
36
+ padding:10px;
37
+ text-align:center;
38
+ }
39
+ th { background:#efefef;}
40
+ }
41
+
42
+ table.items {
43
+ width:100%;
44
+ margin:25px 0;
45
+ td, th {
46
+ border:1px solid #000;
47
+ padding:10px;
48
+ text-align:center;
49
+ &.check { width:5%;}
50
+ }
51
+ th { background:#efefef;}
52
+ }
53
+
54
+ p.footer {
55
+ font-size:1.2em;
56
+ border:1px solid #000;
57
+ padding:15px;
58
+ text-align:center;
59
+ }
60
+ }
61
+
62
+
63
+ @media print {
64
+ html { background:none;}
65
+ body {margin:5%;}
66
+ #content { margin:0; padding:0; outline:0;}
67
+ }
@@ -0,0 +1,93 @@
1
+ html, body, body div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, figure, footer, header, hgroup, menu, nav, section, time, mark, audio, video {
2
+ margin: 0;
3
+ padding: 0;
4
+ border: 0;
5
+ outline: 0;
6
+ font-size: 100%;
7
+ letter-spacing:0;
8
+ vertical-align: baseline;
9
+ background: transparent;
10
+ }
11
+
12
+ article, aside, figure, footer, header, hgroup, nav, section {display: block;}
13
+
14
+ img,object,embed {max-width: 100%;}
15
+ ul {list-style: none;}
16
+ blockquote, q {quotes: none;}
17
+ b,strong { font-weight:bold;}
18
+ blockquote:before, blockquote:after, q:before, q:after {content: ''; content: none;}
19
+
20
+ a {margin: 0; padding: 0; font-size: 100%; vertical-align: baseline; background: transparent;}
21
+
22
+ del {text-decoration: line-through;}
23
+
24
+ abbr[title], dfn[title] {border-bottom: 1px dotted #000; cursor: help;}
25
+
26
+ /* tables still need cellspacing="0" in the markup */
27
+ table {border-collapse: collapse; border-spacing: 0;}
28
+ th {font-weight: bold; vertical-align: bottom;}
29
+ td {font-weight: normal; vertical-align: top;}
30
+
31
+ hr {display: block; height: 1px; border: 0; border-top: 1px solid #ccc; margin: 1em 0; padding: 0;}
32
+
33
+ input, select {vertical-align: middle;}
34
+
35
+ pre {
36
+ white-space: pre; /* CSS2 */
37
+ white-space: pre-wrap; /* CSS 2.1 */
38
+ white-space: pre-line; /* CSS 3 (and 2.1 as well, actually) */
39
+ word-wrap: break-word; /* IE */
40
+ }
41
+
42
+ input[type="radio"] {vertical-align: text-bottom;}
43
+ input[type="checkbox"] {vertical-align: bottom; *vertical-align: baseline;}
44
+ .ie6 input {vertical-align: text-bottom;}
45
+
46
+ select, input, textarea {font: 99% sans-serif;}
47
+
48
+ table {font-size: inherit; font: 100%;}
49
+
50
+ /* Accessible focus treatment
51
+ people.opera.com/patrickl/experiments/keyboard/test */
52
+ a:hover, a:active {outline: none;}
53
+
54
+ small {font-size: 85%;}
55
+
56
+ strong, th {font-weight: bold;}
57
+
58
+ td, td img {vertical-align: top;}
59
+
60
+ /* Make sure sup and sub don't screw with your line-heights
61
+ gist.github.com/413930 */
62
+ sub, sup {font-size: 75%; line-height: 0; position: relative;}
63
+ sup {top: -0.5em;}
64
+ sub {bottom: -0.25em;}
65
+
66
+ /* standardize any monospaced elements */
67
+ pre, code, kbd, samp {font-family: monospace, sans-serif;}
68
+
69
+ /* hand cursor on clickable elements */
70
+ .clickable,
71
+ label,
72
+ input[type=button],
73
+ input[type=submit],
74
+ button {cursor: pointer;}
75
+
76
+ /* Webkit browsers add a 2px margin outside the chrome of form elements */
77
+ button, input, select, textarea {margin: 0;}
78
+
79
+ /* make buttons play nice in IE */
80
+ button {width: auto; overflow: visible;}
81
+
82
+ /* scale images in IE7 more attractively */
83
+ .ie7 img {-ms-interpolation-mode: bicubic;}
84
+
85
+ /* prevent BG image flicker upon hover */
86
+ .ie6 html {filter: expression(document.execCommand("BackgroundImageCache", false, true));}
87
+
88
+ /* let's clear some floats */
89
+ .clearfix:before, .clearfix:after { content: "\0020"; display: block; height: 0; overflow: hidden; }
90
+ .clearfix:after { clear: both; }
91
+ .clearfix { zoom: 1; }
92
+
93
+ select, input, textarea { outline: none;}
@@ -0,0 +1,106 @@
1
+ /*
2
+ *= require shoppe/reset
3
+ *= require shoppe/elements
4
+ *= require_self
5
+ */
6
+
7
+
8
+ @import 'variables';
9
+
10
+ html { overflow-y: scroll; height:100%; background:#fff;}
11
+ body { font-family:$font; font-weight: normal; font-size: 100%; min-width:900px; height:100%; }
12
+ @import 'variables';
13
+
14
+ html.login {
15
+ background:image-url('shoppe/logo.svg') #40454D no-repeat center 100px;
16
+ background-size:70px;
17
+
18
+ #flash-alert {
19
+ background:#C17391;
20
+ position:absolute;
21
+ top:0;
22
+ width:100%;
23
+ text-align:center;
24
+ color:#fff;
25
+ padding:15px 0;
26
+ }
27
+
28
+ #flash-notice {
29
+ background:#94C164;
30
+ position:absolute;
31
+ top:0;
32
+ width:100%;
33
+ text-align:center;
34
+ color:#fff;
35
+ padding:15px 0;
36
+ }
37
+
38
+ //
39
+ // Error
40
+ //
41
+ div.error {
42
+ background:#fff;
43
+ width:400px;
44
+ margin:auto;
45
+ margin-top:200px;
46
+ padding:25px;
47
+ line-height:1.5;
48
+ font-size:0.9em;
49
+ text-align:center;
50
+ h2 { color:#C17391; text-transform:uppercase; font-size:0.8em; margin-bottom:15px;}
51
+ p.back { margin-top:25px;}
52
+ p.message { font-size:1.1em;}
53
+ }
54
+
55
+ //
56
+ // Primary login area
57
+ //
58
+ div.loginArea {
59
+ background:#fff;
60
+ width:400px;
61
+ margin:auto;
62
+ margin-top:200px;
63
+ padding-top:50px;
64
+
65
+ h2 {
66
+ text-align:center;
67
+ font-weight:300;
68
+ font-size:1.4em;
69
+ color:#40454D;
70
+ margin-bottom:30px;
71
+ }
72
+ p.field {
73
+ text-align:center;
74
+ margin-bottom:15px;
75
+ input {
76
+ padding:7px;
77
+ border:0;
78
+ border-radius:4px;
79
+ border:1px solid #c0c6ce;
80
+ width:275px;
81
+ font-family:$font;
82
+ font-weight:600;
83
+ background:#eef0f4;
84
+ box-shadow:inset 1px 1px 1px rgba(42,51,61,0.1);
85
+ text-align:center;
86
+ &::-webkit-input-placeholder { color:#b7bfcb; font-weight:normal;}
87
+ &:-moz-placeholder { color:#b7bfcb; font-weight:normal;}
88
+ &::-moz-placeholder { color:#b7bfcb; font-weight:normal;}
89
+ &:-ms-input-placeholder { color:#b7bfcb; font-weight:normal;}
90
+ }
91
+ &:last-child { margin-bottom:0;}
92
+ }
93
+ p.submit {
94
+ padding:15px 0 25px 0;
95
+ text-align:center;
96
+ }
97
+ p.reset {
98
+ background:#353A41;
99
+ font-size:0.9em;
100
+ padding:15px 0;
101
+ text-align:center;
102
+ a { color:rgba(255,255,255,0.5);}
103
+ }
104
+ }
105
+
106
+ }
@@ -0,0 +1 @@
1
+ $font: 'Helvetica Neue', Arial, sans-serif;
@@ -0,0 +1,47 @@
1
+ module Shoppe
2
+ class AddressesController < Shoppe::ApplicationController
3
+
4
+ before_filter { @active_nav = :customers }
5
+ before_filter { params[:customer_id] && @customer = Shoppe::Customer.find(params[:customer_id])}
6
+ before_filter { params[:id] && @address = @customer.addresses.find(params[:id])}
7
+
8
+ def new
9
+ @address = Shoppe::Address.new
10
+ end
11
+
12
+ def edit
13
+ end
14
+
15
+ def create
16
+ @address = @customer.addresses.build(safe_params)
17
+ if @customer.addresses.count == 0
18
+ @address.default = true
19
+ end
20
+ if @customer.save
21
+ redirect_to @customer, :flash => {:notice => "Address has been created successfully"}
22
+ else
23
+ render action: "new"
24
+ end
25
+ end
26
+
27
+ def update
28
+ if @address.update(safe_params)
29
+ redirect_to @customer, :flash => {:notice => "Address has been updated successfully"}
30
+ else
31
+ render action: "edit"
32
+ end
33
+ end
34
+
35
+ def destroy
36
+ @address.destroy
37
+ redirect_to @customer, :flash => {:notice => "Address has been deleted successfully"}
38
+ end
39
+
40
+ private
41
+
42
+ def safe_params
43
+ params[:address].permit(:address_type, :address1, :address2, :address3, :address4, :postcode, :country_id)
44
+ end
45
+
46
+ end
47
+ end
@@ -0,0 +1,46 @@
1
+ module Shoppe
2
+ class ApplicationController < ActionController::Base
3
+
4
+ before_filter :login_required
5
+
6
+ rescue_from ActiveRecord::DeleteRestrictionError do |e|
7
+ redirect_to request.referer || root_path, :alert => e.message
8
+ end
9
+
10
+ rescue_from Shoppe::Error do |e|
11
+ @exception = e
12
+ render :layout => 'shoppe/sub', :template => 'shoppe/shared/error'
13
+ end
14
+
15
+ private
16
+
17
+ def login_required
18
+ unless logged_in?
19
+ redirect_to login_path
20
+ end
21
+ end
22
+
23
+ def logged_in?
24
+ current_user.is_a?(User)
25
+ end
26
+
27
+ def current_user
28
+ @current_user ||= login_from_session || login_with_demo_mdoe || :false
29
+ end
30
+
31
+ def login_from_session
32
+ if session[:shoppe_user_id]
33
+ @user = User.find_by_id(session[:shoppe_user_id])
34
+ end
35
+ end
36
+
37
+ def login_with_demo_mdoe
38
+ if Shoppe.settings.demo_mode?
39
+ @user = User.first
40
+ end
41
+ end
42
+
43
+ helper_method :current_user, :logged_in?
44
+
45
+ end
46
+ end
@@ -0,0 +1,14 @@
1
+ module Shoppe
2
+ class AttachmentsController < Shoppe::ApplicationController
3
+
4
+ def destroy
5
+ @attachment = Nifty::Attachments::Attachment.find(params[:id])
6
+ @attachment.destroy
7
+ respond_to do |wants|
8
+ wants.html { redirect_to request.referer, :notice => t('shoppe.attachments.remove_notice')}
9
+ wants.json { render :status => 'complete' }
10
+ end
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,47 @@
1
+ module Shoppe
2
+ class CountriesController < Shoppe::ApplicationController
3
+
4
+ before_filter { @active_nav = :countries }
5
+ before_filter { params[:id] && @country = Shoppe::Country.find(params[:id]) }
6
+
7
+ def index
8
+ @countries = Shoppe::Country.ordered
9
+ end
10
+
11
+ def new
12
+ @country = Shoppe::Country.new
13
+ end
14
+
15
+ def create
16
+ @country = Shoppe::Country.new(safe_params)
17
+ if @country.save
18
+ redirect_to :countries, :flash => {:notice => t('shoppe.countries.create_notice')}
19
+ else
20
+ render :action => "new"
21
+ end
22
+ end
23
+
24
+ def edit
25
+ end
26
+
27
+ def update
28
+ if @country.update(safe_params)
29
+ redirect_to [:edit, @country], :flash => {:notice => t('shoppe.countries.update_notice') }
30
+ else
31
+ render :action => "edit"
32
+ end
33
+ end
34
+
35
+ def destroy
36
+ @country.destroy
37
+ redirect_to :countries, :flash => {:notice => t('shoppe.countries.destroy_notice')}
38
+ end
39
+
40
+ private
41
+
42
+ def safe_params
43
+ params[:country].permit(:name, :code2, :code3, :continent, :tld, :currency, :eu_member)
44
+ end
45
+
46
+ end
47
+ end
@@ -0,0 +1,55 @@
1
+ module Shoppe
2
+ class CustomersController < Shoppe::ApplicationController
3
+
4
+ before_filter { @active_nav = :customers }
5
+ before_filter { params[:id] && @customer = Shoppe::Customer.find(params[:id])}
6
+
7
+ def index
8
+ @query = Shoppe::Customer.ordered.page(params[:page]).search(params[:q])
9
+ @customers = @query.result
10
+ end
11
+
12
+ def new
13
+ @customer = Shoppe::Customer.new
14
+ end
15
+
16
+ def show
17
+ @addresses = @customer.addresses.ordered.load
18
+ @orders = @customer.orders.ordered.load
19
+ end
20
+
21
+ def create
22
+ @customer = Shoppe::Customer.new(safe_params)
23
+ if @customer.save
24
+ redirect_to @customer, :flash => {:notice => "Customer has been created successfully"}
25
+ else
26
+ render :action => "new"
27
+ end
28
+ end
29
+
30
+ def update
31
+ if @customer.update(safe_params)
32
+ redirect_to @customer, :flash => {:notice => "Customer has been updated successfully"}
33
+ else
34
+ render :action => "edit"
35
+ end
36
+ end
37
+
38
+ def destroy
39
+ @customer.destroy
40
+ redirect_to customers_path, :flash => {:notice => "Customer has been deleted successfully"}
41
+ end
42
+
43
+ def search
44
+ index
45
+ render :action => "index"
46
+ end
47
+
48
+ private
49
+
50
+ def safe_params
51
+ params[:customer].permit(:first_name, :last_name, :company, :email, :phone, :mobile)
52
+ end
53
+
54
+ end
55
+ end