forgeos_commerce 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (433) hide show
  1. data/COPYING +339 -0
  2. data/COPYING.LESSER +165 -0
  3. data/Gemfile +2 -0
  4. data/LICENSE +2 -0
  5. data/MIT-LICENSE +20 -0
  6. data/README.textile +27 -0
  7. data/app/assets/images/forgeos/admin/favicon.gif +0 -0
  8. data/app/assets/images/forgeos/jstree/themes/association_product/bubble-quantity-products.png +0 -0
  9. data/app/assets/images/forgeos/jstree/themes/association_product/check-checked.png +0 -0
  10. data/app/assets/images/forgeos/jstree/themes/association_product/check-unchecked.png +0 -0
  11. data/app/assets/images/forgeos/jstree/themes/association_product/context.gif +0 -0
  12. data/app/assets/images/forgeos/jstree/themes/association_product/create.png +0 -0
  13. data/app/assets/images/forgeos/jstree/themes/association_product/dark-blue-minus.png +0 -0
  14. data/app/assets/images/forgeos/jstree/themes/association_product/dark-blue-plus.png +0 -0
  15. data/app/assets/images/forgeos/jstree/themes/association_product/dot.gif +0 -0
  16. data/app/assets/images/forgeos/jstree/themes/association_product/f.png +0 -0
  17. data/app/assets/images/forgeos/jstree/themes/association_product/fminus.gif +0 -0
  18. data/app/assets/images/forgeos/jstree/themes/association_product/fminus_rtl.gif +0 -0
  19. data/app/assets/images/forgeos/jstree/themes/association_product/folder.png +0 -0
  20. data/app/assets/images/forgeos/jstree/themes/association_product/fplus.gif +0 -0
  21. data/app/assets/images/forgeos/jstree/themes/association_product/fplus_rtl.gif +0 -0
  22. data/app/assets/images/forgeos/jstree/themes/association_product/lastli.gif +0 -0
  23. data/app/assets/images/forgeos/jstree/themes/association_product/lastli_rtl.gif +0 -0
  24. data/app/assets/images/forgeos/jstree/themes/association_product/li.gif +0 -0
  25. data/app/assets/images/forgeos/jstree/themes/association_product/remove.png +0 -0
  26. data/app/assets/images/forgeos/jstree/themes/association_product/rename.png +0 -0
  27. data/app/assets/images/forgeos/jstree/themes/association_product/throbber.gif +0 -0
  28. data/app/assets/images/forgeos/jstree/themes/product-types/bubble-quantity-products.png +0 -0
  29. data/app/assets/images/forgeos/jstree/themes/product-types/check-checked.png +0 -0
  30. data/app/assets/images/forgeos/jstree/themes/product-types/check-unchecked.png +0 -0
  31. data/app/assets/images/forgeos/jstree/themes/product-types/context.gif +0 -0
  32. data/app/assets/images/forgeos/jstree/themes/product-types/create.png +0 -0
  33. data/app/assets/images/forgeos/jstree/themes/product-types/dark-blue-minus.png +0 -0
  34. data/app/assets/images/forgeos/jstree/themes/product-types/dark-blue-plus.png +0 -0
  35. data/app/assets/images/forgeos/jstree/themes/product-types/dot.gif +0 -0
  36. data/app/assets/images/forgeos/jstree/themes/product-types/drag-drop.png +0 -0
  37. data/app/assets/images/forgeos/jstree/themes/product-types/f.png +0 -0
  38. data/app/assets/images/forgeos/jstree/themes/product-types/fminus.gif +0 -0
  39. data/app/assets/images/forgeos/jstree/themes/product-types/fminus_rtl.gif +0 -0
  40. data/app/assets/images/forgeos/jstree/themes/product-types/folder.png +0 -0
  41. data/app/assets/images/forgeos/jstree/themes/product-types/fplus.gif +0 -0
  42. data/app/assets/images/forgeos/jstree/themes/product-types/fplus_rtl.gif +0 -0
  43. data/app/assets/images/forgeos/jstree/themes/product-types/grey-drag-drop.png +0 -0
  44. data/app/assets/images/forgeos/jstree/themes/product-types/lastli.gif +0 -0
  45. data/app/assets/images/forgeos/jstree/themes/product-types/lastli_rtl.gif +0 -0
  46. data/app/assets/images/forgeos/jstree/themes/product-types/li.gif +0 -0
  47. data/app/assets/images/forgeos/jstree/themes/product-types/remove.png +0 -0
  48. data/app/assets/images/forgeos/jstree/themes/product-types/rename.png +0 -0
  49. data/app/assets/images/forgeos/jstree/themes/product-types/throbber.gif +0 -0
  50. data/app/assets/images/forgeos/jstree/themes/product_category/brown-minus.png +0 -0
  51. data/app/assets/images/forgeos/jstree/themes/product_category/brown-plus.png +0 -0
  52. data/app/assets/images/forgeos/jstree/themes/product_category/bubble-quantity-products.png +0 -0
  53. data/app/assets/images/forgeos/jstree/themes/product_category/context.gif +0 -0
  54. data/app/assets/images/forgeos/jstree/themes/product_category/create.png +0 -0
  55. data/app/assets/images/forgeos/jstree/themes/product_category/dot.gif +0 -0
  56. data/app/assets/images/forgeos/jstree/themes/product_category/f.png +0 -0
  57. data/app/assets/images/forgeos/jstree/themes/product_category/fminus.gif +0 -0
  58. data/app/assets/images/forgeos/jstree/themes/product_category/fminus_rtl.gif +0 -0
  59. data/app/assets/images/forgeos/jstree/themes/product_category/fplus.gif +0 -0
  60. data/app/assets/images/forgeos/jstree/themes/product_category/fplus_rtl.gif +0 -0
  61. data/app/assets/images/forgeos/jstree/themes/product_category/lastli.gif +0 -0
  62. data/app/assets/images/forgeos/jstree/themes/product_category/lastli_rtl.gif +0 -0
  63. data/app/assets/images/forgeos/jstree/themes/product_category/li.gif +0 -0
  64. data/app/assets/images/forgeos/jstree/themes/product_category/remove.png +0 -0
  65. data/app/assets/images/forgeos/jstree/themes/product_category/rename.png +0 -0
  66. data/app/assets/images/forgeos/jstree/themes/product_category/throbber.gif +0 -0
  67. data/app/assets/images/forgeos/jstree/themes/zone-tree/bubble-quantity-products.png +0 -0
  68. data/app/assets/images/forgeos/jstree/themes/zone-tree/check-checked.png +0 -0
  69. data/app/assets/images/forgeos/jstree/themes/zone-tree/check-unchecked.png +0 -0
  70. data/app/assets/images/forgeos/jstree/themes/zone-tree/context.gif +0 -0
  71. data/app/assets/images/forgeos/jstree/themes/zone-tree/create.png +0 -0
  72. data/app/assets/images/forgeos/jstree/themes/zone-tree/dark-blue-minus.png +0 -0
  73. data/app/assets/images/forgeos/jstree/themes/zone-tree/dark-blue-plus.png +0 -0
  74. data/app/assets/images/forgeos/jstree/themes/zone-tree/dot.gif +0 -0
  75. data/app/assets/images/forgeos/jstree/themes/zone-tree/f.png +0 -0
  76. data/app/assets/images/forgeos/jstree/themes/zone-tree/fminus.gif +0 -0
  77. data/app/assets/images/forgeos/jstree/themes/zone-tree/fminus_rtl.gif +0 -0
  78. data/app/assets/images/forgeos/jstree/themes/zone-tree/folder.png +0 -0
  79. data/app/assets/images/forgeos/jstree/themes/zone-tree/fplus.gif +0 -0
  80. data/app/assets/images/forgeos/jstree/themes/zone-tree/fplus_rtl.gif +0 -0
  81. data/app/assets/images/forgeos/jstree/themes/zone-tree/lastli.gif +0 -0
  82. data/app/assets/images/forgeos/jstree/themes/zone-tree/lastli_rtl.gif +0 -0
  83. data/app/assets/images/forgeos/jstree/themes/zone-tree/li.gif +0 -0
  84. data/app/assets/images/forgeos/jstree/themes/zone-tree/remove.png +0 -0
  85. data/app/assets/images/forgeos/jstree/themes/zone-tree/rename.png +0 -0
  86. data/app/assets/images/forgeos/jstree/themes/zone-tree/throbber.gif +0 -0
  87. data/app/assets/javascripts/forgeos/admin/functions.js +3 -0
  88. data/app/assets/javascripts/forgeos/admin/functions/forgeos_commerce/all.js +1 -0
  89. data/app/assets/javascripts/forgeos/admin/functions/forgeos_commerce/attributes.js +18 -0
  90. data/app/assets/javascripts/forgeos/admin/functions/forgeos_commerce/cross-sellings.js +18 -0
  91. data/app/assets/javascripts/forgeos/admin/functions/forgeos_commerce/orders.js +88 -0
  92. data/app/assets/javascripts/forgeos/admin/functions/forgeos_commerce/products.js +46 -0
  93. data/app/assets/javascripts/forgeos/admin/functions/forgeos_commerce/rules.js +98 -0
  94. data/app/assets/javascripts/forgeos/admin/functions/forgeos_commerce/transporters.js +60 -0
  95. data/app/assets/javascripts/forgeos/admin/functions/forgeos_commerce/trees.js +35 -0
  96. data/app/assets/javascripts/forgeos/admin/functions/forgeos_commerce/uploads.js +10 -0
  97. data/app/assets/javascripts/forgeos/admin/inits.js +3 -0
  98. data/app/assets/javascripts/forgeos/admin/inits/forgeos_commerce/all.js +1 -0
  99. data/app/assets/javascripts/forgeos/admin/inits/forgeos_commerce/clicks.js +25 -0
  100. data/app/assets/javascripts/forgeos/admin/inits/forgeos_commerce/cross-sellings.js +69 -0
  101. data/app/assets/javascripts/forgeos/admin/inits/forgeos_commerce/customer.js +64 -0
  102. data/app/assets/javascripts/forgeos/admin/inits/forgeos_commerce/orders.js +83 -0
  103. data/app/assets/javascripts/forgeos/admin/inits/forgeos_commerce/overlays.js +45 -0
  104. data/app/assets/javascripts/forgeos/admin/inits/forgeos_commerce/products.js +103 -0
  105. data/app/assets/javascripts/forgeos/admin/inits/forgeos_commerce/settings.js +15 -0
  106. data/app/assets/javascripts/forgeos/admin/inits/forgeos_commerce/special-offers.js +23 -0
  107. data/app/assets/javascripts/forgeos/admin/inits/forgeos_commerce/trees.js +71 -0
  108. data/app/assets/stylesheets/forgeos/admin/base.css.sass +3 -0
  109. data/app/assets/stylesheets/forgeos/admin/forgeos_commerce/_all.css.sass +9 -0
  110. data/app/assets/stylesheets/forgeos/admin/forgeos_commerce/_attributes.css.sass +59 -0
  111. data/app/assets/stylesheets/forgeos/admin/forgeos_commerce/_customer.css.sass +84 -0
  112. data/app/assets/stylesheets/forgeos/admin/forgeos_commerce/_delivery.css.sass +81 -0
  113. data/app/assets/stylesheets/forgeos/admin/forgeos_commerce/_dropdowns.css.sass +171 -0
  114. data/app/assets/stylesheets/forgeos/admin/forgeos_commerce/_order.css.sass +208 -0
  115. data/app/assets/stylesheets/forgeos/admin/forgeos_commerce/_payment.css.sass +34 -0
  116. data/app/assets/stylesheets/forgeos/admin/forgeos_commerce/_products.css.sass +341 -0
  117. data/app/assets/stylesheets/forgeos/admin/forgeos_commerce/_special_offers.css.sass +198 -0
  118. data/app/assets/stylesheets/forgeos/admin/forgeos_commerce/_transporters.css.sass +5 -0
  119. data/app/assets/stylesheets/forgeos/jstree/themes/association_product/style.css.sass +50 -0
  120. data/app/assets/stylesheets/forgeos/jstree/themes/product-types/style.css.sass +129 -0
  121. data/app/assets/stylesheets/forgeos/jstree/themes/product_category/style.css.sass +109 -0
  122. data/app/assets/stylesheets/forgeos/jstree/themes/zone-tree/style.css.sass +103 -0
  123. data/app/controllers/addresses_controller.rb +51 -0
  124. data/app/controllers/admin/attributes_controller.rb +161 -0
  125. data/app/controllers/admin/base_controller.rb +5 -0
  126. data/app/controllers/admin/brands_controller.rb +119 -0
  127. data/app/controllers/admin/forms_controller.rb +66 -0
  128. data/app/controllers/admin/geo_zones_controller.rb +74 -0
  129. data/app/controllers/admin/import_controller.rb +50 -0
  130. data/app/controllers/admin/orders_controller.rb +248 -0
  131. data/app/controllers/admin/product_types_controller.rb +122 -0
  132. data/app/controllers/admin/products_controller.rb +204 -0
  133. data/app/controllers/admin/special_offers_controller.rb +236 -0
  134. data/app/controllers/admin/statistics_controller.rb +64 -0
  135. data/app/controllers/admin/transporter_rules_controller.rb +307 -0
  136. data/app/controllers/admin/users_controller.rb +100 -0
  137. data/app/controllers/admin/vouchers_controller.rb +207 -0
  138. data/app/controllers/application_controller.rb +75 -0
  139. data/app/controllers/order_controller.rb +229 -0
  140. data/app/helpers/admin/payment_fields_helper.rb +31 -0
  141. data/app/helpers/application_helper.rb +7 -0
  142. data/app/helpers/cart_helper.rb +40 -0
  143. data/app/helpers/category_helper.rb +36 -0
  144. data/app/helpers/product_helper.rb +118 -0
  145. data/app/helpers/routes_helper.rb +60 -0
  146. data/app/helpers/wishlist_helper.rb +142 -0
  147. data/app/models/address_delivery.rb +2 -0
  148. data/app/models/address_invoice.rb +2 -0
  149. data/app/models/attribute.rb +38 -0
  150. data/app/models/attribute_category.rb +3 -0
  151. data/app/models/attribute_value.rb +10 -0
  152. data/app/models/brand.rb +22 -0
  153. data/app/models/brand_category.rb +3 -0
  154. data/app/models/cart.rb +190 -0
  155. data/app/models/cart_item.rb +21 -0
  156. data/app/models/checkbox_attribute.rb +2 -0
  157. data/app/models/country.rb +4 -0
  158. data/app/models/cross_sellings_product.rb +4 -0
  159. data/app/models/currencies_exchanges_rate.rb +2 -0
  160. data/app/models/currency.rb +13 -0
  161. data/app/models/date_attribute.rb +2 -0
  162. data/app/models/dynamic_attribute.rb +6 -0
  163. data/app/models/dynamic_attribute_value.rb +5 -0
  164. data/app/models/form.rb +7 -0
  165. data/app/models/form_attribute.rb +3 -0
  166. data/app/models/geo_zone.rb +6 -0
  167. data/app/models/longtext_attribute.rb +2 -0
  168. data/app/models/number_attribute.rb +2 -0
  169. data/app/models/order.rb +483 -0
  170. data/app/models/order_detail.rb +129 -0
  171. data/app/models/order_shipping.rb +25 -0
  172. data/app/models/pack.rb +9 -0
  173. data/app/models/picklist_attribute.rb +2 -0
  174. data/app/models/product.rb +294 -0
  175. data/app/models/product_attribute.rb +4 -0
  176. data/app/models/product_category.rb +9 -0
  177. data/app/models/product_link.rb +9 -0
  178. data/app/models/product_price_variation.rb +3 -0
  179. data/app/models/product_sold_counter.rb +2 -0
  180. data/app/models/product_sweeper.rb +30 -0
  181. data/app/models/product_type.rb +27 -0
  182. data/app/models/product_type_category.rb +3 -0
  183. data/app/models/product_viewed_counter.rb +2 -0
  184. data/app/models/products_wishlist.rb +25 -0
  185. data/app/models/radio_attribute.rb +2 -0
  186. data/app/models/radiobutton_attribute.rb +2 -0
  187. data/app/models/setting.rb +46 -0
  188. data/app/models/size.rb +5 -0
  189. data/app/models/special_offer_category.rb +3 -0
  190. data/app/models/special_offer_rule.rb +21 -0
  191. data/app/models/text_attribute.rb +2 -0
  192. data/app/models/text_field_attribute.rb +2 -0
  193. data/app/models/transporter_category.rb +3 -0
  194. data/app/models/transporter_rule.rb +3 -0
  195. data/app/models/url_attribute.rb +2 -0
  196. data/app/models/user.rb +45 -0
  197. data/app/models/user_address.rb +6 -0
  198. data/app/models/voucher_category.rb +3 -0
  199. data/app/models/voucher_rule.rb +3 -0
  200. data/app/models/wishlist.rb +134 -0
  201. data/app/views/admin/addresses/_form.html.haml +42 -0
  202. data/app/views/admin/attributes/_categories.html.haml +7 -0
  203. data/app/views/admin/attributes/_choice.html.haml +24 -0
  204. data/app/views/admin/attributes/_date.html.haml +5 -0
  205. data/app/views/admin/attributes/_form.html.haml +36 -0
  206. data/app/views/admin/attributes/_longtext.html.haml +5 -0
  207. data/app/views/admin/attributes/_number.html.haml +5 -0
  208. data/app/views/admin/attributes/_tabs.html.haml +6 -0
  209. data/app/views/admin/attributes/_text.html.haml +5 -0
  210. data/app/views/admin/attributes/_url.html.haml +5 -0
  211. data/app/views/admin/attributes/destroy.js.erb +1 -0
  212. data/app/views/admin/attributes/edit.html.haml +2 -0
  213. data/app/views/admin/attributes/index.html.haml +33 -0
  214. data/app/views/admin/attributes/index.json.erb +24 -0
  215. data/app/views/admin/attributes/new.html.haml +2 -0
  216. data/app/views/admin/attributes/show.html.haml +51 -0
  217. data/app/views/admin/brands/_form.html.haml +29 -0
  218. data/app/views/admin/brands/_tabs.html.haml +6 -0
  219. data/app/views/admin/brands/destroy.js.erb +1 -0
  220. data/app/views/admin/brands/edit.html.haml +2 -0
  221. data/app/views/admin/brands/index.html.haml +15 -0
  222. data/app/views/admin/brands/index.json.erb +23 -0
  223. data/app/views/admin/brands/new.html.haml +2 -0
  224. data/app/views/admin/dashboard/index.html.haml +230 -0
  225. data/app/views/admin/forms/_form.html.haml +38 -0
  226. data/app/views/admin/forms/_tabs.html.haml +6 -0
  227. data/app/views/admin/forms/destroy.js.erb +1 -0
  228. data/app/views/admin/forms/edit.html.haml +2 -0
  229. data/app/views/admin/forms/index.html.haml +11 -0
  230. data/app/views/admin/forms/index.json.erb +20 -0
  231. data/app/views/admin/forms/new.html.haml +2 -0
  232. data/app/views/admin/geo_zones/_form.html.haml +20 -0
  233. data/app/views/admin/geo_zones/_list.html.haml +9 -0
  234. data/app/views/admin/geo_zones/edit.html.haml +3 -0
  235. data/app/views/admin/geo_zones/index.html.haml +49 -0
  236. data/app/views/admin/geo_zones/new.html.haml +3 -0
  237. data/app/views/admin/geo_zones/show.html.haml +4 -0
  238. data/app/views/admin/import/create_product.html.haml +2 -0
  239. data/app/views/admin/menus/_types_popups.html.haml +22 -0
  240. data/app/views/admin/orders/_address_form.html.haml +29 -0
  241. data/app/views/admin/orders/_form.html.haml +198 -0
  242. data/app/views/admin/orders/_list.html.haml +29 -0
  243. data/app/views/admin/orders/_products_popup.html.haml +15 -0
  244. data/app/views/admin/orders/create.html.haml +1 -0
  245. data/app/views/admin/orders/destroy.js.erb +1 -0
  246. data/app/views/admin/orders/edit.html.haml +1 -0
  247. data/app/views/admin/orders/index.html.haml +24 -0
  248. data/app/views/admin/orders/index.json.erb +48 -0
  249. data/app/views/admin/orders/show.html.haml +130 -0
  250. data/app/views/admin/product_types/_form.html.haml +46 -0
  251. data/app/views/admin/product_types/_list.html.haml +6 -0
  252. data/app/views/admin/product_types/_options_categories.html.haml +19 -0
  253. data/app/views/admin/product_types/_tabs.html.haml +6 -0
  254. data/app/views/admin/product_types/destroy.js.erb +1 -0
  255. data/app/views/admin/product_types/edit.html.haml +3 -0
  256. data/app/views/admin/product_types/index.html.haml +14 -0
  257. data/app/views/admin/product_types/index.json.erb +24 -0
  258. data/app/views/admin/product_types/new.html.haml +3 -0
  259. data/app/views/admin/product_types/show.html.haml +23 -0
  260. data/app/views/admin/products/_attributes.html.haml +37 -0
  261. data/app/views/admin/products/_cross_popup.html.haml +56 -0
  262. data/app/views/admin/products/_cross_sell_tr.html.haml +13 -0
  263. data/app/views/admin/products/_cross_sells.html.haml +1 -0
  264. data/app/views/admin/products/_form.html.haml +26 -0
  265. data/app/views/admin/products/_general.html.haml +153 -0
  266. data/app/views/admin/products/_list.html.haml +18 -0
  267. data/app/views/admin/products/_prices.html.haml +17 -0
  268. data/app/views/admin/products/_products_popup.html.haml +41 -0
  269. data/app/views/admin/products/_seo.html.haml +75 -0
  270. data/app/views/admin/products/_shippings.html.haml +0 -0
  271. data/app/views/admin/products/_sizes.html.haml +23 -0
  272. data/app/views/admin/products/_tabs.html.haml +2 -0
  273. data/app/views/admin/products/activate.js.erb +1 -0
  274. data/app/views/admin/products/destroy.js.erb +1 -0
  275. data/app/views/admin/products/edit.html.haml +1 -0
  276. data/app/views/admin/products/index.html.haml +20 -0
  277. data/app/views/admin/products/index.json.erb +65 -0
  278. data/app/views/admin/products/new.html.haml +1 -0
  279. data/app/views/admin/products/show.html.haml +158 -0
  280. data/app/views/admin/settings/_colissimo.html.haml +7 -0
  281. data/app/views/admin/settings/_godfather.html.haml +11 -0
  282. data/app/views/admin/settings/_google_shopping.html.haml +5 -0
  283. data/app/views/admin/settings/_payment.html.haml +63 -0
  284. data/app/views/admin/settings/_tabs.html.haml +5 -0
  285. data/app/views/admin/settings/edit.html.haml +33 -0
  286. data/app/views/admin/special_offers/_form.html.haml +88 -0
  287. data/app/views/admin/special_offers/_patterns.html.haml +151 -0
  288. data/app/views/admin/special_offers/_tabs.html.haml +5 -0
  289. data/app/views/admin/special_offers/_top_links.html.haml +6 -0
  290. data/app/views/admin/special_offers/activate.js.erb +1 -0
  291. data/app/views/admin/special_offers/destroy.js.erb +1 -0
  292. data/app/views/admin/special_offers/edit.html.haml +4 -0
  293. data/app/views/admin/special_offers/index.html.haml +15 -0
  294. data/app/views/admin/special_offers/index.json.erb +28 -0
  295. data/app/views/admin/special_offers/new.html.haml +2 -0
  296. data/app/views/admin/special_offers/show.html.haml +28 -0
  297. data/app/views/admin/special_offers/special_offer.html.haml +166 -0
  298. data/app/views/admin/statistics/index.html.haml +158 -0
  299. data/app/views/admin/transporter_rules/_delivery_rules.html.haml +83 -0
  300. data/app/views/admin/transporter_rules/_form.html.haml +90 -0
  301. data/app/views/admin/transporter_rules/_left_sidebar.html.haml +9 -0
  302. data/app/views/admin/transporter_rules/_sidebar.html.haml +10 -0
  303. data/app/views/admin/transporter_rules/_tabs.html.haml +8 -0
  304. data/app/views/admin/transporter_rules/activate.js.erb +1 -0
  305. data/app/views/admin/transporter_rules/destroy.js.erb +1 -0
  306. data/app/views/admin/transporter_rules/edit.html.haml +1 -0
  307. data/app/views/admin/transporter_rules/index.html.haml +13 -0
  308. data/app/views/admin/transporter_rules/index.json.erb +30 -0
  309. data/app/views/admin/transporter_rules/new.html.haml +1 -0
  310. data/app/views/admin/transporter_rules/show.html.haml +30 -0
  311. data/app/views/admin/users/_fields_for_addresses_deliveries.html.haml +38 -0
  312. data/app/views/admin/users/_fields_for_addresses_invoices.html.haml +34 -0
  313. data/app/views/admin/users/_form.html.haml +88 -0
  314. data/app/views/admin/users/edit.json.erb +35 -0
  315. data/app/views/admin/users/index.html.haml +12 -0
  316. data/app/views/admin/users/index.json.erb +32 -0
  317. data/app/views/admin/users/index2.html.haml +33 -0
  318. data/app/views/admin/users/show.html.haml +72 -0
  319. data/app/views/admin/vouchers/_form.html.haml +92 -0
  320. data/app/views/admin/vouchers/_tabs.html.haml +3 -0
  321. data/app/views/admin/vouchers/activate.js.erb +1 -0
  322. data/app/views/admin/vouchers/destroy.js.erb +1 -0
  323. data/app/views/admin/vouchers/index.html.haml +15 -0
  324. data/app/views/admin/vouchers/index.json.erb +28 -0
  325. data/app/views/admin/vouchers/new.html.haml +2 -0
  326. data/config/locales/activerecord/en.yml +6 -0
  327. data/config/locales/activerecord/fr.yml +18 -0
  328. data/config/locales/admin/address/en.yml +3 -0
  329. data/config/locales/admin/address/fr.yml +3 -0
  330. data/config/locales/admin/attribute/en.yml +76 -0
  331. data/config/locales/admin/attribute/fr.yml +75 -0
  332. data/config/locales/admin/brands/en.yml +24 -0
  333. data/config/locales/admin/brands/fr.yml +27 -0
  334. data/config/locales/admin/dashboard/en.yml +6 -0
  335. data/config/locales/admin/dashboard/fr.yml +6 -0
  336. data/config/locales/admin/order/en.yml +54 -0
  337. data/config/locales/admin/order/fr.yml +54 -0
  338. data/config/locales/admin/product/en.yml +105 -0
  339. data/config/locales/admin/product/fr.yml +106 -0
  340. data/config/locales/admin/settings/en.yml +90 -0
  341. data/config/locales/admin/settings/fr.yml +87 -0
  342. data/config/locales/admin/special_offer/en.yml +59 -0
  343. data/config/locales/admin/special_offer/fr.yml +60 -0
  344. data/config/locales/admin/transporter/en.yml +36 -0
  345. data/config/locales/admin/transporter/fr.yml +36 -0
  346. data/config/locales/admin/voucher/en.yml +3 -0
  347. data/config/locales/admin/voucher/fr.yml +3 -0
  348. data/config/locales/admin/wishlist/en.yml +89 -0
  349. data/config/locales/admin/wishlist/fr.yml +89 -0
  350. data/config/locales/common/en.yml +424 -0
  351. data/config/locales/common/fr.yml +422 -0
  352. data/config/routes.rb +109 -0
  353. data/config/search.example.yml +8 -0
  354. data/db/fixtures/currencies.yml +10 -0
  355. data/db/fixtures/currencies_exchanges_rates.yml +9 -0
  356. data/db/fixtures/page_translations.yml +11 -0
  357. data/db/fixtures/pages.yml +5 -0
  358. data/db/fixtures/people.yml +11 -0
  359. data/db/fixtures/product_type_translations.yml +11 -0
  360. data/db/fixtures/product_types.yml +2 -0
  361. data/db/migrate/20091009134433_create_attribute_values.rb +15 -0
  362. data/db/migrate/20091009134440_create_attribute_values_products.rb +14 -0
  363. data/db/migrate/20091009134448_create_attributes.rb +17 -0
  364. data/db/migrate/20091009134455_create_attributes_product_types.rb +14 -0
  365. data/db/migrate/20091009134525_create_carts.rb +15 -0
  366. data/db/migrate/20091009134532_create_cart_items.rb +14 -0
  367. data/db/migrate/20091009134609_create_cross_sellings_products.rb +11 -0
  368. data/db/migrate/20091009134616_create_currencies.rb +15 -0
  369. data/db/migrate/20091009134624_create_currencies_exchanges_rates.rb +13 -0
  370. data/db/migrate/20091009134631_create_dynamic_attribute_values.rb +17 -0
  371. data/db/migrate/20091009134659_create_order_details.rb +24 -0
  372. data/db/migrate/20091009134706_create_order_shippings.rb +16 -0
  373. data/db/migrate/20091009134714_create_orders.rb +21 -0
  374. data/db/migrate/20091009134721_create_packs_products.rb +13 -0
  375. data/db/migrate/20091009134805_create_product_types.rb +11 -0
  376. data/db/migrate/20091009134813_create_products.rb +37 -0
  377. data/db/migrate/20091009134821_create_products_wishlists.rb +13 -0
  378. data/db/migrate/20091009134947_create_wishlists.rb +12 -0
  379. data/db/migrate/20100323143123_create_geo_zones_transporter_rules.rb +12 -0
  380. data/db/migrate/20100414090950_create_brands.rb +15 -0
  381. data/db/migrate/20100414091706_create_sizes.rb +15 -0
  382. data/db/migrate/20100928123009_add_patronage_to_people.rb +20 -0
  383. data/db/migrate/20101007074306_create_product_price_variations.rb +13 -0
  384. data/db/migrate/20110311111210_create_forms.rb +13 -0
  385. data/db/migrate/20110311112646_attributes_forms.rb +13 -0
  386. data/db/migrate/20110322165950_add_payment_methods_to_settings.rb +13 -0
  387. data/db/migrate/20110405084454_add_colissimo_methods_to_settings.rb +13 -0
  388. data/db/migrate/20110516075553_add_google_infos_to_settings.rb +11 -0
  389. data/db/migrate/20110831164213_add_order_fields_to_addresses.rb +9 -0
  390. data/lib/CMCIC_Config.rb +16 -0
  391. data/lib/CMCIC_Tpe.rb +227 -0
  392. data/lib/forgeos/commerce.rb +9 -0
  393. data/lib/forgeos/commerce/admin_menu.rb +28 -0
  394. data/lib/forgeos/commerce/engine.rb +11 -0
  395. data/lib/forgeos/commerce/float.rb +10 -0
  396. data/lib/forgeos/commerce/statistics.rb +62 -0
  397. data/lib/forgeos/commerce/version.rb +5 -0
  398. data/lib/forgeos_commerce.rb +1 -0
  399. data/lib/special_offer.rb +61 -0
  400. data/lib/tasks/install.rake +9 -0
  401. data/lib/transporter.rb +26 -0
  402. data/lib/voucher.rb +41 -0
  403. data/recipes/deploy.rb +15 -0
  404. data/test/dummy/Rakefile +7 -0
  405. data/test/dummy/app/assets/javascripts/application.js +9 -0
  406. data/test/dummy/app/assets/stylesheets/application.css +7 -0
  407. data/test/dummy/app/controllers/application_controller.rb +3 -0
  408. data/test/dummy/app/helpers/application_helper.rb +2 -0
  409. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  410. data/test/dummy/config.ru +4 -0
  411. data/test/dummy/config/application.rb +42 -0
  412. data/test/dummy/config/boot.rb +10 -0
  413. data/test/dummy/config/database.yml +25 -0
  414. data/test/dummy/config/environment.rb +5 -0
  415. data/test/dummy/config/environments/development.rb +27 -0
  416. data/test/dummy/config/environments/production.rb +51 -0
  417. data/test/dummy/config/environments/test.rb +39 -0
  418. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  419. data/test/dummy/config/initializers/inflections.rb +10 -0
  420. data/test/dummy/config/initializers/mime_types.rb +5 -0
  421. data/test/dummy/config/initializers/secret_token.rb +7 -0
  422. data/test/dummy/config/initializers/session_store.rb +8 -0
  423. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  424. data/test/dummy/config/locales/en.yml +5 -0
  425. data/test/dummy/config/routes.rb +58 -0
  426. data/test/dummy/public/404.html +26 -0
  427. data/test/dummy/public/422.html +26 -0
  428. data/test/dummy/public/500.html +26 -0
  429. data/test/dummy/public/favicon.ico +0 -0
  430. data/test/dummy/script/rails +6 -0
  431. data/test/forgeos_commerce_test.rb +7 -0
  432. data/test/test_helper.rb +10 -0
  433. metadata +539 -0
@@ -0,0 +1,60 @@
1
+ check_remove_icon_status('delivery-rule');
2
+ odd_even = 1;
3
+
4
+ function add_delivery_rule(name) {
5
+ var delivery_rule = jQuery('.' + name + '.pattern');
6
+ delivery_rules = jQuery('#delivery-rules');
7
+
8
+ new_rule = '<div id="item_'+ false_id +' " class="delivery-rule '+ (odd_even%2 == 0 ? '' : 'even') +'">';
9
+ new_rule += delivery_rule.html().replace(/undefined_id/g, false_id);
10
+ new_rule += '</div>';
11
+
12
+ delivery_rules.append(new_rule);
13
+ check_remove_icon_status('delivery-rule');
14
+
15
+ false_id--;
16
+ odd_even++;
17
+ }
18
+
19
+ function remove_delivery_rule(element){
20
+ rule_id = get_rails_element_id(jQuery(element).parent());
21
+
22
+ if (rule_id > 0) {
23
+ _delete = '<input type="hidden" id="shipping_methods_to_delete_" name="shipping_methods_to_delete[]" value="'+ rule_id +'" />'
24
+ jQuery('#delivery-rules').append(_delete);
25
+ }
26
+
27
+ jQuery(element).parent().remove();
28
+ check_remove_icon_status('delivery-rule');
29
+ }
30
+
31
+
32
+ function change_rule_for(element){
33
+
34
+ delivery_type = element.options[element.selectedIndex].value;
35
+ delivery_rules = jQuery('#delivery-rules');
36
+
37
+ delivery_rules.html('');
38
+
39
+ rule = '<div id="item_0" class="delivery-rule">'
40
+ rule += jQuery('.delivery-rule.'+ delivery_type +'.pattern').html().replace(/undefined_id/g, 0);
41
+ rule += '</div>';
42
+
43
+ delivery_rules.append(rule);
44
+
45
+ check_remove_icon_status('delivery-rule');
46
+ false_id = -1;
47
+ odd_even = 1;
48
+
49
+ }
50
+
51
+ function check_remove_icon_status(name){
52
+ var c = jQuery('#' + name + 's .' + name);
53
+ var icon = c.find('a.red-minus:first');
54
+
55
+ if (c.size() == 1) {
56
+ jQuery(icon).hide();
57
+ } else {
58
+ jQuery(icon).show();
59
+ }
60
+ }
@@ -0,0 +1,35 @@
1
+ function init_transporter_tree(selector, type, source) {
2
+ jQuery(selector).bind('loaded.jstree', function(e, data){
3
+ jQuery(e.target).removeClass('tree-default').find('a').each(function(index,selector){
4
+ var category_id = get_rails_element_id(jQuery(selector).parent('li'));
5
+ jQuery(selector).droppable({
6
+ hoverClass: 'ui-state-hover',
7
+ drop:function(ev, ui){
8
+ jQuery.ajax({
9
+ data: {
10
+ "element_id": get_rails_element_id(jQuery(ui.draggable)),
11
+ "authenticity_token": encodeURIComponent(window._forgeos_js_vars.token)
12
+ },
13
+ success:function(request){jQuery.tree.focused().refresh();},
14
+ type:'post',
15
+ url:'/admin/geo_zones/' + category_id + '/add_element'
16
+ });
17
+ }
18
+ });
19
+ });
20
+ }).jstree({
21
+ "json_data":{
22
+ "ajax": {
23
+ "url": source
24
+ },
25
+ "progressive_render": true
26
+ },
27
+ "themes": {
28
+ "theme": 'categories'
29
+ },
30
+ "ui": {
31
+ "selected_parent_close": false
32
+ },
33
+ "plugins": ['themes', 'json_data', 'ui']
34
+ });
35
+ }
@@ -0,0 +1,10 @@
1
+ function add_picture_to_product(data){
2
+ var object_name = jQuery('form#wrap').data('object_name');
3
+ jQuery('#product-images ul.sortable li.clear').before('<li><a href="#" onclick="jQuery(this).parents(\'li\').remove(); check_product_first_image(); return false;" class="big-icons trash"></a><a href="/admin/pictures/' + data.id + '/edit" onclick ="window.open(this.href); return false;" class="big-icons edit" href="#"></a><input type="hidden" name="' + object_name + '[attachment_ids][]" value="' + data.id + '"/><img src="' + data.path + '" alt="' + data.name + '"/><div class="handler"><div class="inner"></div></div></li>');
4
+ check_product_first_image();
5
+ }
6
+
7
+ function add_attachment_to_product(data){
8
+ var object_name = jQuery('form#wrap').data('object_name');
9
+ jQuery('#product-files').append('<div class="block-container"><input type="hidden" name="' + object_name + '[attachment_ids][]" value="' + data.id + '" /><span class="block-type"><span class="handler"><span class="inner">&nbsp;</span></span>' + data.type + '</span><span class="block-name">' + data.name + '<span class="file-size"> - ' + data.size + '</span></span><a href="/admin/' + data.type.toLowerCase() + 's/' + data.id + '/edit" onclick ="window.open(this.href); return false;" class="small-icons edit-link"></a><a href="#" class="big-icons gray-destroy"></a></div>');
10
+ }
@@ -0,0 +1,3 @@
1
+ //= require forgeos/admin/inits/forgeos_core/all
2
+ //= require forgeos/admin/inits/forgeos_cms/all
3
+ //= require forgeos/admin/inits/forgeos_commerce/all
@@ -0,0 +1,25 @@
1
+ jQuery(document).ready(function(){
2
+ /*
3
+ *Add click function on .gray-destroy items
4
+ *Those items are links to remove their parents (i.e. blocks)
5
+ **/
6
+ jQuery('.red-delete-icon').live('click', function(e){
7
+ e.preventDefault();
8
+ var block = jQuery(this).parents(':first');
9
+ if (parseInt(get_rails_element_id(block.find('input:first'))) < 0) {
10
+ block.remove();
11
+ } else {
12
+ block.hide();
13
+ block.find('.delete').val(1);
14
+ }
15
+ return false;
16
+ });
17
+
18
+ jQuery('.gray-destroy-tattribute').live('click', function(e){
19
+ e.preventDefault();
20
+ jQuery(this).parents('li').remove();
21
+ return false;
22
+ });
23
+
24
+ jQuery('.add-link.choice,.block-container .green-add-icon').live('click', add_item_on_add_click);
25
+ });
@@ -0,0 +1,69 @@
1
+ jQuery(document).ready(function(){
2
+ jQuery('#cross-productSelectDialog').dialog({
3
+ autoOpen:false,
4
+ modal:true,
5
+ minHeight: 300,
6
+ width: 1080,
7
+ resizable:'se',
8
+ buttons: {
9
+ Ok: function(){
10
+ add_cross_to_product();
11
+ jQuery('#cross-productSelectDialog').dialog('close');
12
+ }
13
+ },
14
+ open: function(e,ui){
15
+ eval(jQuery('#table-products-cross').data('dataTables_init_function')+'()');
16
+ }
17
+ });
18
+
19
+ jQuery('#cross-product.look').click(function(e){
20
+ e.preventDefault();
21
+ jQuery('#cross-productSelectDialog').dialog('open');
22
+ return false;
23
+ });
24
+
25
+ jQuery('.delete_product_tr').live('click',function(e){
26
+ e.preventDefault();
27
+ jQuery(this).parents('tr').remove();
28
+ });
29
+
30
+ jQuery('#cross_tree').bind('select_node.jstree', function(e, data) {
31
+ var NODE = data.rslt.obj;
32
+ var cat_id = get_rails_element_id(NODE);
33
+ var current_table = jQuery('#table').dataTableInstance();
34
+ var url = current_table.fnSettings().sAjaxSource;
35
+ var url_base = url.split('?')[0];
36
+ var params;
37
+ var link = jQuery(NODE).find('a:first');
38
+
39
+ // update category id
40
+
41
+ params = get_json_params_from_url(url);
42
+
43
+ if (jQuery(link).hasClass('brand')){
44
+ params.type = 'brand';
45
+ ptype_id = jQuery(NODE).parents('ul').prev().attr('id');
46
+ params.ptype_id = ptype_id;
47
+ }else{
48
+ params.type = 'p_type';
49
+ }
50
+
51
+ params.category_id = jQuery(link).attr('id');
52
+ params = stringify_params_from_json(params);
53
+
54
+ // construct url and redraw table
55
+ update_current_dataTable_source('#table-products','/admin/products.json?' + params);
56
+
57
+ var object_name = jQuery(NODE).attr('id').split('_')[0];
58
+ var category_id = get_rails_element_id(NODE);
59
+ return true;
60
+ }).jstree({
61
+ "themes": {
62
+ "theme": 'categories',
63
+ },
64
+ "ui": {
65
+ "selected_parent_close": false
66
+ },
67
+ "plugins": ['themes', 'html_data', 'ui']
68
+ });
69
+ });
@@ -0,0 +1,64 @@
1
+ jQuery(document).ready(function(){
2
+ jQuery("input[name='same_as_delivery']:checked").live('click', function() {
3
+ if(jQuery(this).val() == 'true') {
4
+
5
+ var val_designation = jQuery('#user_address_deliveries_attributes_0_designation').val();
6
+ var val_name = jQuery('#user_address_deliveries_attributes_0_lastname').val();
7
+ var val_firstname = jQuery('#user_address_deliveries_attributes_0_firstname').val();
8
+ var val_address = jQuery('#user_address_deliveries_attributes_0_address').val();
9
+ var val_address_2 = jQuery('#user_address_deliveries_attributes_0_address_2').val();
10
+ var val_zip_code = jQuery('#user_address_deliveries_attributes_0_zip_code').val();
11
+ var val_city = jQuery('#user_address_deliveries_attributes_0_city').val();
12
+ var val_civility = jQuery('#user_address_deliveries_attributes_0_civility').val();
13
+ var val_country_id = jQuery('#user_address_deliveries_attributes_0_country_id').val();
14
+
15
+ jQuery('.invoice-address').hide('normal');
16
+ jQuery('#user_address_invoices_attributes_0_designation').val(val_designation);
17
+ jQuery('#user_address_invoices_attributes_0_lastname').val(val_name);
18
+ jQuery('#user_address_invoices_attributes_0_firstname').val(val_firstname);
19
+ jQuery('#user_address_invoices_attributes_0_address').val(val_address);
20
+ jQuery('#user_address_invoices_attributes_0_address_2').val(val_address_2);
21
+ jQuery('#user_address_invoices_attributes_0_zip_code').val(val_zip_code);
22
+ jQuery('#user_address_invoices_attributes_0_city').val(val_city);
23
+
24
+ // Custom Selects
25
+ jQuery('#user_address_invoices_attributes_0_civility').val(val_civility);
26
+ var civility_customer_select = jQuery('#user_address_deliveries_attributes_0_civility').siblings('.dropdown').find('.dropdown_toggle').html();
27
+ jQuery('#user_address_invoices_attributes_0_civility').siblings('.dropdown').find('.dropdown_toggle').html(civility_customer_select);
28
+
29
+ jQuery('#user_address_invoices_attributes_0_country_id').val(val_country_id);
30
+ var country_id_custom_select = jQuery('#user_address_deliveries_attributes_0_country_id').siblings('.dropdown').find('.dropdown_toggle').html();
31
+ jQuery('#user_address_invoices_attributes_0_country_id').siblings('.dropdown').find('.dropdown_toggle').html(country_id_custom_select);
32
+
33
+ } else {
34
+ jQuery('.invoice-address').show('normal');
35
+ }
36
+ });
37
+ jQuery('#same_people_infos').live('click', function() {
38
+ if(jQuery(this).is(':checked')) {
39
+ jQuery('.people_infos').hide('normal');
40
+ var val_name = jQuery('#user_lastname').val();
41
+ var val_firstname = jQuery('#user_firstname').val();
42
+ var val_civility = jQuery('#user_civility').val();
43
+ var custom_select_civility = jQuery('#user_civility').siblings('.dropdown').find('.dropdown_toggle').html();
44
+
45
+ jQuery('#user_address_deliveries_attributes_0_lastname').val(val_name);
46
+ jQuery('#user_address_deliveries_attributes_0_firstname').val(val_firstname);
47
+ jQuery('#user_address_deliveries_attributes_0_civility').val(val_civility);
48
+ jQuery('#user_address_deliveries_attributes_0_civility').siblings('.dropdown').find('.dropdown_toggle').html(custom_select_civility);
49
+ } else {
50
+ jQuery('#user_address_deliveries_attributes_0_lastname').val('');
51
+ jQuery('#user_address_deliveries_attributes_0_firstname').val('');
52
+ jQuery('#user_address_deliveries_attributes_0_civility').val('');
53
+ var civility_default_value = jQuery('#user_address_deliveries_attributes_0_civility').siblings('.dropdown').find('options ul li:first .value').text();
54
+ jQuery('#user_address_deliveries_attributes_0_civility').siblings('.dropdown').find('.dropdown_toggle').html('<span>'+civility_default_value+'</span>');
55
+ jQuery('.people_infos').show('normal');
56
+ }
57
+ });
58
+ jQuery('#user_password').change(function(){
59
+ jQuery('#user_password_confirmation').val(jQuery(this).val());
60
+ });
61
+ jQuery('#user_address_deliveries_attributes_0_country_id').change(function(){
62
+ jQuery('#user_country_id').val(jQuery(this).val());
63
+ });
64
+ });
@@ -0,0 +1,83 @@
1
+ jQuery(document).ready(function(){
2
+ jQuery('.add-order-detail').live('click',function(e){
3
+ e.preventDefault();
4
+ jQuery('#productSelectDialog').dialog('open');
5
+ return false;
6
+ });
7
+
8
+ jQuery('#productSelectDialog').dialog({
9
+ autoOpen:false,
10
+ modal:true,
11
+ minHeight: 380,
12
+ width: 800,
13
+ resizable:'se',
14
+ buttons: {
15
+ Ok: function(){
16
+ dataTableSelectRows('#table-products', function(current_table, indexes) {
17
+ for(var i=0; i<indexes.length; i++){
18
+ var row = current_table.fnGetData(indexes[i]);
19
+ var id = row.slice(-4,-3);
20
+ var name = row.slice(-3,-2)[0];
21
+ var sku = row.slice(-2,-1);
22
+ var price = row.slice(-1);
23
+ var price_with_currency = row.slice(3,4);
24
+ var img = jquery_obj_to_str(jQuery(row.slice(0, 1)[0]).find('img'));
25
+
26
+ add_product_to_order_detail(id, name, sku, price, price_with_currency, img);
27
+ }
28
+ jQuery('#transporter_rebuild').val(1);
29
+ update_order_total();
30
+ });
31
+ jQuery('#productSelectDialog').dialog('close');
32
+ }
33
+ },
34
+ open: function(e,ui){
35
+ eval(jQuery('#table-products').data('dataTables_init_function')+'()');
36
+ }
37
+ });
38
+
39
+ // update voucher value and hide/show
40
+ jQuery('#voucher').bind('change', function() {
41
+
42
+ // update display value and hidden field tag
43
+ jQuery('.voucher_value').html(jQuery(this).val());
44
+ jQuery('#order_voucher').val(jQuery(this).val());
45
+
46
+ // show/hide voucher value
47
+ if (jQuery(this).val() == '')
48
+ jQuery('.voucher').hide();
49
+ else
50
+ jQuery('.voucher').show();
51
+ update_order_total();
52
+ });
53
+
54
+ // update order shipping name and value
55
+ jQuery('#order_shipping').bind('change', function() {
56
+ var name = jQuery(this).find("OPTION:selected").text();
57
+ var price = jQuery(this).val();
58
+
59
+ if (price != ''){
60
+ jQuery('.order_shipping_name').html(name);
61
+ jQuery('#order_order_shipping_attributes_name').val(name);
62
+ jQuery('.order_shipping_price').html(price);
63
+ jQuery('#order_order_shipping_attributes_price').val(price);
64
+ update_order_total();
65
+ }
66
+ });
67
+
68
+ // update order status in index
69
+ jQuery('.order-change-status').live('change', function() {
70
+ var state = jQuery(this).val();
71
+ var order_id = get_rails_element_id(this);
72
+ jQuery.ajax({
73
+ "url": '/admin/orders/'+order_id,
74
+ "complete": display_notifications,
75
+ "data": {
76
+ "authenticity_token": encodeURIComponent(window._forgeos_js_vars.token),
77
+ "order[aasm_current_state_with_event_firing]": state
78
+ },
79
+ "dataType": 'text',
80
+ "type": 'put'
81
+ });
82
+ });
83
+ });
@@ -0,0 +1,45 @@
1
+ jQuery(document).ready(function(){
2
+ jQuery('#pack-productSelectDialog').dialog({
3
+ autoOpen:false,
4
+ modal:true,
5
+ minHeight: 300,
6
+ width: 1080,
7
+ resizable:'se',
8
+ buttons: {
9
+ Ok: function(){
10
+ add_products_to_pack();
11
+ jQuery('#pack-productSelectDialog').dialog('close');
12
+ }
13
+ },
14
+ open: function(e,ui){
15
+ eval(jQuery('#table-products').data('dataTables_init_function')+'()');
16
+ }
17
+ });
18
+
19
+ jQuery('#add-product').live('click',function(e){
20
+ e.preventDefault();
21
+ jQuery('#pack-productSelectDialog').dialog('open');
22
+ return false;
23
+ });
24
+
25
+ jQuery('#redirection-productSelectDialog').dialog({
26
+ autoOpen:false,
27
+ modal:true,
28
+ minHeight: 300,
29
+ width: 1080,
30
+ resizable:'se',
31
+ buttons: {
32
+ Ok: function(){
33
+ change_redirection_product();
34
+ jQuery('#redirection-productSelectDialog').dialog('close');
35
+ }
36
+ },
37
+ open: function(){ eval(jQuery('#table-redirections').data('dataTables_init_function')+'()');}
38
+ });
39
+
40
+ jQuery('#add-redirection-product').live('click',function(e){
41
+ e.preventDefault();
42
+ jQuery('#redirection-productSelectDialog').dialog('open');
43
+ return false;
44
+ });
45
+ });
@@ -0,0 +1,103 @@
1
+ jQuery(document).ready(function(){
2
+ //init sortable
3
+ jQuery('.sortable').each(function(){
4
+ jQuery(this).sortable({
5
+ "handle": '.handler',
6
+ "placeholder": 'ui-state-highlight',
7
+ "stop": function(event,ui){
8
+ jQuery('#product-images .sortable li').removeClass('first-image');
9
+ check_product_first_image();
10
+ }
11
+ });
12
+ });
13
+
14
+ //init the tool-tip (for product-modify page)
15
+ tool_tip();
16
+
17
+ //clone mySlides search input
18
+ jQuery('#product-filter').prepend(jQuery('#mySlides_filter').children('input').clone(true));
19
+
20
+ //The first image in product images list got the class first-image & become bigger
21
+ check_product_first_image();
22
+
23
+ //when click on add-product-link open the div below
24
+ jQuery('#add-product-link').bind('click', function(){
25
+ jQuery('#existing-products').toggleClass('open');
26
+ jQuery('#existing-products').toggle('blind');
27
+ });
28
+
29
+ jQuery('#product_product_type_id, #pack_product_type_id').live('change',function(e){
30
+ jQuery.ajax({
31
+ "before": function(){ tmce_unload_children('#product-types-panel');},
32
+ "data": {
33
+ "product_type_id": jQuery(e.target).val(),
34
+ "authenticity_token": window._forgeos_js_vars.token,
35
+ "id": get_id_from_rails_url()
36
+ },
37
+ "success": function(request){
38
+ jQuery('#product-types-panel').html(request);
39
+ tmce_load_children('#product-types-panel');
40
+ },
41
+ "type": 'post',
42
+ "url": '/admin/products/update_attributes_list'
43
+ });
44
+ });
45
+
46
+ jQuery('.add_a_size').live('click', function(){
47
+ var itemInTable = jQuery('#product_sizes tbody tr').length;
48
+
49
+ var new_tr = '';
50
+ new_tr += '<tr>'
51
+ new_tr += '<td>'
52
+ new_tr += '<input type="text" name="product[sizes_attributes]['+itemInTable+'][name]" />'
53
+ new_tr += '</td>'
54
+ new_tr += '<td>'
55
+ new_tr += '<input type="text" name="product[sizes_attributes]['+itemInTable+'][quantity]" />'
56
+ new_tr += '</td>'
57
+ new_tr += '<td>'
58
+ new_tr += '<input type="hidden" name="product[sizes_attributes]['+itemInTable+'][id]" />'
59
+ new_tr += '<input type="hidden" name="product[sizes_attributes]['+itemInTable+'][_destroy]" />'
60
+ new_tr += '<input type="hidden" name="product[sizes_attributes]['+itemInTable+'][position]" />'
61
+ new_tr += '<a href="#" class="remove_this_size">supprimer</a>'
62
+ new_tr += '</td>'
63
+ new_tr += '</tr>'
64
+
65
+ jQuery('#product_sizes').append(new_tr);
66
+ });
67
+
68
+ jQuery('#add-price-variation').live('click', function(e){
69
+ e.preventDefault();
70
+ var index = jQuery('#price-variations .line').size();
71
+
72
+ var new_price = "<div class='line'>\
73
+ <input class='center' type='text' size='2' name='product[price_variations_attributes]["+index+"][quantity]' />\
74
+ <label name='product[price_variations_attributes]["+index+"][quantity]' >"+jQuery('#price-variations').attr('data-quantity')+"</label>\
75
+ <input class='center' type='text' size='2' name='product[price_variations_attributes]["+index+"][discount]' />\
76
+ <label name='product[price_variations_attributes]["+index+"][discount]'>"+jQuery('#price-variations').attr('data-discount')+"</label>\
77
+ <a href='#' class='small-icons destroy-link destroy'></a>\
78
+ </div>";
79
+
80
+ jQuery('#price-variations').append(new_price);
81
+ return false;
82
+ });
83
+
84
+ jQuery('.remove_this_size').live('click', function(e){
85
+ e.preventDefault();
86
+ var block = jQuery(this).parents('tr');
87
+ if (parseInt(get_rails_element_id(block.find('input:first'))) < 0) {
88
+ block.remove();
89
+ } else {
90
+ block.hide();
91
+ block.find('.delete').val(1);
92
+ }
93
+ return false;
94
+ });
95
+
96
+ jQuery('#product_sizes tr').sortable({
97
+ handle:'.handler',
98
+ placeholder: 'ui-state-highlight'
99
+ });
100
+
101
+ jQuery('#product_sizes').dataTable();
102
+
103
+ });