nimbleshop_core 0.0.1.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (359) hide show
  1. data/README.md +13 -0
  2. data/Rakefile +15 -0
  3. data/app/assets/images/engines/nimbleshop_authorizedotnet/american_express.png +0 -0
  4. data/app/assets/images/engines/nimbleshop_authorizedotnet/authorize_net_big.png +0 -0
  5. data/app/assets/images/engines/nimbleshop_authorizedotnet/authorizedotnet_big.png +0 -0
  6. data/app/assets/images/engines/nimbleshop_authorizedotnet/discover.png +0 -0
  7. data/app/assets/images/engines/nimbleshop_authorizedotnet/mastercard.png +0 -0
  8. data/app/assets/images/engines/nimbleshop_authorizedotnet/visa.png +0 -0
  9. data/app/assets/images/engines/nimbleshop_cod/cod_small.png +0 -0
  10. data/app/assets/images/engines/nimbleshop_paypalwp/paypal_big.png +0 -0
  11. data/app/assets/images/engines/nimbleshop_paypalwp/paypal_small.png +0 -0
  12. data/app/assets/images/engines/nimbleshop_splitable/splitable.png +0 -0
  13. data/app/assets/images/engines/nimbleshop_splitable/splitable_big.png +0 -0
  14. data/app/assets/images/engines/nimbleshop_splitable/splitable_small.png +0 -0
  15. data/app/assets/javascripts/admin/products/edit.js.coffee +19 -0
  16. data/app/assets/javascripts/admin/shipping_methods/edit.js.coffee +6 -0
  17. data/app/assets/javascripts/admin.js +25 -0
  18. data/app/assets/javascripts/fadeout_success.js.coffee +2 -0
  19. data/app/assets/javascripts/payment_method.js.coffee +19 -0
  20. data/app/assets/javascripts/product-group-condition.js.coffee +33 -0
  21. data/app/assets/javascripts/remove_deletion_of_product_pictures.js.coffee +5 -0
  22. data/app/assets/javascripts/shipit.js.coffee +10 -0
  23. data/app/assets/javascripts/twitter_bootstrap.js.coffee +4 -0
  24. data/app/assets/stylesheets/admin.css +9 -0
  25. data/app/assets/stylesheets/admin_bootstrap_and_overrides.css.less +38 -0
  26. data/app/assets/stylesheets/admin_custom.css +104 -0
  27. data/app/assets/twitter/bootstrap/glyphicons-halflings-white.png +0 -0
  28. data/app/assets/twitter/bootstrap/glyphicons-halflings.png +0 -0
  29. data/app/controllers/admin/custom_fields_controller.rb +56 -0
  30. data/app/controllers/admin/link_groups_controller.rb +76 -0
  31. data/app/controllers/admin/main_controller.rb +9 -0
  32. data/app/controllers/admin/navigations_controller.rb +49 -0
  33. data/app/controllers/admin/orders_controller.rb +47 -0
  34. data/app/controllers/admin/payment_methods_controller.rb +26 -0
  35. data/app/controllers/admin/product_groups_controller.rb +70 -0
  36. data/app/controllers/admin/products_controller.rb +71 -0
  37. data/app/controllers/admin/shipments_controller.rb +19 -0
  38. data/app/controllers/admin/shipping_methods_controller.rb +93 -0
  39. data/app/controllers/admin/shipping_zones_controller.rb +62 -0
  40. data/app/controllers/admin/shops_controller.rb +33 -0
  41. data/app/controllers/admin_controller.rb +38 -0
  42. data/app/helpers/admin_helper.rb +83 -0
  43. data/app/helpers/nimbleshop_helper.rb +43 -0
  44. data/app/helpers/payment_method_helper.rb +52 -0
  45. data/app/mailers/admin_mailer.rb +22 -0
  46. data/app/mailers/mailer.rb +31 -0
  47. data/app/models/address.rb +69 -0
  48. data/app/models/country_shipping_zone.rb +36 -0
  49. data/app/models/creditcard.rb +95 -0
  50. data/app/models/custom_field.rb +8 -0
  51. data/app/models/custom_field_answer/field.rb +101 -0
  52. data/app/models/custom_field_answer.rb +17 -0
  53. data/app/models/line_item.rb +48 -0
  54. data/app/models/link.rb +3 -0
  55. data/app/models/link_group.rb +8 -0
  56. data/app/models/navigation.rb +7 -0
  57. data/app/models/order.rb +158 -0
  58. data/app/models/payment_method.rb +20 -0
  59. data/app/models/payment_transaction.rb +11 -0
  60. data/app/models/picture.rb +30 -0
  61. data/app/models/product.rb +76 -0
  62. data/app/models/product_group.rb +65 -0
  63. data/app/models/product_group_condition.rb +8 -0
  64. data/app/models/regional_shipping_zone.rb +25 -0
  65. data/app/models/shipment.rb +19 -0
  66. data/app/models/shipment_carrier.rb +3 -0
  67. data/app/models/shipping_cost_calculator.rb +9 -0
  68. data/app/models/shipping_method.rb +103 -0
  69. data/app/models/shipping_zone.rb +9 -0
  70. data/app/models/shop.rb +26 -0
  71. data/app/models/tax_calculator.rb +18 -0
  72. data/app/observers/order_observer.rb +53 -0
  73. data/app/uploaders/picture_uploader.rb +65 -0
  74. data/app/views/admin/custom_fields/_form.html.erb +45 -0
  75. data/app/views/admin/custom_fields/edit.html.erb +7 -0
  76. data/app/views/admin/custom_fields/index.html.erb +31 -0
  77. data/app/views/admin/custom_fields/new.html.erb +7 -0
  78. data/app/views/admin/link_groups/_form.html.erb +31 -0
  79. data/app/views/admin/link_groups/_link_group.html.erb +50 -0
  80. data/app/views/admin/link_groups/_link_group_title.html.erb +5 -0
  81. data/app/views/admin/link_groups/edit.html.erb +8 -0
  82. data/app/views/admin/link_groups/index.html.erb +29 -0
  83. data/app/views/admin/link_groups/new.html.erb +9 -0
  84. data/app/views/admin/mailer/new_order_notification.text.erb +31 -0
  85. data/app/views/admin/main/index.html.erb +5 -0
  86. data/app/views/admin/navigations/new.html.erb +29 -0
  87. data/app/views/admin/orders/_line_item.html.erb +11 -0
  88. data/app/views/admin/orders/_line_items.html.erb +39 -0
  89. data/app/views/admin/orders/_payment_info.html.erb +20 -0
  90. data/app/views/admin/orders/_shipping_info.html.erb +40 -0
  91. data/app/views/admin/orders/index.html.erb +33 -0
  92. data/app/views/admin/orders/show.html.erb +40 -0
  93. data/app/views/admin/payment_methods/index.html.erb +6 -0
  94. data/app/views/admin/product_groups/_condition.html.mustache +20 -0
  95. data/app/views/admin/product_groups/_form.html.erb +72 -0
  96. data/app/views/admin/product_groups/edit.html.erb +7 -0
  97. data/app/views/admin/product_groups/index.html.erb +30 -0
  98. data/app/views/admin/product_groups/new.html.erb +7 -0
  99. data/app/views/admin/product_groups/show.html.erb +9 -0
  100. data/app/views/admin/products/_custom_field_answer.html.erb +9 -0
  101. data/app/views/admin/products/_form.html.erb +69 -0
  102. data/app/views/admin/products/_handle_pictures.html.erb +32 -0
  103. data/app/views/admin/products/_pictures.html.erb +33 -0
  104. data/app/views/admin/products/edit.html.erb +26 -0
  105. data/app/views/admin/products/index.html.erb +34 -0
  106. data/app/views/admin/products/new.html.erb +9 -0
  107. data/app/views/admin/shipping_methods/_form.html.erb +58 -0
  108. data/app/views/admin/shipping_methods/_shipping_method.html.erb +31 -0
  109. data/app/views/admin/shipping_methods/edit.html.erb +18 -0
  110. data/app/views/admin/shipping_methods/new.html.erb +7 -0
  111. data/app/views/admin/shipping_zones/_form.html.erb +31 -0
  112. data/app/views/admin/shipping_zones/_shipping_method.html.erb +13 -0
  113. data/app/views/admin/shipping_zones/_shipping_zone.html.erb +47 -0
  114. data/app/views/admin/shipping_zones/edit.html.erb +8 -0
  115. data/app/views/admin/shipping_zones/index.html.erb +16 -0
  116. data/app/views/admin/shipping_zones/new.html.erb +8 -0
  117. data/app/views/admin/shops/edit.html.erb +119 -0
  118. data/app/views/layouts/_admin_footer.html.erb +23 -0
  119. data/app/views/layouts/_admin_sidebar.html.erb +0 -0
  120. data/app/views/layouts/_container.html.erb +33 -0
  121. data/app/views/layouts/_top_nav_bar.html.erb +30 -0
  122. data/app/views/layouts/admin.html.erb +35 -0
  123. data/app/views/layouts/payment_method.html.erb +12 -0
  124. data/app/views/mailer/order_notification_to_buyer.text.erb +31 -0
  125. data/app/views/mailer/shipment_notification_to_buyer.text.erb +34 -0
  126. data/config/initializers/001_settings_application.rb +10 -0
  127. data/config/initializers/002_load_core_extensions.rb +8 -0
  128. data/config/initializers/field_with_error.rb +2 -0
  129. data/config/initializers/strip_and_nullify.rb +13 -0
  130. data/config/initializers/time_formats.rb +1 -0
  131. data/config/locales/en.yml +61 -0
  132. data/config/routes.rb +56 -0
  133. data/db/development.sqlite3 +0 -0
  134. data/db/migrate/20111022144421_create_product_groups.rb +12 -0
  135. data/db/migrate/20111022144426_create_products.rb +16 -0
  136. data/db/migrate/20111022144653_create_orders.rb +21 -0
  137. data/db/migrate/20111022144725_create_line_items.rb +15 -0
  138. data/db/migrate/20111022234951_create_shops.rb +20 -0
  139. data/db/migrate/20111026193227_create_link_groups.rb +12 -0
  140. data/db/migrate/20111026193435_create_navigations.rb +10 -0
  141. data/db/migrate/20111031135810_create_links.rb +10 -0
  142. data/db/migrate/20111106193938_create_custom_fields.rb +10 -0
  143. data/db/migrate/20111106195112_create_custom_field_answers.rb +14 -0
  144. data/db/migrate/20111106201548_create_product_group_conditions.rb +12 -0
  145. data/db/migrate/20111107035350_create_creditcard_transactions.rb +15 -0
  146. data/db/migrate/20111109190754_create_addresses.rb +24 -0
  147. data/db/migrate/20111125173344_create_pictures.rb +16 -0
  148. data/db/migrate/20111201024408_create_shipping_methods.rb +16 -0
  149. data/db/migrate/20111202143154_create_shipping_zones.rb +17 -0
  150. data/db/migrate/20111203034020_create_payment_methods.rb +14 -0
  151. data/db/migrate/20111221190000_create_preferences.rb +14 -0
  152. data/db/migrate/20120105234047_create_shipments.rb +11 -0
  153. data/db/migrate/20120105234553_create_shipment_carriers.rb +11 -0
  154. data/db/migrate/20120606165355_create_delayed_jobs.rb +22 -0
  155. data/db/production.sqlite3 +0 -0
  156. data/db/schema.rb +265 -0
  157. data/db/seeds.rb +1 -0
  158. data/db/test.sqlite3 +0 -0
  159. data/lib/assets/javascripts/loading_state_for_buttons.js.coffee +3 -0
  160. data/lib/assets/javascripts/show_help_on_hover.js.coffee +2 -0
  161. data/lib/assets/javascripts/utils/autoresize.js.coffee +3 -0
  162. data/lib/assets/javascripts/utils/focus.js.coffee +3 -0
  163. data/lib/assets/javascripts/utils/formatNumber.js.coffee +25 -0
  164. data/lib/assets/javascripts/utils/formatPrice.js.coffee +24 -0
  165. data/lib/generators/nimbleshop/app/app_generator.rb +84 -0
  166. data/lib/generators/nimbleshop/app/templates/config/application.yml +61 -0
  167. data/lib/generators/nimbleshop/app/templates/config/initializers/airbrake.rb +3 -0
  168. data/lib/generators/nimbleshop/app/templates/config/initializers/cache_images.rb +4 -0
  169. data/lib/generators/nimbleshop/app/templates/config/initializers/carrierwave.rb +36 -0
  170. data/lib/generators/nimbleshop/app/templates/config/initializers/delayed_job.rb +15 -0
  171. data/lib/generators/nimbleshop/app/templates/config/initializers/setup_email.rb +24 -0
  172. data/lib/nimbleshop/core_ext/activerecord_base.rb +18 -0
  173. data/lib/nimbleshop/core_ext/filelessio.rb +4 -0
  174. data/lib/nimbleshop/core_ext/force_ssl.rb +26 -0
  175. data/lib/nimbleshop/core_ext/mustache_templater_handler.rb +10 -0
  176. data/lib/nimbleshop/engine.rb +23 -0
  177. data/lib/nimbleshop/permalink/builder.rb +46 -0
  178. data/lib/nimbleshop/processor/base.rb +51 -0
  179. data/lib/nimbleshop/processor.rb +3 -0
  180. data/lib/nimbleshop/product_group_search/base_field.rb +19 -0
  181. data/lib/nimbleshop/product_group_search/core_field_strategy.rb +31 -0
  182. data/lib/nimbleshop/product_group_search/custom_field_strategy.rb +39 -0
  183. data/lib/nimbleshop/product_group_search/date_field.rb +16 -0
  184. data/lib/nimbleshop/product_group_search/extension.rb +46 -0
  185. data/lib/nimbleshop/product_group_search/number_field.rb +17 -0
  186. data/lib/nimbleshop/product_group_search/text_field.rb +33 -0
  187. data/lib/nimbleshop/product_group_search.rb +74 -0
  188. data/lib/nimbleshop/sampledata/data.rb +246 -0
  189. data/lib/nimbleshop/sampledata/pictures/product1/pic1.jpg +0 -0
  190. data/lib/nimbleshop/sampledata/pictures/product2/pic1.jpg +0 -0
  191. data/lib/nimbleshop/sampledata/pictures/product2/pic2.jpg +0 -0
  192. data/lib/nimbleshop/sampledata/pictures/product3/pic1.jpg +0 -0
  193. data/lib/nimbleshop/sampledata/pictures/product3/pic2.jpg +0 -0
  194. data/lib/nimbleshop/sampledata/pictures/product3/pic3.jpg +0 -0
  195. data/lib/nimbleshop/sampledata/pictures/product3/pic4.jpg +0 -0
  196. data/lib/nimbleshop/sampledata/pictures/product3/pic5.jpg +0 -0
  197. data/lib/nimbleshop/sampledata/pictures/product4/pic1.jpg +0 -0
  198. data/lib/nimbleshop/sampledata/pictures/product4/pic2.jpg +0 -0
  199. data/lib/nimbleshop/sampledata/pictures/product5/pic1.jpg +0 -0
  200. data/lib/nimbleshop/sampledata/pictures/product5/pic2.jpg +0 -0
  201. data/lib/nimbleshop/sampledata/pictures/product6/pic1.jpg +0 -0
  202. data/lib/nimbleshop/sampledata/pictures/product6/pic10.jpg +0 -0
  203. data/lib/nimbleshop/sampledata/pictures/product6/pic11.jpg +0 -0
  204. data/lib/nimbleshop/sampledata/pictures/product6/pic12.jpg +0 -0
  205. data/lib/nimbleshop/sampledata/pictures/product6/pic13.jpg +0 -0
  206. data/lib/nimbleshop/sampledata/pictures/product6/pic14.jpg +0 -0
  207. data/lib/nimbleshop/sampledata/pictures/product6/pic15.jpg +0 -0
  208. data/lib/nimbleshop/sampledata/pictures/product6/pic16.jpg +0 -0
  209. data/lib/nimbleshop/sampledata/pictures/product6/pic17.jpg +0 -0
  210. data/lib/nimbleshop/sampledata/pictures/product6/pic2.jpg +0 -0
  211. data/lib/nimbleshop/sampledata/pictures/product6/pic3.jpg +0 -0
  212. data/lib/nimbleshop/sampledata/pictures/product6/pic4.jpg +0 -0
  213. data/lib/nimbleshop/sampledata/pictures/product6/pic5.jpg +0 -0
  214. data/lib/nimbleshop/sampledata/pictures/product6/pic6.jpg +0 -0
  215. data/lib/nimbleshop/sampledata/pictures/product6/pic7.jpg +0 -0
  216. data/lib/nimbleshop/sampledata/pictures/product6/pic8.jpg +0 -0
  217. data/lib/nimbleshop/sampledata/pictures/product6/pic9.jpg +0 -0
  218. data/lib/nimbleshop/sampledata/pictures/product7/pic1.jpg +0 -0
  219. data/lib/nimbleshop/sampledata/pictures/product7/pic2.jpg +0 -0
  220. data/lib/nimbleshop/sampledata/pictures/product7/pic3.jpg +0 -0
  221. data/lib/nimbleshop/sampledata/pictures/product8/pic1.jpg +0 -0
  222. data/lib/nimbleshop/sampledata/pictures/product8/pic2.jpg +0 -0
  223. data/lib/nimbleshop/sampledata/pictures/product8/pic3.jpg +0 -0
  224. data/lib/nimbleshop/sampledata/pictures/product8/pic4.jpg +0 -0
  225. data/lib/nimbleshop/sampledata/pictures/product8/pic5.jpg +0 -0
  226. data/lib/nimbleshop/sampledata/pictures/product8/pic6.jpg +0 -0
  227. data/lib/nimbleshop/sampledata/pictures/product8/pic7.jpg +0 -0
  228. data/lib/nimbleshop/sampledata/pictures/product8/pic8.jpg +0 -0
  229. data/lib/nimbleshop/sampledata/pictures/product9/pic1.jpg +0 -0
  230. data/lib/nimbleshop/sampledata/pictures/product9/pic2.jpg +0 -0
  231. data/lib/nimbleshop/util.rb +60 -0
  232. data/lib/nimbleshop/version.rb +18 -0
  233. data/lib/nimbleshop_core.rb +23 -0
  234. data/lib/tasks/localhost2public.rake +8 -0
  235. data/lib/tasks/setup.rake +26 -0
  236. data/test/factories/address_factory.rb +31 -0
  237. data/test/factories/creditcard_factory.rb +30 -0
  238. data/test/factories/custom_field_answer_factory.rb +6 -0
  239. data/test/factories/custom_field_factory.rb +21 -0
  240. data/test/factories/line_item_factory.rb +7 -0
  241. data/test/factories/link_factory.rb +6 -0
  242. data/test/factories/link_group_factory.rb +5 -0
  243. data/test/factories/navigation_factory.rb +6 -0
  244. data/test/factories/order_factory.rb +49 -0
  245. data/test/factories/payment_method_factory.rb +6 -0
  246. data/test/factories/payment_transaction_factory.rb +42 -0
  247. data/test/factories/picture_factory.rb +11 -0
  248. data/test/factories/product_group_condition_factory.rb +40 -0
  249. data/test/factories/product_group_factory.rb +5 -0
  250. data/test/factories/products_factory.rb +11 -0
  251. data/test/factories/shipment_carrier_factory.rb +6 -0
  252. data/test/factories/shipment_factory.rb +6 -0
  253. data/test/factories/shipping_method_factory.rb +15 -0
  254. data/test/factories/shipping_zone_factory.rb +5 -0
  255. data/test/factories/shop_factory.rb +8 -0
  256. data/test/fixtures/files/avatar.png +0 -0
  257. data/test/fixtures/link_groups.yml +13 -0
  258. data/test/fixtures/payment_methods.yml +39 -0
  259. data/test/fixtures/shops.yml +15 -0
  260. data/test/helpers/admin_helper_test.rb +37 -0
  261. data/test/helpers/nimbleshop_helper_test.rb +17 -0
  262. data/test/integration/admin/link_groups_acceptance_test.rb +39 -0
  263. data/test/integration/admin/orders_acceptance_test.rb +63 -0
  264. data/test/integration/admin/payment_methods_acceptance_test.rb +13 -0
  265. data/test/integration/admin/product_groups_acceptance_test.rb +89 -0
  266. data/test/integration/admin/products_acceptance_test.rb +105 -0
  267. data/test/integration/admin/shipping_methods_acceptance_test.rb +63 -0
  268. data/test/integration/admin/shipping_zones_acceptance_test.rb +16 -0
  269. data/test/integration/admin/shops_acceptance_test.rb +44 -0
  270. data/test/integration/checkout/cart_acceptance_test.rb +113 -0
  271. data/test/integration/checkout/payment_confirmation_acceptance_test.rb +24 -0
  272. data/test/integration/checkout/paypal_acceptance_test.rb +34 -0
  273. data/test/integration/checkout/shipping_address_acceptance_test.rb +91 -0
  274. data/test/integration/checkout/shipping_method_acceptance_test.rb +51 -0
  275. data/test/integration/homepage_acceptance_test.rb +24 -0
  276. data/test/integration/products_acceptance_test.rb +12 -0
  277. data/test/integration/static_pages_acceptance_test.rb +13 -0
  278. data/test/mailers/mailer_test.rb +25 -0
  279. data/test/rails_app/Gemfile +27 -0
  280. data/test/rails_app/Gemfile.lock +218 -0
  281. data/test/rails_app/Rakefile +10 -0
  282. data/test/rails_app/app/controllers/application_controller.rb +6 -0
  283. data/test/rails_app/app/helpers/application_helper.rb +3 -0
  284. data/test/rails_app/app/views/layouts/application.html.erb +10 -0
  285. data/test/rails_app/config/application.rb +25 -0
  286. data/test/rails_app/config/application.yml +61 -0
  287. data/test/rails_app/config/boot.rb +5 -0
  288. data/test/rails_app/config/database.yml +18 -0
  289. data/test/rails_app/config/environment.rb +5 -0
  290. data/test/rails_app/config/environments/development.rb +18 -0
  291. data/test/rails_app/config/environments/production.rb +33 -0
  292. data/test/rails_app/config/environments/test.rb +33 -0
  293. data/test/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  294. data/test/rails_app/config/initializers/inflections.rb +2 -0
  295. data/test/rails_app/config/initializers/secret_token.rb +2 -0
  296. data/test/rails_app/config/routes.rb +10 -0
  297. data/test/rails_app/config.ru +4 -0
  298. data/test/rails_app/db/development.sqlite3 +0 -0
  299. data/test/rails_app/db/migrate/20100401102949_create_tables.rb +74 -0
  300. data/test/rails_app/db/schema.rb +52 -0
  301. data/test/rails_app/log/development.log +94 -0
  302. data/test/rails_app/log/test.log +0 -0
  303. data/test/rails_app/public/404.html +26 -0
  304. data/test/rails_app/public/422.html +26 -0
  305. data/test/rails_app/public/500.html +26 -0
  306. data/test/rails_app/public/favicon.ico +0 -0
  307. data/test/rails_app/script/rails +10 -0
  308. data/test/support/address_test_helper.rb +24 -0
  309. data/test/support/checkout_test_helper.rb +40 -0
  310. data/test/support/dbify_sql_helper.rb +12 -0
  311. data/test/support/images/cookware.jpg +0 -0
  312. data/test/support/must_be_like.rb +24 -0
  313. data/test/support/shipping_method_test_helper.rb +5 -0
  314. data/test/support/wait_for_ajax.rb +4 -0
  315. data/test/test_helper.rb +65 -0
  316. data/test/unit/address_test.rb +33 -0
  317. data/test/unit/country_shipping_zone_test.rb +17 -0
  318. data/test/unit/creditcard_test.rb +33 -0
  319. data/test/unit/custom_field_answer/field_test.rb +93 -0
  320. data/test/unit/order_test.rb +70 -0
  321. data/test/unit/payment_method/authorizedotnet_test.rb +21 -0
  322. data/test/unit/payment_method/paypalwp_test.rb +17 -0
  323. data/test/unit/payment_method/splitable_test.rb +18 -0
  324. data/test/unit/picture_test.rb +24 -0
  325. data/test/unit/processor/authorize_net_test.rb +236 -0
  326. data/test/unit/processor/paypal_test.rb +40 -0
  327. data/test/unit/processor/splitable_test.rb +123 -0
  328. data/test/unit/product_group_condition_test.rb +188 -0
  329. data/test/unit/product_group_test.rb +109 -0
  330. data/test/unit/product_test.rb +60 -0
  331. data/test/unit/shipping_cost_calculator_test.rb +19 -0
  332. data/test/unit/shipping_method_test.rb +197 -0
  333. data/test/unit/shop_test.rb +11 -0
  334. data/test/unit/tax_calculator_test.rb +13 -0
  335. data/test/vcr_cassettes/authorize_net/authorize-failure.yml +38 -0
  336. data/test/vcr_cassettes/authorize_net/authorize-success.yml +38 -0
  337. data/test/vcr_cassettes/authorize_net/capture-failure.yml +38 -0
  338. data/test/vcr_cassettes/authorize_net/capture-success.yml +38 -0
  339. data/test/vcr_cassettes/authorize_net/purchase-failure.yml +38 -0
  340. data/test/vcr_cassettes/authorize_net/purchase-success.yml +38 -0
  341. data/test/vcr_cassettes/authorize_net/refund-failure.yml +38 -0
  342. data/test/vcr_cassettes/authorize_net/refund-success.yml +38 -0
  343. data/test/vcr_cassettes/authorize_net/void-authorize.yml +38 -0
  344. data/test/vcr_cassettes/authorize_net/void-failure.yml +38 -0
  345. data/test/vcr_cassettes/authorize_net/void-success.yml +38 -0
  346. data/test/vcr_cassettes/splitable/split-create-failure.yml +48 -0
  347. data/test/vcr_cassettes/splitable/split-create-success.yml +50 -0
  348. data/test/vcr_cassettes/splitable/split-draft-create-failure.yml +50 -0
  349. data/test/vcr_cassettes/splitable/split-draft-create-success.yml +50 -0
  350. data/vendor/assets/javascripts/accounting.js +406 -0
  351. data/vendor/assets/javascripts/autoresize.js +275 -0
  352. data/vendor/assets/javascripts/jquery-1.7.1.js +9267 -0
  353. data/vendor/assets/javascripts/jquery-form.js +980 -0
  354. data/vendor/assets/javascripts/jquery-json.js +193 -0
  355. data/vendor/assets/javascripts/jquery-ui-1.8.16.js +11768 -0
  356. data/vendor/assets/javascripts/jquery-ujs.js +374 -0
  357. data/vendor/assets/javascripts/mustache.js +436 -0
  358. data/vendor/assets/javascripts/nested_form.js +51 -0
  359. metadata +740 -0
data/README.md ADDED
@@ -0,0 +1,13 @@
1
+ # nimbleshop_core extension
2
+
3
+ This is core extension for [nimbleShop](http://nimbleShop.org) and is
4
+ responsible for providing the core e-commerce functionality to
5
+ nimbleShop.
6
+
7
+ # Documentation
8
+
9
+ Documentation is available at [http://nimbleshop.org/](http://nimbleShop.org) .
10
+
11
+ # License
12
+
13
+ nimbleshop_core uses [MIT license](http://www.opensource.org/licenses/mit-license.php) .
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ # encoding: UTF-8
2
+ require 'bundler/gem_tasks'
3
+ require 'rake/testtask'
4
+ require 'rdoc/task'
5
+
6
+ desc 'Default: run tests'
7
+ task :default => :test
8
+
9
+ desc 'Run nimbleshop_core tests.'
10
+ Rake::TestTask.new(:test) do |t|
11
+ t.libs << 'lib'
12
+ t.libs << 'test'
13
+ t.pattern = 'test/**/*_test.rb'
14
+ t.verbose = true
15
+ end
@@ -0,0 +1,19 @@
1
+ $ ->
2
+
3
+ # work around the nested form ugliness
4
+ $("form input:file").parents('.fields').hide()
5
+
6
+ # deleting a picture
7
+ $(".product_pictures .actions .delete").on "click", ->
8
+ $("#delete_picture_" + $(this).attr("data-action-id")).trigger "click"
9
+ $(this).parent().parent().hide "fast"
10
+ false
11
+
12
+ # making picutures sortable
13
+ $(".product_pictures").sortable(update: (e, ui) ->
14
+ orders = {}
15
+ $(".product_pictures li").each (index, el) ->
16
+ orders[index] = $(el).attr("data-id")
17
+
18
+ $("#product_pictures_order").attr "value", $.toJSON(orders)
19
+ ).disableSelection()
@@ -0,0 +1,6 @@
1
+ # this fuction handles anytime shipping cost is changed for a state.
2
+ # Also when shipment is enabled or disabled for a state.
3
+ $ ->
4
+ $(".update-shipping").live "ajax:success", (t, result) ->
5
+ $(t.target).parents("tr").replaceWith result.html
6
+
@@ -0,0 +1,25 @@
1
+ // bootstrap-collapse file is needed so that twitter bootstrap can collapse top navigation and make it work on iphone
2
+
3
+ //= require jquery-1.7.1
4
+ //= require jquery-ui-1.8.16
5
+ //= require jquery-ujs
6
+ //= require jquery-json
7
+ //= require mustache
8
+ //= require nested_form
9
+ //= require jquery-form
10
+ //= require autoresize
11
+ //= require twitter/bootstrap
12
+
13
+ //= require utils/focus
14
+ //= require utils/formatNumber
15
+ //= require utils/formatPrice
16
+ //= require loading_state_for_buttons
17
+
18
+ //= require payment_method
19
+ //= require product-group-condition
20
+ //= require shipit
21
+ //= require admin/shipping_methods/edit
22
+ //= require admin/products/edit
23
+ //= require fadeout_success
24
+ //= require autoresize
25
+ //= require show_help_on_hover
@@ -0,0 +1,2 @@
1
+ $ ->
2
+ $(".alert-success").delay(2000).fadeOut 1000
@@ -0,0 +1,19 @@
1
+ $ ->
2
+
3
+ # Handle cancel on payment form
4
+ $(".nimbleshop-payment-method-form .cancel").click ->
5
+ $this = $(this)
6
+ div = $this.closest(".nimbleshop-payment-method-form-well")
7
+ div.hide() if div.length
8
+ false
9
+
10
+ # edit a payment form
11
+ $(".nimbleshop-payment-method-edit").click ->
12
+ $this = $(this)
13
+ well = $this.parent("div").find(".nimbleshop-payment-method-form-well")
14
+ if well.length
15
+ if well.is(":visible")
16
+ well.hide()
17
+ else
18
+ well.show()
19
+ false
@@ -0,0 +1,33 @@
1
+ $ ->
2
+ data = $("#product-group-condition-klass").data()
3
+ $(".condition .field").live "change", (evt) ->
4
+ $target = $(evt.target).siblings("input.value").val("").end()
5
+ $select = $target.siblings("select.operator").html("")
6
+ fieldType = $.grep(data.fields, (element) ->
7
+ ("" + element.id) is $target.val()
8
+ )[0].field_type
9
+ $.each data.operators[fieldType], (i, element) ->
10
+ $select.append $("<option />",
11
+ value: element.value
12
+ text: element.name
13
+ )
14
+
15
+ false
16
+
17
+ $(".add-condition").live "click", (evt) ->
18
+ index = +$(".condition:last").data().index
19
+ params = $.extend(
20
+ index: index + 1
21
+ , data)
22
+ $(".condition:last").after Mustache.to_html($("#product_template").html(), params)
23
+ false
24
+
25
+ $(".remove-condition").live "click", (evt) ->
26
+ $condition = $(evt.target).parents(".condition")
27
+ $.each $condition.find(":input:not(:hidden)"), (i, element) ->
28
+ $(element).remove()
29
+
30
+ $condition.find(".remove-condition").remove()
31
+ $condition.find(".destroy-flag").val "1"
32
+ false
33
+
@@ -0,0 +1,5 @@
1
+ # nested_form generated the link to delete the pictures. However picture deletion
2
+ # is handled separately. So here the deletion link is made to hide.
3
+
4
+ $ ->
5
+ #$('.edit_product .fields').hide()
@@ -0,0 +1,10 @@
1
+ $ ->
2
+ $("a.ship-items-link").click ->
3
+ $(this).hide()
4
+ $("#ship_items_action_box").show()
5
+ false
6
+
7
+
8
+ $("#ship_items_cancel").live "click", ->
9
+ $("a.ship-items-link").show()
10
+ $("#ship_items_action_box").hide()
@@ -0,0 +1,4 @@
1
+ $ ->
2
+ $("a[rel=popover]").popover()
3
+ $(".tooltip").tooltip()
4
+ $("a[rel=tooltip]").tooltip()
@@ -0,0 +1,9 @@
1
+ /*
2
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
3
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
5
+ *
6
+ *= require_self
7
+ *= require admin_bootstrap_and_overrides
8
+ *= require admin_custom
9
+ */
@@ -0,0 +1,38 @@
1
+ @import "twitter/bootstrap/bootstrap";
2
+ body {
3
+ padding-top: 60px;
4
+ padding-left: 20px;
5
+ }
6
+
7
+ @import "twitter/bootstrap/responsive";
8
+
9
+ // Set the correct sprite paths
10
+ @iconSpritePath: asset-path('twitter/bootstrap/glyphicons-halflings.png');
11
+ @iconWhiteSpritePath: asset-path('twitter/bootstrap/glyphicons-halflings-white.png');
12
+
13
+ // Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines)
14
+ // Note: If you use asset_path() here, your compiled boostrap_and_overrides.css will not
15
+ // have the proper paths. So for now we use the absolute path.
16
+ @fontAwesomeEotPath: '/assets/fontawesome-webfont.eot';
17
+ @fontAwesomeWoffPath: '/assets/fontawesome-webfont.woff';
18
+ @fontAwesomeTtfPath: '/assets/fontawesome-webfont.ttf';
19
+ @fontAwesomeSvgPath: '/assets/fontawesome-webfont.svg';
20
+
21
+ // Font Awesome
22
+ @import "fontawesome";
23
+
24
+ // Your custom LESS stylesheets goes here
25
+ //
26
+ // Since bootstrap was imported above you have access to its mixins which
27
+ // you may use and inherit here
28
+ //
29
+ // If you'd like to override bootstrap's own variables, you can do so here as well
30
+ // See http://twitter.github.com/bootstrap/less.html for their names and documentation
31
+ //
32
+ // Example:
33
+ // @linkColor: #ff0000;
34
+ @navbarBackground: #369bd7;
35
+ @navbarBackgroundHighlight: #2f7dac;
36
+ @navbarLinkColor: #fff;
37
+
38
+ @btnPrimaryBackgroundHighlight: #369BD7;
@@ -0,0 +1,104 @@
1
+ .ns-page-title {
2
+ float:left;
3
+ }
4
+
5
+ .new-action {
6
+ float: right;
7
+ }
8
+
9
+ .clear {
10
+ clear: both;
11
+ }
12
+
13
+ .payment-method-engine-well {
14
+ border: 1px solid #999;
15
+ background-color: #eee;
16
+ padding: 10px;
17
+ }
18
+
19
+ .payment-method-engine-well h2 {
20
+ float:left;
21
+ }
22
+ .payment-method-engine-well img {
23
+ float:right;
24
+ width: 200px;
25
+ }
26
+
27
+ .payment-method-engine-well .edit_link {
28
+ float: left;
29
+ margin-top: 10px;
30
+ margin-left: 10px;
31
+ }
32
+
33
+ .payment-method-engine-well .edit_link .nimbleshop-payment-method-edit {
34
+ margin-left: 0;
35
+ margin-right: 0;
36
+ }
37
+
38
+ .nimbleshop-payment-method-edit {
39
+ float:left;
40
+ margin-left:10px;
41
+ margin-right:10px;
42
+ }
43
+
44
+ .nimbleshop-payment-method-delete {
45
+ float:left;
46
+ margin-left:6px;
47
+ margin-right:10px;
48
+ }
49
+
50
+ .navbar .nav > li > a.go-to-shop {
51
+ color: #fff;
52
+ font-weight: bold;
53
+ }
54
+
55
+ .navbar .nav > li > a.go-to-shop:hover {
56
+ text-decoration:underline;
57
+ }
58
+
59
+
60
+ #product-group-edit-form .condition {
61
+ margin: 9px 0;
62
+ }
63
+
64
+ .link_group_name,
65
+ .link_group_edit{
66
+ float: left;
67
+ }
68
+
69
+ .link_group_edit{
70
+ margin-left: 10px;
71
+ margin-top: 6px;
72
+ }
73
+
74
+ .control-group a {
75
+ line-height: 26px;
76
+ float: left;
77
+ text-decoration: none;
78
+ color: #000;
79
+ padding: 0 1px;
80
+ }
81
+
82
+ .control-group a:before{
83
+ content: '\0000a0';
84
+ }
85
+
86
+ footer .content {
87
+ color: gray;
88
+ float: right;
89
+ }
90
+ footer .content a {
91
+ color: gray;
92
+ }
93
+
94
+ .remove_nested_fields {
95
+ margin-right: 5px;
96
+ }
97
+
98
+ .handle-pictures-umbrella {
99
+ margin-left: 155px;
100
+ }
101
+
102
+ .handle-pictures-umbrella .pictures-list {
103
+ margin-left: -155px;
104
+ }
@@ -0,0 +1,56 @@
1
+ class Admin::CustomFieldsController < AdminController
2
+
3
+ before_filter :load_custom_field, only: [:show, :edit, :update, :destroy]
4
+
5
+ respond_to :html
6
+
7
+ def index
8
+ @custom_fields = CustomField.all
9
+ respond_with @custom_fields
10
+ end
11
+
12
+ def edit
13
+ respond_with @custom_field
14
+ end
15
+
16
+ def update
17
+ if @custom_field.update_attributes(params[:custom_field])
18
+ redirect_to admin_custom_fields_path, notice: t(:successfully_updated)
19
+ else
20
+ respond_with @custom_field
21
+ end
22
+ end
23
+
24
+ def new
25
+ @custom_field = CustomField.new
26
+ respond_with @custom_field
27
+ end
28
+
29
+ def create
30
+ @custom_field = CustomField.new(params[:custom_field])
31
+ if @custom_field.save
32
+ redirect_to admin_custom_fields_url, notice: t(:successfully_added)
33
+ else
34
+ respond_with @custom_field
35
+ end
36
+ end
37
+
38
+ def destroy
39
+ respond_to do |format|
40
+ format.html do
41
+ if @custom_field.destroy
42
+ redirect_to admin_custom_fields_path, notice: t(:successfully_deleted)
43
+ else
44
+ redirect_to admin_custom_fields_path, error: t(:could_not_delete)
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+ private
51
+
52
+ def load_custom_field
53
+ @custom_field = CustomField.find(params[:id])
54
+ end
55
+
56
+ end
@@ -0,0 +1,76 @@
1
+ class Admin::LinkGroupsController < AdminController
2
+
3
+ before_filter :load_link_group, only: [:show, :destroy, :edit, :update ]
4
+ before_filter :load_link_groups, only: [:index, :create, :edit, :update ]
5
+
6
+ respond_to :html, :js
7
+
8
+ def index
9
+ respond_with @link_groups
10
+ end
11
+
12
+ def new
13
+ @link_group = LinkGroup.new
14
+ respond_with @link_group
15
+ end
16
+
17
+ def edit
18
+ respond_with @link_group
19
+ end
20
+
21
+ def create
22
+ respond_to do |format|
23
+ format.html do
24
+
25
+ @link_group = LinkGroup.new(post_params[:link_group])
26
+
27
+ if @link_group.save
28
+ redirect_to admin_link_groups_url, notice: t(:successfully_added)
29
+ else
30
+ render action: 'new'
31
+ end
32
+
33
+ end
34
+ end
35
+ end
36
+
37
+ def update
38
+ respond_to do |format|
39
+ format.html do
40
+
41
+ if @link_group.update_attributes(post_params[:link_group])
42
+ redirect_to admin_link_groups_path, notice: t(:successfully_updated)
43
+ else
44
+ rener action: 'edit'
45
+ end
46
+
47
+ end
48
+ end
49
+ end
50
+
51
+ def destroy
52
+ respond_to do |format|
53
+ format.html do
54
+
55
+ @link_group.destroy
56
+ redirect_to admin_link_groups_url, notice: t(:successfully_deleted)
57
+
58
+ end
59
+ end
60
+ end
61
+
62
+ private
63
+
64
+ def post_params
65
+ params.permit(link_group: [:name])
66
+ end
67
+
68
+ def load_link_groups
69
+ @link_groups = LinkGroup.order('id desc')
70
+ end
71
+
72
+ def load_link_group
73
+ @link_group = LinkGroup.find_by_permalink!(params[:id])
74
+ end
75
+
76
+ end
@@ -0,0 +1,9 @@
1
+ class Admin::MainController < AdminController
2
+
3
+ skip_before_filter :set_shop, only: :reset
4
+
5
+ def index
6
+ render
7
+ end
8
+
9
+ end
@@ -0,0 +1,49 @@
1
+ #
2
+ # This controller is used to add and delete a link from a link group.
3
+ #
4
+ class Admin::NavigationsController < AdminController
5
+
6
+ before_filter :load_link_group
7
+
8
+ respond_to :html
9
+
10
+ def new
11
+ @navigation = @link_group.navigations.new
12
+ respond_with @navigation
13
+ end
14
+
15
+ def create
16
+ respond_to do |format|
17
+ format.html do
18
+
19
+ @navigation = @link_group.navigations.build(params[:navigation])
20
+
21
+ if @navigation.save
22
+ redirect_to [:admin, :link_groups], notice: t(:successfully_added)
23
+ else
24
+ render :new, error: 'new link could not be added'
25
+ end
26
+
27
+ end
28
+ end
29
+ end
30
+
31
+ def destroy
32
+ respond_to do |format|
33
+ format.html do
34
+
35
+ @navigation = @link_group.navigations.find_by_id!(params[:id])
36
+ @navigation.destroy
37
+ redirect_to [:admin, :link_groups], notice: t(:successfully_deleted)
38
+
39
+ end
40
+ end
41
+ end
42
+
43
+ private
44
+
45
+ def load_link_group
46
+ @link_group = LinkGroup.find_by_permalink!(params[:link_group_id])
47
+ end
48
+
49
+ end
@@ -0,0 +1,47 @@
1
+ class Admin::OrdersController < AdminController
2
+
3
+ respond_to :html
4
+
5
+ def capture_payment
6
+ respond_to do |format|
7
+ format.html do
8
+
9
+ @order = Order.find_by_number!(params[:id])
10
+ @order.kapture!
11
+ redirect_to admin_order_path(@order), notice: "Amount was successfully captured"
12
+
13
+ end
14
+ end
15
+ end
16
+
17
+ def purchase_payment
18
+ respond_to do |format|
19
+ format.html do
20
+
21
+ @order = Order.find_by_number!(params[:id])
22
+ @order.purchase!
23
+ redirect_to admin_order_path(@order), notice: "Amount was successfully paid"
24
+
25
+ end
26
+ end
27
+ end
28
+
29
+ def index
30
+ @orders = Order.order('id desc')
31
+ respond_with @orders
32
+ end
33
+
34
+ def show
35
+ @order = Order.find_by_number!(params[:id])
36
+
37
+ if @order.shipments.any?
38
+ @shipment = @order.shipments.first
39
+ else
40
+ @shipment = @order.shipments.build
41
+ @shipment.notify_customer = 1
42
+ end
43
+
44
+ respond_with @order
45
+ end
46
+
47
+ end
@@ -0,0 +1,26 @@
1
+ class Admin::PaymentMethodsController < AdminController
2
+
3
+ before_filter :load_payment_methods
4
+
5
+ layout 'payment_method'
6
+
7
+ def index
8
+ respond_to do |format|
9
+ format.html do
10
+
11
+ if PaymentMethod.count == 0
12
+ flash.now[:error] = 'You have not setup any payment method. User wil not be able to make payment'
13
+ end
14
+ render layout: 'payment_method'
15
+
16
+ end
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ def load_payment_methods
23
+ @payment_methods = PaymentMethod.order('id asc')
24
+ end
25
+
26
+ end