spree_core 0.60.6 → 0.70.RC1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (702) hide show
  1. data/{public → app/assets}/images/admin/bg/active-tab.png +0 -0
  2. data/{public → app/assets}/images/admin/bg/admin_tab_back.png +0 -0
  3. data/{public → app/assets}/images/admin/bg/admin_tab_selected_back.png +0 -0
  4. data/{public → app/assets}/images/admin/bg/content-back-blue.png +0 -0
  5. data/{public → app/assets}/images/admin/bg/content-back-green.png +0 -0
  6. data/{public → app/assets}/images/admin/bg/content-back.png +0 -0
  7. data/{public → app/assets}/images/admin/bg/flash-error.png +0 -0
  8. data/{public → app/assets}/images/admin/bg/flash-notice.png +0 -0
  9. data/{public → app/assets}/images/admin/bg/green-stripes.gif +0 -0
  10. data/{public → app/assets}/images/admin/bg/green-stripes.png +0 -0
  11. data/{public → app/assets}/images/admin/bg/grid_header_back.png +0 -0
  12. data/{public → app/assets}/images/admin/bg/grid_header_back_green.png +0 -0
  13. data/{public → app/assets}/images/admin/bg/header-bg.png +0 -0
  14. data/{public → app/assets}/images/admin/bg/header.png +0 -0
  15. data/{public → app/assets}/images/admin/bg/header_bg.jpg +0 -0
  16. data/{public → app/assets}/images/admin/bg/menu-current.png +0 -0
  17. data/{public → app/assets}/images/admin/bg/red-stripes.gif +0 -0
  18. data/{public → app/assets}/images/admin/bg/red-stripes.png +0 -0
  19. data/{public → app/assets}/images/admin/bg/spree_50.png +0 -0
  20. data/{public → app/assets}/images/admin/bg/subnav-divider.png +0 -0
  21. data/{public → app/assets}/images/admin/bg/subnav.png +0 -0
  22. data/{public → app/assets}/images/admin/bg/tab-back.png +0 -0
  23. data/{public → app/assets}/images/admin/buttons/blue/left_01.png +0 -0
  24. data/{public → app/assets}/images/admin/buttons/blue/right_01.png +0 -0
  25. data/{public → app/assets}/images/admin/buttons/drag-handle-green.png +0 -0
  26. data/{public → app/assets}/images/admin/buttons/green/left_01.png +0 -0
  27. data/{public → app/assets}/images/admin/buttons/green/right_01.png +0 -0
  28. data/{public → app/assets}/images/admin/buttons/left_01.png +0 -0
  29. data/{public → app/assets}/images/admin/buttons/left_01_small.png +0 -0
  30. data/{public → app/assets}/images/admin/buttons/orange/left_03.png +0 -0
  31. data/{public → app/assets}/images/admin/buttons/orange/right_03.png +0 -0
  32. data/{public → app/assets}/images/admin/buttons/right_01.png +0 -0
  33. data/{public → app/assets}/images/admin/buttons/right_01_small.png +0 -0
  34. data/{public → app/assets}/images/admin/icons/16x16/1.png +0 -0
  35. data/{public → app/assets}/images/admin/icons/16x16/10.png +0 -0
  36. data/{public → app/assets}/images/admin/icons/16x16/2.png +0 -0
  37. data/{public → app/assets}/images/admin/icons/16x16/3.png +0 -0
  38. data/{public → app/assets}/images/admin/icons/16x16/4.png +0 -0
  39. data/{public → app/assets}/images/admin/icons/16x16/5.png +0 -0
  40. data/{public → app/assets}/images/admin/icons/16x16/6.png +0 -0
  41. data/{public → app/assets}/images/admin/icons/16x16/7.png +0 -0
  42. data/{public → app/assets}/images/admin/icons/16x16/8.png +0 -0
  43. data/{public → app/assets}/images/admin/icons/16x16/9.png +0 -0
  44. data/{public → app/assets}/images/admin/icons/32x32/1.png +0 -0
  45. data/{public → app/assets}/images/admin/icons/32x32/10.png +0 -0
  46. data/{public → app/assets}/images/admin/icons/32x32/11.png +0 -0
  47. data/{public → app/assets}/images/admin/icons/32x32/2.png +0 -0
  48. data/{public → app/assets}/images/admin/icons/32x32/3.png +0 -0
  49. data/{public → app/assets}/images/admin/icons/32x32/4.png +0 -0
  50. data/{public → app/assets}/images/admin/icons/32x32/5.png +0 -0
  51. data/{public → app/assets}/images/admin/icons/32x32/6.png +0 -0
  52. data/{public → app/assets}/images/admin/icons/32x32/7.png +0 -0
  53. data/{public → app/assets}/images/admin/icons/32x32/8.png +0 -0
  54. data/{public → app/assets}/images/admin/icons/32x32/9.png +0 -0
  55. data/{public → app/assets}/images/admin/icons/accept.png +0 -0
  56. data/{public → app/assets}/images/admin/icons/add.gif +0 -0
  57. data/{public → app/assets}/images/admin/icons/add.png +0 -0
  58. data/{public → app/assets}/images/admin/icons/arrow-down.gif +0 -0
  59. data/{public → app/assets}/images/admin/icons/cross.png +0 -0
  60. data/{public → app/assets}/images/admin/icons/delete.gif +0 -0
  61. data/{public → app/assets}/images/admin/icons/delete.png +0 -0
  62. data/{public → app/assets}/images/admin/icons/drag.gif +0 -0
  63. data/{public → app/assets}/images/admin/icons/edit.gif +0 -0
  64. data/{public → app/assets}/images/admin/icons/edit.png +0 -0
  65. data/{public → app/assets}/images/admin/icons/email.png +0 -0
  66. data/{public → app/assets}/images/admin/icons/error.png +0 -0
  67. data/{public → app/assets}/images/admin/icons/exclamation.png +0 -0
  68. data/{public → app/assets}/images/admin/icons/feed.png +0 -0
  69. data/{public → app/assets}/images/admin/icons/pdf.png +0 -0
  70. data/{public → app/assets}/images/admin/icons/reorder.gif +0 -0
  71. data/{public → app/assets}/images/admin/icons/search.gif +0 -0
  72. data/{public → app/assets}/images/admin/icons/send-email.png +0 -0
  73. data/{public → app/assets}/images/admin/icons/stop.png +0 -0
  74. data/app/assets/images/admin/icons/switch.png +0 -0
  75. data/{public → app/assets}/images/admin/icons/tick.png +0 -0
  76. data/{public → app/assets}/images/admin/icons/up.gif +0 -0
  77. data/{public → app/assets}/images/admin/icons/xls.png +0 -0
  78. data/{public/images → app/assets/images/admin}/progress.gif +0 -0
  79. data/{public/images → app/assets/images/creditcards}/amex_cid.gif +0 -0
  80. data/{public/images → app/assets/images/creditcards}/creditcard.gif +0 -0
  81. data/{public/images → app/assets/images/creditcards}/discover_cid.gif +0 -0
  82. data/{public/images → app/assets/images/creditcards}/master_cid.jpg +0 -0
  83. data/{public/images → app/assets/images/creditcards}/visa_cid.gif +0 -0
  84. data/{public → app/assets}/images/favicon.ico +0 -0
  85. data/{public/images → app/assets/images/icons}/add-to-cart.png +0 -0
  86. data/{public/images → app/assets/images/icons}/checkout.png +0 -0
  87. data/app/assets/images/icons/delete.png +0 -0
  88. data/{public/images → app/assets/images/icons}/update.png +0 -0
  89. data/app/assets/images/noimage/mini.png +0 -0
  90. data/app/assets/images/noimage/product.png +0 -0
  91. data/app/assets/images/noimage/small.png +0 -0
  92. data/{public → app/assets}/images/spinner.gif +0 -0
  93. data/{public → app/assets}/javascripts/admin/address_states.js +4 -4
  94. data/{public/javascripts/admin.js → app/assets/javascripts/admin/admin.js.erb} +90 -93
  95. data/app/assets/javascripts/admin/calculator.js +15 -0
  96. data/{public → app/assets}/javascripts/admin/checkouts/edit.js +13 -13
  97. data/app/assets/javascripts/admin/gateway.js +13 -0
  98. data/app/assets/javascripts/admin/images/index.js +10 -0
  99. data/app/assets/javascripts/admin/images/new.js +5 -0
  100. data/app/assets/javascripts/admin/nested-attribute.js +23 -0
  101. data/app/assets/javascripts/admin/orders/edit.js +15 -0
  102. data/app/assets/javascripts/admin/orders/edit_form.js +16 -0
  103. data/{public → app/assets}/javascripts/admin/payments/new.js +0 -0
  104. data/app/assets/javascripts/admin/products.js +23 -0
  105. data/app/assets/javascripts/admin/spree_core.js +10 -0
  106. data/app/assets/javascripts/admin/taxonomy.js +206 -0
  107. data/app/assets/javascripts/admin/underscore-min.js +26 -0
  108. data/app/assets/javascripts/admin/zone.js +44 -0
  109. data/app/assets/javascripts/store/cart.js +11 -0
  110. data/app/assets/javascripts/store/checkout.js +77 -0
  111. data/app/assets/javascripts/store/product.js +49 -0
  112. data/app/assets/javascripts/store/spree_core.js +6 -0
  113. data/{public/stylesheets/admin/admin-forms.css → app/assets/stylesheets/admin/admin-form.css.erb} +27 -16
  114. data/{public → app/assets}/stylesheets/admin/admin-reset.css +0 -0
  115. data/{public/stylesheets/admin/admin-tables.css → app/assets/stylesheets/admin/admin-tables.css.erb} +3 -2
  116. data/{public → app/assets}/stylesheets/admin/admin-typography.css +2 -2
  117. data/{public/stylesheets/admin/admin.css → app/assets/stylesheets/admin/admin.css.erb} +22 -46
  118. data/{public/stylesheets/admin/autocomplete.css → app/assets/stylesheets/admin/edit_checkouts.css} +6 -7
  119. data/{public → app/assets}/stylesheets/admin/grids.css +107 -107
  120. data/app/assets/stylesheets/admin/spree_core.css +16 -0
  121. data/{public → app/assets}/stylesheets/admin/token-input.css +0 -0
  122. data/app/assets/stylesheets/store/reset.css +175 -0
  123. data/app/assets/stylesheets/store/screen.css +122 -0
  124. data/app/assets/stylesheets/store/spree_core.css +5 -0
  125. data/app/controllers/admin/base_controller.rb +3 -32
  126. data/app/controllers/admin/general_settings_controller.rb +14 -15
  127. data/app/controllers/admin/line_items_controller.rb +1 -1
  128. data/app/controllers/admin/mail_methods_controller.rb +13 -0
  129. data/app/controllers/admin/option_types_controller.rb +1 -2
  130. data/app/controllers/admin/orders_controller.rb +9 -8
  131. data/app/controllers/admin/product_groups_controller.rb +1 -2
  132. data/app/controllers/admin/products_controller.rb +4 -6
  133. data/app/controllers/admin/prototypes_controller.rb +1 -0
  134. data/app/controllers/admin/resource_controller.rb +7 -1
  135. data/app/controllers/admin/shipments_controller.rb +1 -1
  136. data/app/controllers/admin/states_controller.rb +1 -1
  137. data/app/controllers/admin/tax_categories_controller.rb +6 -0
  138. data/app/controllers/admin/taxons_controller.rb +0 -9
  139. data/app/controllers/admin/users_controller.rb +9 -5
  140. data/app/controllers/admin/variants_controller.rb +22 -0
  141. data/app/controllers/admin/zones_controller.rb +1 -1
  142. data/app/controllers/checkout_controller.rb +6 -0
  143. data/app/controllers/content_controller.rb +1 -1
  144. data/app/controllers/home_controller.rb +10 -0
  145. data/app/controllers/orders_controller.rb +11 -7
  146. data/app/controllers/products_controller.rb +0 -1
  147. data/app/helpers/admin/base_helper.rb +4 -8
  148. data/app/helpers/admin/navigation_helper.rb +9 -2
  149. data/app/helpers/checkout_helper.rb +7 -3
  150. data/app/helpers/hook_helper.rb +5 -15
  151. data/app/helpers/products_helper.rb +4 -0
  152. data/app/helpers/spree/base_helper.rb +55 -12
  153. data/app/helpers/taxons_helper.rb +0 -16
  154. data/app/mailers/test_mailer.rb +10 -0
  155. data/app/models/activator.rb +27 -0
  156. data/app/models/adjustment.rb +32 -12
  157. data/app/models/app_configuration.rb +7 -6
  158. data/app/models/calculator/vat.rb +27 -43
  159. data/app/models/creditcard.rb +23 -34
  160. data/app/models/gateway.rb +1 -0
  161. data/app/models/image.rb +7 -2
  162. data/app/models/order.rb +30 -17
  163. data/app/models/payment.rb +5 -11
  164. data/app/models/payment_method.rb +0 -4
  165. data/app/models/payment_method/check.rb +0 -4
  166. data/app/models/product.rb +22 -9
  167. data/app/models/product_group.rb +4 -8
  168. data/app/models/product_scope.rb +1 -1
  169. data/app/models/shipment.rb +1 -6
  170. data/app/models/tax_category.rb +6 -0
  171. data/app/models/tax_rate.rb +10 -0
  172. data/app/models/taxon.rb +3 -3
  173. data/app/models/zone.rb +4 -4
  174. data/app/views/admin/adjustments/_adjustments_table.html.erb +3 -3
  175. data/app/views/admin/adjustments/edit.html.erb +1 -1
  176. data/app/views/admin/adjustments/new.html.erb +1 -1
  177. data/app/views/admin/configurations/index.html.erb +54 -56
  178. data/app/views/admin/general_settings/edit.html.erb +13 -38
  179. data/app/views/admin/general_settings/show.html.erb +13 -23
  180. data/app/views/admin/images/_form.html.erb +4 -4
  181. data/app/views/admin/images/edit.html.erb +4 -4
  182. data/app/views/admin/images/index.html.erb +7 -21
  183. data/app/views/admin/images/new.html.erb +8 -18
  184. data/app/views/admin/inventory_settings/edit.html.erb +3 -3
  185. data/app/views/admin/inventory_units/adjust.html.erb +2 -2
  186. data/app/views/admin/line_items/create.js.erb +4 -0
  187. data/app/views/admin/mail_methods/_form.html.erb +3 -6
  188. data/app/views/admin/mail_methods/edit.html.erb +3 -3
  189. data/app/views/admin/mail_methods/index.html.erb +17 -21
  190. data/app/views/admin/mail_methods/new.html.erb +3 -3
  191. data/app/views/admin/option_types/_available.html.erb +5 -4
  192. data/app/views/admin/option_types/_option_value_fields.html.erb +1 -1
  193. data/app/views/admin/option_types/_selected.html.erb +6 -6
  194. data/app/views/admin/option_types/edit.html.erb +4 -4
  195. data/app/views/admin/option_types/index.html.erb +6 -6
  196. data/app/views/admin/option_types/{new.erb → new.html.erb} +1 -1
  197. data/app/views/admin/option_types/new.js.erb +2 -0
  198. data/app/views/admin/option_types/selected.html.erb +1 -1
  199. data/app/views/admin/orders/_add_product.html.erb +4 -4
  200. data/app/views/admin/orders/_form.html.erb +31 -42
  201. data/app/views/admin/orders/_line_item.html.erb +10 -15
  202. data/app/views/admin/orders/_user_form.html.erb +11 -6
  203. data/app/views/admin/orders/edit.html.erb +12 -16
  204. data/app/views/admin/orders/history.html.erb +3 -3
  205. data/app/views/admin/orders/index.html.erb +33 -45
  206. data/app/views/admin/orders/new.html.erb +5 -6
  207. data/app/views/admin/orders/show.html.erb +7 -9
  208. data/app/views/admin/orders/user.html.erb +2 -7
  209. data/app/views/admin/payment_methods/_form.html.erb +8 -8
  210. data/app/views/admin/payment_methods/edit.html.erb +1 -1
  211. data/app/views/admin/payment_methods/index.html.erb +19 -28
  212. data/app/views/admin/payment_methods/new.html.erb +2 -2
  213. data/app/views/admin/payments/_form.html.erb +1 -1
  214. data/app/views/admin/payments/_list.html.erb +2 -2
  215. data/app/views/admin/payments/_transaction_list.html.erb +3 -3
  216. data/app/views/admin/payments/credit.html.erb +1 -1
  217. data/app/views/admin/payments/index.html.erb +1 -1
  218. data/app/views/admin/payments/new.html.erb +2 -2
  219. data/app/views/admin/payments/show.html.erb +1 -1
  220. data/app/views/admin/payments/source_forms/_gateway.html.erb +6 -6
  221. data/app/views/admin/payments/source_views/_gateway.html.erb +1 -1
  222. data/app/views/admin/product_groups/_preview.html.erb +8 -8
  223. data/app/views/admin/product_groups/_product_scope.html.erb +5 -5
  224. data/app/views/admin/product_groups/edit.html.erb +6 -9
  225. data/app/views/admin/product_groups/index.html.erb +6 -6
  226. data/app/views/admin/product_groups/new.html.erb +2 -2
  227. data/app/views/admin/product_groups/show.html.erb +4 -4
  228. data/app/views/admin/product_groups/update.js.erb +5 -1
  229. data/app/views/admin/product_properties/_product_property_fields.html.erb +1 -1
  230. data/app/views/admin/product_properties/index.html.erb +11 -11
  231. data/app/views/admin/products/_form.html.erb +75 -72
  232. data/app/views/admin/products/_option_types.html.erb +34 -34
  233. data/app/views/admin/products/_properties_form.erb +2 -2
  234. data/app/views/admin/products/edit.html.erb +2 -3
  235. data/app/views/admin/products/index.html.erb +25 -34
  236. data/app/views/admin/products/{new.erb → new.html.erb} +4 -5
  237. data/app/views/admin/products/new.js.erb +3 -0
  238. data/app/views/admin/properties/_form.html.erb +13 -10
  239. data/app/views/admin/properties/edit.html.erb +1 -1
  240. data/app/views/admin/properties/index.html.erb +5 -5
  241. data/app/views/admin/properties/{new.erb → new.html.erb} +2 -2
  242. data/app/views/admin/properties/new.js.erb +2 -0
  243. data/app/views/admin/prototypes/_form.html.erb +18 -18
  244. data/app/views/admin/prototypes/_prototypes.html.erb +22 -0
  245. data/app/views/admin/prototypes/available.js.erb +2 -0
  246. data/app/views/admin/prototypes/edit.html.erb +1 -1
  247. data/app/views/admin/prototypes/index.html.erb +6 -6
  248. data/app/views/admin/prototypes/{new.erb → new.html.erb} +2 -2
  249. data/app/views/admin/prototypes/new.js.erb +2 -0
  250. data/app/views/admin/reports/index.html.erb +2 -2
  251. data/app/views/admin/reports/sales_total.html.erb +1 -1
  252. data/app/views/admin/return_authorizations/_form.html.erb +2 -2
  253. data/app/views/admin/return_authorizations/edit.html.erb +4 -4
  254. data/app/views/admin/return_authorizations/index.html.erb +5 -5
  255. data/app/views/admin/return_authorizations/new.html.erb +2 -2
  256. data/app/views/admin/shared/_address.html.erb +1 -1
  257. data/app/views/admin/shared/_address_form.html.erb +3 -4
  258. data/app/views/admin/shared/_calculator_fields.html.erb +3 -3
  259. data/app/views/admin/shared/_configuration_menu.html.erb +13 -14
  260. data/app/views/admin/shared/_destroy.js.erb +1 -1
  261. data/app/views/admin/shared/_edit_resource_links.html.erb +1 -1
  262. data/app/views/admin/shared/_group_from_products_form.html.erb +1 -1
  263. data/app/views/admin/shared/_head.html.erb +26 -0
  264. data/app/views/admin/shared/_new_adjustment_button.html.erb +4 -4
  265. data/app/views/admin/shared/_new_resource_links.html.erb +1 -1
  266. data/app/views/admin/shared/_order_details.html.erb +0 -1
  267. data/app/views/admin/shared/_order_tabs.html.erb +42 -47
  268. data/app/views/admin/shared/_product_sub_menu.html.erb +6 -8
  269. data/app/views/admin/shared/_product_tabs.html.erb +19 -23
  270. data/app/views/admin/shared/_report_criteria.html.erb +2 -2
  271. data/app/views/admin/shared/_show_resource_links.html.erb +2 -2
  272. data/app/views/admin/shared/_tabs.html.erb +1 -1
  273. data/app/views/admin/shipments/_form.html.erb +37 -41
  274. data/app/views/admin/shipments/edit.html.erb +13 -15
  275. data/app/views/admin/shipments/index.html.erb +21 -30
  276. data/app/views/admin/shipments/new.html.erb +6 -6
  277. data/app/views/admin/shipping_categories/_form.html.erb +2 -2
  278. data/app/views/admin/shipping_categories/edit.html.erb +1 -1
  279. data/app/views/admin/shipping_categories/index.html.erb +5 -5
  280. data/app/views/admin/shipping_categories/new.html.erb +1 -1
  281. data/app/views/admin/shipping_methods/_form.html.erb +4 -5
  282. data/app/views/admin/shipping_methods/edit.html.erb +7 -7
  283. data/app/views/admin/shipping_methods/index.html.erb +13 -22
  284. data/app/views/admin/shipping_methods/new.html.erb +7 -7
  285. data/app/views/admin/states/_state_list.html.erb +6 -6
  286. data/app/views/admin/states/edit.html.erb +1 -1
  287. data/app/views/admin/states/index.html.erb +3 -3
  288. data/app/views/admin/states/{new.erb → new.html.erb} +1 -1
  289. data/app/views/admin/states/new.js.erb +2 -0
  290. data/app/views/admin/tax_categories/index.html.erb +7 -7
  291. data/app/views/admin/tax_categories/new.html.erb +1 -1
  292. data/app/views/admin/tax_rates/_form.html.erb +5 -5
  293. data/app/views/admin/tax_rates/edit.html.erb +1 -1
  294. data/app/views/admin/tax_rates/index.html.erb +5 -5
  295. data/app/views/admin/tax_rates/new.html.erb +1 -1
  296. data/app/views/admin/tax_settings/edit.html.erb +10 -4
  297. data/app/views/admin/tax_settings/show.html.erb +8 -4
  298. data/app/views/admin/taxonomies/_form.html.erb +2 -2
  299. data/app/views/admin/taxonomies/_js_head.html.erb +0 -1
  300. data/app/views/admin/taxonomies/_list.html.erb +3 -3
  301. data/app/views/admin/taxonomies/edit.erb +2 -2
  302. data/app/views/admin/taxonomies/index.html.erb +4 -4
  303. data/app/views/admin/taxonomies/new.html.erb +2 -2
  304. data/app/views/admin/taxons/_form.html.erb +2 -2
  305. data/app/views/admin/taxons/_taxon_table.html.erb +10 -10
  306. data/app/views/admin/taxons/available.js.erb +7 -14
  307. data/app/views/admin/taxons/edit.html.erb +2 -2
  308. data/app/views/admin/taxons/selected.html.erb +9 -9
  309. data/app/views/admin/trackers/_form.html.erb +7 -6
  310. data/app/views/admin/trackers/edit.html.erb +1 -1
  311. data/app/views/admin/trackers/index.html.erb +8 -13
  312. data/app/views/admin/trackers/new.html.erb +1 -1
  313. data/app/views/admin/users/_form.html.erb +13 -14
  314. data/app/views/admin/users/edit.html.erb +7 -7
  315. data/app/views/admin/users/index.html.erb +20 -34
  316. data/app/views/admin/users/new.html.erb +7 -7
  317. data/app/views/admin/users/show.html.erb +2 -2
  318. data/app/views/admin/variants/_form.html.erb +6 -6
  319. data/app/views/admin/variants/edit.html.erb +3 -3
  320. data/app/views/admin/variants/index.html.erb +6 -6
  321. data/app/views/admin/variants/new.html.erb +8 -0
  322. data/app/views/admin/variants/new.js.erb +2 -0
  323. data/app/views/admin/zones/_country_member.html.erb +1 -1
  324. data/app/views/admin/zones/_form.html.erb +1 -1
  325. data/app/views/admin/zones/_member_type.html.erb +2 -2
  326. data/app/views/admin/zones/_state_member.html.erb +2 -2
  327. data/app/views/admin/zones/_zone_member.html.erb +2 -2
  328. data/app/views/admin/zones/edit.html.erb +1 -1
  329. data/app/views/admin/zones/index.html.erb +8 -9
  330. data/app/views/admin/zones/new.html.erb +1 -1
  331. data/app/views/checkout/_address.html.erb +125 -134
  332. data/app/views/checkout/_confirm.html.erb +2 -2
  333. data/app/views/checkout/_delivery.html.erb +8 -4
  334. data/app/views/checkout/_payment.html.erb +7 -7
  335. data/app/views/checkout/_summary.html.erb +6 -5
  336. data/app/views/checkout/edit.html.erb +6 -8
  337. data/app/views/checkout/payment/_gateway.html.erb +5 -5
  338. data/app/views/checkout/registration.html.erb +3 -3
  339. data/app/views/content/cvv.html.erb +5 -5
  340. data/app/views/home/index.html.erb +10 -0
  341. data/app/views/layouts/admin.html.erb +16 -23
  342. data/app/views/layouts/spree_application.html.erb +30 -44
  343. data/app/views/orders/_form.html.erb +8 -10
  344. data/app/views/orders/_line_item.html.erb +17 -32
  345. data/app/views/orders/edit.html.erb +20 -18
  346. data/app/views/orders/show.html.erb +2 -2
  347. data/app/views/products/_cart_form.html.erb +42 -47
  348. data/app/views/products/_properties.html.erb +5 -4
  349. data/app/views/products/_taxons.html.erb +10 -12
  350. data/app/views/products/_thumbnails.html.erb +14 -35
  351. data/app/views/products/index.html.erb +6 -9
  352. data/app/views/products/show.html.erb +18 -23
  353. data/app/views/shared/_error_messages.html.erb +1 -1
  354. data/app/views/shared/_filters.html.erb +1 -1
  355. data/app/views/shared/_head.html.erb +3 -6
  356. data/app/views/shared/_nav_bar.html.erb +3 -2
  357. data/app/views/shared/_order_details.html.erb +31 -41
  358. data/app/views/shared/_products.html.erb +10 -16
  359. data/app/views/shared/_store_menu.html.erb +2 -2
  360. data/app/views/shared/_taxonomies.html.erb +3 -14
  361. data/app/views/taxons/_taxon.html.erb +1 -1
  362. data/app/views/taxons/show.html.erb +6 -6
  363. data/app/views/test_mailer/test_email.text.erb +4 -0
  364. data/config/initializers/deprecation_checker.rb +7 -0
  365. data/config/initializers/disable_paperclip_log.rb +2 -0
  366. data/config/initializers/form_builder.rb +0 -4
  367. data/config/initializers/sprockets_precompile_patch.rb +16 -0
  368. data/config/initializers/workarounds_for_ruby19.rb +1 -1
  369. data/config/locales/en.yml +55 -24
  370. data/config/routes.rb +9 -8
  371. data/db/default/roles.yml +1 -3
  372. data/db/migrate/20100419194457_fix_existing_coupon_credits.rb +9 -0
  373. data/db/migrate/20110329141434_create_activators.rb +21 -0
  374. data/db/migrate/20110418151136_eligible_for_adjustments.rb +9 -0
  375. data/db/seeds.rb +4 -2
  376. data/lib/custom_fixtures.rb +64 -3
  377. data/lib/generators/spree/dummy/dummy_generator.rb +105 -0
  378. data/lib/generators/spree/dummy/templates/cucumber/cucumber.rb +38 -0
  379. data/lib/generators/spree/dummy/templates/rails/application.rb +10 -0
  380. data/lib/generators/spree/dummy/templates/rails/boot.rb +6 -0
  381. data/lib/generators/spree/dummy/templates/rails/database.yml +30 -0
  382. data/lib/generators/spree/dummy/templates/rails/routes.rb +3 -0
  383. data/lib/generators/spree/sandbox/sandbox_generator.rb +27 -0
  384. data/lib/generators/spree/site/site_generator.rb +79 -0
  385. data/lib/generators/spree/site/templates/app/assets/javascripts/admin/all.js +16 -0
  386. data/lib/generators/spree/site/templates/app/assets/javascripts/store/all.js +16 -0
  387. data/lib/generators/spree/site/templates/app/assets/stylesheets/admin/all.css +17 -0
  388. data/lib/generators/spree/site/templates/app/assets/stylesheets/store/all.css +17 -0
  389. data/lib/scopes.rb +1 -1
  390. data/lib/spree/calculated_adjustments.rb +8 -3
  391. data/lib/spree/search/base.rb +1 -5
  392. data/lib/spree_base.rb +12 -0
  393. data/lib/spree_core.rb +9 -6
  394. data/lib/spree_core/ext/active_record.rb +1 -1
  395. data/lib/spree_core/preferences/model_hooks.rb +7 -3
  396. data/lib/spree_core/railtie.rb +19 -3
  397. data/lib/spree_core/testing_support/common_rake.rb +12 -0
  398. data/lib/spree_core/testing_support/factories/activator_factory.rb +6 -0
  399. data/lib/spree_core/testing_support/factories/adjustment_factory.rb +1 -0
  400. data/lib/spree_core/testing_support/factories/calculator_factory.rb +6 -0
  401. data/lib/spree_core/testing_support/factories/order_factory.rb +7 -6
  402. data/lib/spree_core/testing_support/factories/product_factory.rb +6 -0
  403. data/lib/spree_core/testing_support/factories/user_factory.rb +14 -10
  404. data/lib/spree_core/testing_support/factories/zone_factory.rb +1 -1
  405. data/lib/spree_core/theme_support.rb +0 -3
  406. data/lib/spree_core/theme_support/hook_listener.rb +112 -35
  407. data/lib/spree_core/version.rb +1 -1
  408. data/lib/subclass_registration.rb +21 -0
  409. data/lib/tasks/assets.rake +58 -0
  410. data/lib/tasks/core.rake +18 -11
  411. data/lib/tasks/install.rake +4 -12
  412. data/{public → vendor/assets}/images/datepicker/cal.gif +0 -0
  413. data/vendor/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  414. data/vendor/assets/images/jquery-ui/ui-bg_flat_0_eeeeee_40x100.png +0 -0
  415. data/vendor/assets/images/jquery-ui/ui-bg_flat_55_ffffff_40x100.png +0 -0
  416. data/vendor/assets/images/jquery-ui/ui-bg_flat_75_ffffff_40x100.png +0 -0
  417. data/vendor/assets/images/jquery-ui/ui-bg_glass_65_ffffff_1x400.png +0 -0
  418. data/vendor/assets/images/jquery-ui/ui-bg_highlight-soft_100_f6f6f6_1x100.png +0 -0
  419. data/vendor/assets/images/jquery-ui/ui-bg_highlight-soft_25_0073ea_1x100.png +0 -0
  420. data/vendor/assets/images/jquery-ui/ui-bg_highlight-soft_50_dddddd_1x100.png +0 -0
  421. data/vendor/assets/images/jquery-ui/ui-icons_0073ea_256x240.png +0 -0
  422. data/vendor/assets/images/jquery-ui/ui-icons_454545_256x240.png +0 -0
  423. data/vendor/assets/images/jquery-ui/ui-icons_666666_256x240.png +0 -0
  424. data/vendor/assets/images/jquery-ui/ui-icons_ff0084_256x240.png +0 -0
  425. data/vendor/assets/images/jquery-ui/ui-icons_ffffff_256x240.png +0 -0
  426. data/{public → vendor/assets}/javascripts/jquery.alerts/images/help.gif +0 -0
  427. data/{public → vendor/assets}/javascripts/jquery.alerts/images/important.gif +0 -0
  428. data/{public → vendor/assets}/javascripts/jquery.alerts/images/info.gif +0 -0
  429. data/{public → vendor/assets}/javascripts/jquery.alerts/images/title.gif +0 -0
  430. data/{public → vendor/assets}/javascripts/jquery.alerts/jquery.alerts.css +0 -0
  431. data/{public → vendor/assets}/javascripts/jquery.alerts/jquery.alerts.js +0 -0
  432. data/{public → vendor/assets}/javascripts/jquery.alerts/jquery.alerts.spree.css +0 -0
  433. data/{public → vendor/assets}/javascripts/jquery.autocomplete.min.js +0 -0
  434. data/vendor/assets/javascripts/jquery.cookie.js +41 -0
  435. data/{public → vendor/assets}/javascripts/jquery.delayedobserver.js +0 -0
  436. data/{public/javascripts/jsTree → vendor/assets/javascripts/jquery.jstree}/jquery.jstree.js +4544 -3510
  437. data/{public/javascripts/jsTree → vendor/assets/javascripts/jquery.jstree}/themes/apple/bg.jpg +0 -0
  438. data/{public/javascripts/jsTree → vendor/assets/javascripts/jquery.jstree}/themes/apple/d.png +0 -0
  439. data/{public/javascripts/jsTree → vendor/assets/javascripts/jquery.jstree}/themes/apple/dot_for_ie.gif +0 -0
  440. data/{public/javascripts/jsTree → vendor/assets/javascripts/jquery.jstree}/themes/apple/style.css +2 -1
  441. data/{public/javascripts/jsTree → vendor/assets/javascripts/jquery.jstree}/themes/apple/throbber.gif +0 -0
  442. data/vendor/assets/javascripts/jquery.tokeninput.js +860 -0
  443. data/vendor/assets/javascripts/jquery.validate/additional-methods.min.js +28 -0
  444. data/vendor/assets/javascripts/jquery.validate/jquery.validate.min.js +51 -0
  445. data/vendor/assets/javascripts/jquery.validate/localization/messages_ar.js +24 -0
  446. data/vendor/assets/javascripts/jquery.validate/localization/messages_bg.js +23 -0
  447. data/vendor/assets/javascripts/jquery.validate/localization/messages_ca.js +23 -0
  448. data/vendor/assets/javascripts/jquery.validate/localization/messages_cn.js +23 -0
  449. data/vendor/assets/javascripts/jquery.validate/localization/messages_cs.js +23 -0
  450. data/vendor/assets/javascripts/jquery.validate/localization/messages_da.js +20 -0
  451. data/vendor/assets/javascripts/jquery.validate/localization/messages_de.js +21 -0
  452. data/vendor/assets/javascripts/jquery.validate/localization/messages_el.js +24 -0
  453. data/{public/javascripts → vendor/assets/javascripts/jquery.validate}/localization/messages_es.js +22 -23
  454. data/vendor/assets/javascripts/jquery.validate/localization/messages_fa.js +23 -0
  455. data/vendor/assets/javascripts/jquery.validate/localization/messages_fi.js +21 -0
  456. data/vendor/assets/javascripts/jquery.validate/localization/messages_fr.js +23 -0
  457. data/vendor/assets/javascripts/jquery.validate/localization/messages_ge.js +23 -0
  458. data/vendor/assets/javascripts/jquery.validate/localization/messages_he.js +23 -0
  459. data/vendor/assets/javascripts/jquery.validate/localization/messages_hu.js +21 -0
  460. data/vendor/assets/javascripts/jquery.validate/localization/messages_it.js +23 -0
  461. data/vendor/assets/javascripts/jquery.validate/localization/messages_ja.js +23 -0
  462. data/vendor/assets/javascripts/jquery.validate/localization/messages_kk.js +23 -0
  463. data/vendor/assets/javascripts/jquery.validate/localization/messages_lt.js +23 -0
  464. data/vendor/assets/javascripts/jquery.validate/localization/messages_lv.js +23 -0
  465. data/vendor/assets/javascripts/jquery.validate/localization/messages_nl.js +23 -0
  466. data/vendor/assets/javascripts/jquery.validate/localization/messages_no.js +23 -0
  467. data/vendor/assets/javascripts/jquery.validate/localization/messages_pl.js +23 -0
  468. data/vendor/assets/javascripts/jquery.validate/localization/messages_ptbr.js +30 -0
  469. data/vendor/assets/javascripts/jquery.validate/localization/messages_ptpt.js +23 -0
  470. data/{public/javascripts → vendor/assets/javascripts/jquery.validate}/localization/messages_ro.js +22 -23
  471. data/vendor/assets/javascripts/jquery.validate/localization/messages_ru.js +23 -0
  472. data/vendor/assets/javascripts/jquery.validate/localization/messages_se.js +23 -0
  473. data/vendor/assets/javascripts/jquery.validate/localization/messages_si.js +23 -0
  474. data/vendor/assets/javascripts/jquery.validate/localization/messages_sk.js +21 -0
  475. data/vendor/assets/javascripts/jquery.validate/localization/messages_sr.js +23 -0
  476. data/vendor/assets/javascripts/jquery.validate/localization/messages_th.js +23 -0
  477. data/vendor/assets/javascripts/jquery.validate/localization/messages_tr.js +24 -0
  478. data/vendor/assets/javascripts/jquery.validate/localization/messages_tw.js +24 -0
  479. data/vendor/assets/javascripts/jquery.validate/localization/messages_ua.js +24 -0
  480. data/vendor/assets/javascripts/jquery.validate/localization/messages_vi.js +23 -0
  481. data/vendor/assets/javascripts/jquery.validate/localization/methods_de.js +12 -0
  482. data/vendor/assets/javascripts/jquery.validate/localization/methods_nl.js +9 -0
  483. data/vendor/assets/javascripts/jquery.validate/localization/methods_pt.js +9 -0
  484. data/vendor/assets/stylesheets/jquery-ui.datepicker.css.erb +357 -0
  485. metadata +358 -462
  486. data/app/models/spree/alert.rb +0 -13
  487. data/app/stylesheets/_buttons.less +0 -80
  488. data/app/stylesheets/_cart.less +0 -24
  489. data/app/stylesheets/_checkout.less +0 -76
  490. data/app/stylesheets/_checkout_progress.less +0 -62
  491. data/app/stylesheets/_colors.less +0 -16
  492. data/app/stylesheets/_forms.less +0 -50
  493. data/app/stylesheets/_layout.less +0 -77
  494. data/app/stylesheets/_messages.less +0 -32
  495. data/app/stylesheets/_mixins.less +0 -71
  496. data/app/stylesheets/_navigation.less +0 -130
  497. data/app/stylesheets/_prices.less +0 -18
  498. data/app/stylesheets/_product_details.less +0 -56
  499. data/app/stylesheets/_product_lists.less +0 -66
  500. data/app/stylesheets/_registration.less +0 -24
  501. data/app/stylesheets/_reset.less +0 -69
  502. data/app/stylesheets/_typography.less +0 -158
  503. data/app/stylesheets/screen.less +0 -13
  504. data/app/views/admin/extensions/index.html.erb +0 -23
  505. data/app/views/admin/product_scopes/_form.html.erb +0 -106
  506. data/app/views/admin/prototypes/available.html.erb +0 -22
  507. data/app/views/admin/shared/_alert.html.erb +0 -6
  508. data/app/views/admin/variants/new.erb +0 -11
  509. data/app/views/shared/_additional_field.html.erb +0 -7
  510. data/app/views/shared/_admin_head.html.erb +0 -34
  511. data/app/views/shared/_basic_layout.html.erb +0 -44
  512. data/app/views/shared/_edit_resource_links.html.erb +0 -1
  513. data/app/views/shared/_footer.html.erb +0 -13
  514. data/app/views/shared/_method_error_message.html.erb +0 -4
  515. data/app/views/shared/_new_resource_links.html.erb +0 -1
  516. data/app/views/shared/_show_resource_links.html.erb +0 -3
  517. data/app/views/shared/_test_hook.html.erb +0 -1
  518. data/config/initializers/load_unobtrusive_date_picker.rb +0 -8
  519. data/db/migrate/20101026184833_migrate_adjustments.rb +0 -9
  520. data/lib/generators/spree_core/upgrade_generator.rb +0 -23
  521. data/lib/generators/templates/config/initializers/%file_name%.rb.tt +0 -1
  522. data/lib/generators/templates/config/locales/%current_locale%.yml.tt +0 -2
  523. data/lib/generators/templates/config/routes.rb +0 -3
  524. data/lib/spree_core/theme_support/hook.rb +0 -51
  525. data/lib/spree_core/theme_support/hook_modifier.rb +0 -35
  526. data/lib/spree_core/theme_support/more_patches.rb +0 -118
  527. data/lib/tasks/common.rb +0 -30
  528. data/lib/tasks/themes.rake +0 -34
  529. data/public/images/admin/tabs/off-left.png +0 -0
  530. data/public/images/admin/tabs/off-right.png +0 -0
  531. data/public/images/admin/tabs/on-left.png +0 -0
  532. data/public/images/admin/tabs/on-right.png +0 -0
  533. data/public/images/ajax_loader.gif +0 -0
  534. data/public/images/bg-button-hover.png +0 -0
  535. data/public/images/bg-button-pressed.png +0 -0
  536. data/public/images/bg-button.gif +0 -0
  537. data/public/images/bg-button.png +0 -0
  538. data/public/images/blue/left_01.png +0 -0
  539. data/public/images/blue/right_01.png +0 -0
  540. data/public/images/body-back.png +0 -0
  541. data/public/images/bottom_shine.png +0 -0
  542. data/public/images/breadcrumb.gif +0 -0
  543. data/public/images/button-dark-hover.png +0 -0
  544. data/public/images/button-dark.png +0 -0
  545. data/public/images/buttons/bg-button-hover.png +0 -0
  546. data/public/images/buttons/bg-button-pressed.png +0 -0
  547. data/public/images/buttons/bg-button.gif +0 -0
  548. data/public/images/buttons/bg-button.png +0 -0
  549. data/public/images/buttons/blue/left_01.png +0 -0
  550. data/public/images/buttons/blue/right_01.png +0 -0
  551. data/public/images/buttons/button-dark-hover.png +0 -0
  552. data/public/images/buttons/button-dark.png +0 -0
  553. data/public/images/buttons/drag-handle-green.png +0 -0
  554. data/public/images/buttons/green/left_01.png +0 -0
  555. data/public/images/buttons/green/right_01.png +0 -0
  556. data/public/images/buttons/left_01.png +0 -0
  557. data/public/images/buttons/left_01_small.png +0 -0
  558. data/public/images/buttons/orange/left_03.png +0 -0
  559. data/public/images/buttons/orange/right_03.png +0 -0
  560. data/public/images/buttons/right_01.png +0 -0
  561. data/public/images/buttons/right_01_small.png +0 -0
  562. data/public/images/buttons/sxsw-ribbon-v1.png +0 -0
  563. data/public/images/buttons/top-shine.png +0 -0
  564. data/public/images/calendar_date_select/calendar.gif +0 -0
  565. data/public/images/cart-empty.png +0 -0
  566. data/public/images/cart-empty_x32.png +0 -0
  567. data/public/images/cart-full.png +0 -0
  568. data/public/images/cart-full_x32.png +0 -0
  569. data/public/images/datepicker/backstripes.gif +0 -0
  570. data/public/images/datepicker/bg_header.jpg +0 -0
  571. data/public/images/datepicker/bullet1.gif +0 -0
  572. data/public/images/datepicker/bullet2.gif +0 -0
  573. data/public/images/datepicker/gradient-e5e5e5-ffffff.gif +0 -0
  574. data/public/images/drag-handle-green.png +0 -0
  575. data/public/images/green/left_01.png +0 -0
  576. data/public/images/green/right_01.png +0 -0
  577. data/public/images/grid.png +0 -0
  578. data/public/images/left_01.png +0 -0
  579. data/public/images/left_01_small.png +0 -0
  580. data/public/images/menu-current.png +0 -0
  581. data/public/images/menu-hover.png +0 -0
  582. data/public/images/noimage/mini.jpg +0 -0
  583. data/public/images/noimage/product.jpg +0 -0
  584. data/public/images/noimage/small.jpg +0 -0
  585. data/public/images/openid-inputicon.gif +0 -0
  586. data/public/images/orange/left_03.png +0 -0
  587. data/public/images/orange/right_03.png +0 -0
  588. data/public/images/reorder.jpg +0 -0
  589. data/public/images/right_01.png +0 -0
  590. data/public/images/right_01_small.png +0 -0
  591. data/public/images/separator.png +0 -0
  592. data/public/images/shadow-top.png +0 -0
  593. data/public/images/shadow_top.png +0 -0
  594. data/public/images/spree.jpg +0 -0
  595. data/public/images/spree/progress.gif +0 -0
  596. data/public/images/spree/spinner.gif +0 -0
  597. data/public/images/spree/spree.jpg +0 -0
  598. data/public/images/step-progress/completed-completed.gif +0 -0
  599. data/public/images/step-progress/completed-current.gif +0 -0
  600. data/public/images/step-progress/completed-first.gif +0 -0
  601. data/public/images/step-progress/current-first.gif +0 -0
  602. data/public/images/step-progress/current-incomplete.gif +0 -0
  603. data/public/images/step-progress/current-right.gif +0 -0
  604. data/public/images/step-progress/incomplete-incomplete.gif +0 -0
  605. data/public/images/step-progress/incomplete-right.gif +0 -0
  606. data/public/images/steps/1.png +0 -0
  607. data/public/images/steps/1_small.png +0 -0
  608. data/public/images/steps/2.png +0 -0
  609. data/public/images/steps/2_small.png +0 -0
  610. data/public/images/steps/3.png +0 -0
  611. data/public/images/steps/3_small.png +0 -0
  612. data/public/images/steps/4.png +0 -0
  613. data/public/images/steps/4_small.png +0 -0
  614. data/public/images/steps/5.png +0 -0
  615. data/public/images/steps/5_small.png +0 -0
  616. data/public/images/steps/6.png +0 -0
  617. data/public/images/steps/6_small.png +0 -0
  618. data/public/images/sxsw-ribbon-v1.png +0 -0
  619. data/public/images/tab_bottom.gif +0 -0
  620. data/public/images/tile-header.png +0 -0
  621. data/public/images/tile-slider.png +0 -0
  622. data/public/images/top-shine.png +0 -0
  623. data/public/images/tree-nav-icons/bullet.gif +0 -0
  624. data/public/images/tree-nav-icons/minus.gif +0 -0
  625. data/public/images/tree-nav-icons/plus.gif +0 -0
  626. data/public/images/tree-nav-icons/treeview-loading.gif +0 -0
  627. data/public/images/tree-nav-icons/treeview-sprite.gif +0 -0
  628. data/public/images/wrapper-back-2.png +0 -0
  629. data/public/images/wrapper-back.png +0 -0
  630. data/public/images/yui-menubaritem_submenuindicator.png +0 -0
  631. data/public/images/yui-menubaritem_submenuindicator_disabled.png +0 -0
  632. data/public/images/yui-menuitem_checkbox.png +0 -0
  633. data/public/images/yui-menuitem_checkbox_disabled.png +0 -0
  634. data/public/images/yui-menuitem_submenuindicator.png +0 -0
  635. data/public/images/yui-menuitem_submenuindicator_disabled.png +0 -0
  636. data/public/images/yui-sprite.png +0 -0
  637. data/public/javascripts/additional-methods.js +0 -236
  638. data/public/javascripts/admin/orders/edit.js +0 -23
  639. data/public/javascripts/admin/orders/edit_form.js +0 -16
  640. data/public/javascripts/admin/unobtrusive_handlers.js +0 -43
  641. data/public/javascripts/application.js +0 -12
  642. data/public/javascripts/calculator.js +0 -15
  643. data/public/javascripts/checkout.js +0 -75
  644. data/public/javascripts/datepicker.js +0 -1445
  645. data/public/javascripts/gateway.js +0 -13
  646. data/public/javascripts/jquery-1.4.2.min.js +0 -154
  647. data/public/javascripts/jquery-ui.js +0 -188
  648. data/public/javascripts/jquery.cookie.js +0 -96
  649. data/public/javascripts/jquery.suggest.js +0 -276
  650. data/public/javascripts/jquery.template.js +0 -255
  651. data/public/javascripts/jquery.tokeninput.js +0 -618
  652. data/public/javascripts/jquery.validate.min.js +0 -16
  653. data/public/javascripts/lang/af.js +0 -40
  654. data/public/javascripts/lang/ar.js +0 -50
  655. data/public/javascripts/lang/de.js +0 -40
  656. data/public/javascripts/lang/du.js +0 -40
  657. data/public/javascripts/lang/en.js +0 -42
  658. data/public/javascripts/lang/es.js +0 -41
  659. data/public/javascripts/lang/fi.js +0 -40
  660. data/public/javascripts/lang/fr.js +0 -44
  661. data/public/javascripts/lang/gr.js +0 -40
  662. data/public/javascripts/lang/he.js +0 -49
  663. data/public/javascripts/lang/it.js +0 -13
  664. data/public/javascripts/lang/nl.js +0 -40
  665. data/public/javascripts/lang/no.js +0 -40
  666. data/public/javascripts/lang/pt.js +0 -50
  667. data/public/javascripts/lang/ro.js +0 -40
  668. data/public/javascripts/lang/ru.js +0 -40
  669. data/public/javascripts/lang/sp.js +0 -40
  670. data/public/javascripts/lang/sv.js +0 -41
  671. data/public/javascripts/lang/ua.js +0 -40
  672. data/public/javascripts/localization/messages_cn.js +0 -24
  673. data/public/javascripts/localization/messages_cs.js +0 -23
  674. data/public/javascripts/localization/messages_da.js +0 -21
  675. data/public/javascripts/localization/messages_de.js +0 -21
  676. data/public/javascripts/localization/messages_fr.js +0 -23
  677. data/public/javascripts/localization/messages_hu.js +0 -21
  678. data/public/javascripts/localization/messages_it.js +0 -26
  679. data/public/javascripts/localization/messages_kk.js +0 -23
  680. data/public/javascripts/localization/messages_nl.js +0 -23
  681. data/public/javascripts/localization/messages_no.js +0 -23
  682. data/public/javascripts/localization/messages_pl.js +0 -23
  683. data/public/javascripts/localization/messages_ptbr.js +0 -30
  684. data/public/javascripts/localization/messages_ru.js +0 -23
  685. data/public/javascripts/localization/messages_se.js +0 -23
  686. data/public/javascripts/localization/messages_sk.js +0 -21
  687. data/public/javascripts/localization/messages_tr.js +0 -24
  688. data/public/javascripts/localization/messages_tw.js +0 -24
  689. data/public/javascripts/localization/messages_ua.js +0 -24
  690. data/public/javascripts/nested-attribute.js +0 -26
  691. data/public/javascripts/open_id.js +0 -15
  692. data/public/javascripts/product.js +0 -49
  693. data/public/javascripts/rails.js +0 -127
  694. data/public/javascripts/taxonomy.js +0 -201
  695. data/public/javascripts/zone.js +0 -39
  696. data/public/stylesheets/admin/dashboard.css +0 -143
  697. data/public/stylesheets/admin/edit_checkouts.css +0 -57
  698. data/public/stylesheets/admin/reset-fonts-grids-2-6-0.css +0 -7
  699. data/public/stylesheets/admin/yui-includes.css +0 -14
  700. data/public/stylesheets/datepicker.css +0 -263
  701. data/public/stylesheets/jquery.autocomplete.css +0 -48
  702. data/public/stylesheets/screen.css +0 -916
@@ -42,9 +42,10 @@
42
42
  #vakata-dragged.jstree-apple ins { background:transparent !important; }
43
43
  #vakata-dragged.jstree-apple .jstree-ok { background:url("d.png") -2px -53px no-repeat !important; }
44
44
  #vakata-dragged.jstree-apple .jstree-invalid { background:url("d.png") -18px -53px no-repeat !important; }
45
- #jstree-marker.jstree-apple { background:url("d.png") -41px -57px no-repeat !important; }
45
+ #jstree-marker.jstree-apple { background:url("d.png") -41px -57px no-repeat !important; text-indent:-100px; }
46
46
 
47
47
  .jstree-apple a.jstree-search { color:aqua; }
48
+ .jstree-apple .jstree-locked a { color:silver; cursor:default; }
48
49
 
49
50
  #vakata-contextmenu.jstree-apple-context,
50
51
  #vakata-contextmenu.jstree-apple-context li ul { background:#f0f0f0; border:1px solid #979797; -moz-box-shadow: 1px 1px 2px #999; -webkit-box-shadow: 1px 1px 2px #999; box-shadow: 1px 1px 2px #999; }
@@ -0,0 +1,860 @@
1
+ /*
2
+ * jQuery Plugin: Tokenizing Autocomplete Text Entry
3
+ * Version 1.6.0
4
+ *
5
+ * Copyright (c) 2009 James Smith (http://loopj.com)
6
+ * Licensed jointly under the GPL and MIT licenses,
7
+ * choose which one suits your project best!
8
+ *
9
+ */
10
+
11
+ (function ($) {
12
+ // Default settings
13
+ var DEFAULT_SETTINGS = {
14
+ // Search settings
15
+ method: "GET",
16
+ contentType: "json",
17
+ queryParam: "q",
18
+ searchDelay: 300,
19
+ minChars: 1,
20
+ propertyToSearch: "name",
21
+ jsonContainer: null,
22
+
23
+ // Display settings
24
+ hintText: "Type in a search term",
25
+ noResultsText: "No results",
26
+ searchingText: "Searching...",
27
+ deleteText: "×",
28
+ animateDropdown: true,
29
+
30
+ // Tokenization settings
31
+ tokenLimit: null,
32
+ tokenDelimiter: ",",
33
+ preventDuplicates: false,
34
+
35
+ // Output settings
36
+ tokenValue: "id",
37
+
38
+ // Prepopulation settings
39
+ prePopulate: null,
40
+ processPrePopulate: false,
41
+
42
+ // Manipulation settings
43
+ idPrefix: "token-input-",
44
+
45
+ // Formatters
46
+ resultsFormatter: function(item){ return "<li>" + item[this.propertyToSearch]+ "</li>" },
47
+ tokenFormatter: function(item) { return "<li><p>" + item[this.propertyToSearch] + "</p></li>" },
48
+
49
+ // Callbacks
50
+ onResult: null,
51
+ onAdd: null,
52
+ onDelete: null,
53
+ onReady: null
54
+ };
55
+
56
+ // Default classes to use when theming
57
+ var DEFAULT_CLASSES = {
58
+ tokenList: "token-input-list",
59
+ token: "token-input-token",
60
+ tokenDelete: "token-input-delete-token",
61
+ selectedToken: "token-input-selected-token",
62
+ highlightedToken: "token-input-highlighted-token",
63
+ dropdown: "token-input-dropdown",
64
+ dropdownItem: "token-input-dropdown-item",
65
+ dropdownItem2: "token-input-dropdown-item2",
66
+ selectedDropdownItem: "token-input-selected-dropdown-item",
67
+ inputToken: "token-input-input-token"
68
+ };
69
+
70
+ // Input box position "enum"
71
+ var POSITION = {
72
+ BEFORE: 0,
73
+ AFTER: 1,
74
+ END: 2
75
+ };
76
+
77
+ // Keys "enum"
78
+ var KEY = {
79
+ BACKSPACE: 8,
80
+ TAB: 9,
81
+ ENTER: 13,
82
+ ESCAPE: 27,
83
+ SPACE: 32,
84
+ PAGE_UP: 33,
85
+ PAGE_DOWN: 34,
86
+ END: 35,
87
+ HOME: 36,
88
+ LEFT: 37,
89
+ UP: 38,
90
+ RIGHT: 39,
91
+ DOWN: 40,
92
+ NUMPAD_ENTER: 108,
93
+ COMMA: 188
94
+ };
95
+
96
+ // Additional public (exposed) methods
97
+ var methods = {
98
+ init: function(url_or_data_or_function, options) {
99
+ var settings = $.extend({}, DEFAULT_SETTINGS, options || {});
100
+
101
+ return this.each(function () {
102
+ $(this).data("tokenInputObject", new $.TokenList(this, url_or_data_or_function, settings));
103
+ });
104
+ },
105
+ clear: function() {
106
+ this.data("tokenInputObject").clear();
107
+ return this;
108
+ },
109
+ add: function(item) {
110
+ this.data("tokenInputObject").add(item);
111
+ return this;
112
+ },
113
+ remove: function(item) {
114
+ this.data("tokenInputObject").remove(item);
115
+ return this;
116
+ },
117
+ get: function() {
118
+ return this.data("tokenInputObject").getTokens();
119
+ }
120
+ }
121
+
122
+ // Expose the .tokenInput function to jQuery as a plugin
123
+ $.fn.tokenInput = function (method) {
124
+ // Method calling and initialization logic
125
+ if(methods[method]) {
126
+ return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
127
+ } else {
128
+ return methods.init.apply(this, arguments);
129
+ }
130
+ };
131
+
132
+ // TokenList class for each input
133
+ $.TokenList = function (input, url_or_data, settings) {
134
+ //
135
+ // Initialization
136
+ //
137
+
138
+ // Configure the data source
139
+ if($.type(url_or_data) === "string" || $.type(url_or_data) === "function") {
140
+ // Set the url to query against
141
+ settings.url = url_or_data;
142
+
143
+ // If the URL is a function, evaluate it here to do our initalization work
144
+ var url = computeURL();
145
+
146
+ // Make a smart guess about cross-domain if it wasn't explicitly specified
147
+ if(settings.crossDomain === undefined) {
148
+ if(url.indexOf("://") === -1) {
149
+ settings.crossDomain = false;
150
+ } else {
151
+ settings.crossDomain = (location.href.split(/\/+/g)[1] !== url.split(/\/+/g)[1]);
152
+ }
153
+ }
154
+ } else if(typeof(url_or_data) === "object") {
155
+ // Set the local data to search through
156
+ settings.local_data = url_or_data;
157
+ }
158
+
159
+ // Build class names
160
+ if(settings.classes) {
161
+ // Use custom class names
162
+ settings.classes = $.extend({}, DEFAULT_CLASSES, settings.classes);
163
+ } else if(settings.theme) {
164
+ // Use theme-suffixed default class names
165
+ settings.classes = {};
166
+ $.each(DEFAULT_CLASSES, function(key, value) {
167
+ settings.classes[key] = value + "-" + settings.theme;
168
+ });
169
+ } else {
170
+ settings.classes = DEFAULT_CLASSES;
171
+ }
172
+
173
+
174
+ // Save the tokens
175
+ var saved_tokens = [];
176
+
177
+ // Keep track of the number of tokens in the list
178
+ var token_count = 0;
179
+
180
+ // Basic cache to save on db hits
181
+ var cache = new $.TokenList.Cache();
182
+
183
+ // Keep track of the timeout, old vals
184
+ var timeout;
185
+ var input_val;
186
+
187
+ // Create a new text input an attach keyup events
188
+ var input_box = $("<input type=\"text\" autocomplete=\"off\">")
189
+ .css({
190
+ outline: "none"
191
+ })
192
+ .attr("id", settings.idPrefix + input.id)
193
+ .focus(function () {
194
+ if (settings.tokenLimit === null || settings.tokenLimit !== token_count) {
195
+ show_dropdown_hint();
196
+ }
197
+ })
198
+ .blur(function () {
199
+ hide_dropdown();
200
+ $(this).val("");
201
+ })
202
+ .bind("keyup keydown blur update", resize_input)
203
+ .keydown(function (event) {
204
+ var previous_token;
205
+ var next_token;
206
+
207
+ switch(event.keyCode) {
208
+ case KEY.LEFT:
209
+ case KEY.RIGHT:
210
+ case KEY.UP:
211
+ case KEY.DOWN:
212
+ if(!$(this).val()) {
213
+ previous_token = input_token.prev();
214
+ next_token = input_token.next();
215
+
216
+ if((previous_token.length && previous_token.get(0) === selected_token) || (next_token.length && next_token.get(0) === selected_token)) {
217
+ // Check if there is a previous/next token and it is selected
218
+ if(event.keyCode === KEY.LEFT || event.keyCode === KEY.UP) {
219
+ deselect_token($(selected_token), POSITION.BEFORE);
220
+ } else {
221
+ deselect_token($(selected_token), POSITION.AFTER);
222
+ }
223
+ } else if((event.keyCode === KEY.LEFT || event.keyCode === KEY.UP) && previous_token.length) {
224
+ // We are moving left, select the previous token if it exists
225
+ select_token($(previous_token.get(0)));
226
+ } else if((event.keyCode === KEY.RIGHT || event.keyCode === KEY.DOWN) && next_token.length) {
227
+ // We are moving right, select the next token if it exists
228
+ select_token($(next_token.get(0)));
229
+ }
230
+ } else {
231
+ var dropdown_item = null;
232
+
233
+ if(event.keyCode === KEY.DOWN || event.keyCode === KEY.RIGHT) {
234
+ dropdown_item = $(selected_dropdown_item).next();
235
+ } else {
236
+ dropdown_item = $(selected_dropdown_item).prev();
237
+ }
238
+
239
+ if(dropdown_item.length) {
240
+ select_dropdown_item(dropdown_item);
241
+ }
242
+ return false;
243
+ }
244
+ break;
245
+
246
+ case KEY.BACKSPACE:
247
+ previous_token = input_token.prev();
248
+
249
+ if(!$(this).val().length) {
250
+ if(selected_token) {
251
+ delete_token($(selected_token));
252
+ hidden_input.change();
253
+ } else if(previous_token.length) {
254
+ select_token($(previous_token.get(0)));
255
+ }
256
+
257
+ return false;
258
+ } else if($(this).val().length === 1) {
259
+ hide_dropdown();
260
+ } else {
261
+ // set a timeout just long enough to let this function finish.
262
+ setTimeout(function(){do_search();}, 5);
263
+ }
264
+ break;
265
+
266
+ case KEY.TAB:
267
+ case KEY.ENTER:
268
+ case KEY.NUMPAD_ENTER:
269
+ case KEY.COMMA:
270
+ if(selected_dropdown_item) {
271
+ add_token($(selected_dropdown_item).data("tokeninput"));
272
+ hidden_input.change();
273
+ return false;
274
+ }
275
+ break;
276
+
277
+ case KEY.ESCAPE:
278
+ hide_dropdown();
279
+ return true;
280
+
281
+ default:
282
+ if(String.fromCharCode(event.which)) {
283
+ // set a timeout just long enough to let this function finish.
284
+ setTimeout(function(){do_search();}, 5);
285
+ }
286
+ break;
287
+ }
288
+ });
289
+
290
+ // Keep a reference to the original input box
291
+ var hidden_input = $(input)
292
+ .hide()
293
+ .val("")
294
+ .focus(function () {
295
+ input_box.focus();
296
+ })
297
+ .blur(function () {
298
+ input_box.blur();
299
+ });
300
+
301
+ // Keep a reference to the selected token and dropdown item
302
+ var selected_token = null;
303
+ var selected_token_index = 0;
304
+ var selected_dropdown_item = null;
305
+
306
+ // The list to store the token items in
307
+ var token_list = $("<ul />")
308
+ .addClass(settings.classes.tokenList)
309
+ .click(function (event) {
310
+ var li = $(event.target).closest("li");
311
+ if(li && li.get(0) && $.data(li.get(0), "tokeninput")) {
312
+ toggle_select_token(li);
313
+ } else {
314
+ // Deselect selected token
315
+ if(selected_token) {
316
+ deselect_token($(selected_token), POSITION.END);
317
+ }
318
+
319
+ // Focus input box
320
+ input_box.focus();
321
+ }
322
+ })
323
+ .mouseover(function (event) {
324
+ var li = $(event.target).closest("li");
325
+ if(li && selected_token !== this) {
326
+ li.addClass(settings.classes.highlightedToken);
327
+ }
328
+ })
329
+ .mouseout(function (event) {
330
+ var li = $(event.target).closest("li");
331
+ if(li && selected_token !== this) {
332
+ li.removeClass(settings.classes.highlightedToken);
333
+ }
334
+ })
335
+ .insertBefore(hidden_input);
336
+
337
+ // The token holding the input box
338
+ var input_token = $("<li />")
339
+ .addClass(settings.classes.inputToken)
340
+ .appendTo(token_list)
341
+ .append(input_box);
342
+
343
+ // The list to store the dropdown items in
344
+ var dropdown = $("<div>")
345
+ .addClass(settings.classes.dropdown)
346
+ .appendTo("body")
347
+ .hide();
348
+
349
+ // Magic element to help us resize the text input
350
+ var input_resizer = $("<tester/>")
351
+ .insertAfter(input_box)
352
+ .css({
353
+ position: "absolute",
354
+ top: -9999,
355
+ left: -9999,
356
+ width: "auto",
357
+ fontSize: input_box.css("fontSize"),
358
+ fontFamily: input_box.css("fontFamily"),
359
+ fontWeight: input_box.css("fontWeight"),
360
+ letterSpacing: input_box.css("letterSpacing"),
361
+ whiteSpace: "nowrap"
362
+ });
363
+
364
+ // Pre-populate list if items exist
365
+ hidden_input.val("");
366
+ var li_data = settings.prePopulate || hidden_input.data("pre");
367
+ if(settings.processPrePopulate && $.isFunction(settings.onResult)) {
368
+ li_data = settings.onResult.call(hidden_input, li_data);
369
+ }
370
+ if(li_data && li_data.length) {
371
+ $.each(li_data, function (index, value) {
372
+ insert_token(value);
373
+ checkTokenLimit();
374
+ });
375
+ }
376
+
377
+ // Initialization is done
378
+ if($.isFunction(settings.onReady)) {
379
+ settings.onReady.call();
380
+ }
381
+
382
+ //
383
+ // Public functions
384
+ //
385
+
386
+ this.clear = function() {
387
+ token_list.children("li").each(function() {
388
+ if ($(this).children("input").length === 0) {
389
+ delete_token($(this));
390
+ }
391
+ });
392
+ }
393
+
394
+ this.add = function(item) {
395
+ add_token(item);
396
+ }
397
+
398
+ this.remove = function(item) {
399
+ token_list.children("li").each(function() {
400
+ if ($(this).children("input").length === 0) {
401
+ var currToken = $(this).data("tokeninput");
402
+ var match = true;
403
+ for (var prop in item) {
404
+ if (item[prop] !== currToken[prop]) {
405
+ match = false;
406
+ break;
407
+ }
408
+ }
409
+ if (match) {
410
+ delete_token($(this));
411
+ }
412
+ }
413
+ });
414
+ }
415
+
416
+ this.getTokens = function() {
417
+ return saved_tokens;
418
+ }
419
+
420
+ //
421
+ // Private functions
422
+ //
423
+
424
+ function checkTokenLimit() {
425
+ if(settings.tokenLimit !== null && token_count >= settings.tokenLimit) {
426
+ input_box.hide();
427
+ hide_dropdown();
428
+ return;
429
+ }
430
+ }
431
+
432
+ function resize_input() {
433
+ if(input_val === (input_val = input_box.val())) {return;}
434
+
435
+ // Enter new content into resizer and resize input accordingly
436
+ var escaped = input_val.replace(/&/g, '&amp;').replace(/\s/g,' ').replace(/</g, '&lt;').replace(/>/g, '&gt;');
437
+ input_resizer.html(escaped);
438
+ input_box.width(input_resizer.width() + 30);
439
+ }
440
+
441
+ function is_printable_character(keycode) {
442
+ return ((keycode >= 48 && keycode <= 90) || // 0-1a-z
443
+ (keycode >= 96 && keycode <= 111) || // numpad 0-9 + - / * .
444
+ (keycode >= 186 && keycode <= 192) || // ; = , - . / ^
445
+ (keycode >= 219 && keycode <= 222)); // ( \ ) '
446
+ }
447
+
448
+ // Inner function to a token to the list
449
+ function insert_token(item) {
450
+ var this_token = settings.tokenFormatter(item);
451
+ this_token = $(this_token)
452
+ .addClass(settings.classes.token)
453
+ .insertBefore(input_token);
454
+
455
+ // The 'delete token' button
456
+ $("<span>" + settings.deleteText + "</span>")
457
+ .addClass(settings.classes.tokenDelete)
458
+ .appendTo(this_token)
459
+ .click(function () {
460
+ delete_token($(this).parent());
461
+ hidden_input.change();
462
+ return false;
463
+ });
464
+
465
+ // Store data on the token
466
+ var token_data = {"id": item.id};
467
+ token_data[settings.propertyToSearch] = item[settings.propertyToSearch];
468
+ $.data(this_token.get(0), "tokeninput", item);
469
+
470
+ // Save this token for duplicate checking
471
+ saved_tokens = saved_tokens.slice(0,selected_token_index).concat([token_data]).concat(saved_tokens.slice(selected_token_index));
472
+ selected_token_index++;
473
+
474
+ // Update the hidden input
475
+ update_hidden_input(saved_tokens, hidden_input);
476
+
477
+ token_count += 1;
478
+
479
+ // Check the token limit
480
+ if(settings.tokenLimit !== null && token_count >= settings.tokenLimit) {
481
+ input_box.hide();
482
+ hide_dropdown();
483
+ }
484
+
485
+ return this_token;
486
+ }
487
+
488
+ // Add a token to the token list based on user input
489
+ function add_token (item) {
490
+ var callback = settings.onAdd;
491
+
492
+ // See if the token already exists and select it if we don't want duplicates
493
+ if(token_count > 0 && settings.preventDuplicates) {
494
+ var found_existing_token = null;
495
+ token_list.children().each(function () {
496
+ var existing_token = $(this);
497
+ var existing_data = $.data(existing_token.get(0), "tokeninput");
498
+ if(existing_data && existing_data.id === item.id) {
499
+ found_existing_token = existing_token;
500
+ return false;
501
+ }
502
+ });
503
+
504
+ if(found_existing_token) {
505
+ select_token(found_existing_token);
506
+ input_token.insertAfter(found_existing_token);
507
+ input_box.focus();
508
+ return;
509
+ }
510
+ }
511
+
512
+ // Insert the new tokens
513
+ if(settings.tokenLimit == null || token_count < settings.tokenLimit) {
514
+ insert_token(item);
515
+ checkTokenLimit();
516
+ }
517
+
518
+ // Clear input box
519
+ input_box.val("");
520
+
521
+ // Don't show the help dropdown, they've got the idea
522
+ hide_dropdown();
523
+
524
+ // Execute the onAdd callback if defined
525
+ if($.isFunction(callback)) {
526
+ callback.call(hidden_input,item);
527
+ }
528
+ }
529
+
530
+ // Select a token in the token list
531
+ function select_token (token) {
532
+ token.addClass(settings.classes.selectedToken);
533
+ selected_token = token.get(0);
534
+
535
+ // Hide input box
536
+ input_box.val("");
537
+
538
+ // Hide dropdown if it is visible (eg if we clicked to select token)
539
+ hide_dropdown();
540
+ }
541
+
542
+ // Deselect a token in the token list
543
+ function deselect_token (token, position) {
544
+ token.removeClass(settings.classes.selectedToken);
545
+ selected_token = null;
546
+
547
+ if(position === POSITION.BEFORE) {
548
+ input_token.insertBefore(token);
549
+ selected_token_index--;
550
+ } else if(position === POSITION.AFTER) {
551
+ input_token.insertAfter(token);
552
+ selected_token_index++;
553
+ } else {
554
+ input_token.appendTo(token_list);
555
+ selected_token_index = token_count;
556
+ }
557
+
558
+ // Show the input box and give it focus again
559
+ input_box.focus();
560
+ }
561
+
562
+ // Toggle selection of a token in the token list
563
+ function toggle_select_token(token) {
564
+ var previous_selected_token = selected_token;
565
+
566
+ if(selected_token) {
567
+ deselect_token($(selected_token), POSITION.END);
568
+ }
569
+
570
+ if(previous_selected_token === token.get(0)) {
571
+ deselect_token(token, POSITION.END);
572
+ } else {
573
+ select_token(token);
574
+ }
575
+ }
576
+
577
+ // Delete a token from the token list
578
+ function delete_token (token) {
579
+ // Remove the id from the saved list
580
+ var token_data = $.data(token.get(0), "tokeninput");
581
+ var callback = settings.onDelete;
582
+
583
+ var index = token.prevAll().length;
584
+ if(index > selected_token_index) index--;
585
+
586
+ // Delete the token
587
+ token.remove();
588
+ selected_token = null;
589
+
590
+ // Show the input box and give it focus again
591
+ input_box.focus();
592
+
593
+ // Remove this token from the saved list
594
+ saved_tokens = saved_tokens.slice(0,index).concat(saved_tokens.slice(index+1));
595
+ if(index < selected_token_index) selected_token_index--;
596
+
597
+ // Update the hidden input
598
+ update_hidden_input(saved_tokens, hidden_input);
599
+
600
+ token_count -= 1;
601
+
602
+ if(settings.tokenLimit !== null) {
603
+ input_box
604
+ .show()
605
+ .val("")
606
+ .focus();
607
+ }
608
+
609
+ // Execute the onDelete callback if defined
610
+ if($.isFunction(callback)) {
611
+ callback.call(hidden_input,token_data);
612
+ }
613
+ }
614
+
615
+ // Update the hidden input box value
616
+ function update_hidden_input(saved_tokens, hidden_input) {
617
+ var token_values = $.map(saved_tokens, function (el) {
618
+ return el[settings.tokenValue];
619
+ });
620
+ hidden_input.val(token_values.join(settings.tokenDelimiter));
621
+
622
+ }
623
+
624
+ // Hide and clear the results dropdown
625
+ function hide_dropdown () {
626
+ dropdown.hide().empty();
627
+ selected_dropdown_item = null;
628
+ }
629
+
630
+ function show_dropdown() {
631
+ dropdown
632
+ .css({
633
+ position: "absolute",
634
+ top: $(token_list).offset().top + $(token_list).outerHeight(),
635
+ left: $(token_list).offset().left,
636
+ zindex: 999
637
+ })
638
+ .show();
639
+ }
640
+
641
+ function show_dropdown_searching () {
642
+ if(settings.searchingText) {
643
+ dropdown.html("<p>"+settings.searchingText+"</p>");
644
+ show_dropdown();
645
+ }
646
+ }
647
+
648
+ function show_dropdown_hint () {
649
+ if(settings.hintText) {
650
+ dropdown.html("<p>"+settings.hintText+"</p>");
651
+ show_dropdown();
652
+ }
653
+ }
654
+
655
+ // Highlight the query part of the search term
656
+ function highlight_term(value, term) {
657
+ return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<b>$1</b>");
658
+ }
659
+
660
+ function find_value_and_highlight_term(template, value, term) {
661
+ return template.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + value + ")(?![^<>]*>)(?![^&;]+;)", "g"), highlight_term(value, term));
662
+ }
663
+
664
+ // Populate the results dropdown with some results
665
+ function populate_dropdown (query, results) {
666
+ if(results && results.length) {
667
+ dropdown.empty();
668
+ var dropdown_ul = $("<ul>")
669
+ .appendTo(dropdown)
670
+ .mouseover(function (event) {
671
+ select_dropdown_item($(event.target).closest("li"));
672
+ })
673
+ .mousedown(function (event) {
674
+ add_token($(event.target).closest("li").data("tokeninput"));
675
+ hidden_input.change();
676
+ return false;
677
+ })
678
+ .hide();
679
+
680
+ $.each(results, function(index, value) {
681
+ var this_li = settings.resultsFormatter(value);
682
+
683
+ this_li = find_value_and_highlight_term(this_li ,value[settings.propertyToSearch], query);
684
+
685
+ this_li = $(this_li).appendTo(dropdown_ul);
686
+
687
+ if(index % 2) {
688
+ this_li.addClass(settings.classes.dropdownItem);
689
+ } else {
690
+ this_li.addClass(settings.classes.dropdownItem2);
691
+ }
692
+
693
+ if(index === 0) {
694
+ select_dropdown_item(this_li);
695
+ }
696
+
697
+ $.data(this_li.get(0), "tokeninput", value);
698
+ });
699
+
700
+ show_dropdown();
701
+
702
+ if(settings.animateDropdown) {
703
+ dropdown_ul.slideDown("fast");
704
+ } else {
705
+ dropdown_ul.show();
706
+ }
707
+ } else {
708
+ if(settings.noResultsText) {
709
+ dropdown.html("<p>"+settings.noResultsText+"</p>");
710
+ show_dropdown();
711
+ }
712
+ }
713
+ }
714
+
715
+ // Highlight an item in the results dropdown
716
+ function select_dropdown_item (item) {
717
+ if(item) {
718
+ if(selected_dropdown_item) {
719
+ deselect_dropdown_item($(selected_dropdown_item));
720
+ }
721
+
722
+ item.addClass(settings.classes.selectedDropdownItem);
723
+ selected_dropdown_item = item.get(0);
724
+ }
725
+ }
726
+
727
+ // Remove highlighting from an item in the results dropdown
728
+ function deselect_dropdown_item (item) {
729
+ item.removeClass(settings.classes.selectedDropdownItem);
730
+ selected_dropdown_item = null;
731
+ }
732
+
733
+ // Do a search and show the "searching" dropdown if the input is longer
734
+ // than settings.minChars
735
+ function do_search() {
736
+ var query = input_box.val().toLowerCase();
737
+
738
+ if(query && query.length) {
739
+ if(selected_token) {
740
+ deselect_token($(selected_token), POSITION.AFTER);
741
+ }
742
+
743
+ if(query.length >= settings.minChars) {
744
+ show_dropdown_searching();
745
+ clearTimeout(timeout);
746
+
747
+ timeout = setTimeout(function(){
748
+ run_search(query);
749
+ }, settings.searchDelay);
750
+ } else {
751
+ hide_dropdown();
752
+ }
753
+ }
754
+ }
755
+
756
+ // Do the actual search
757
+ function run_search(query) {
758
+ var cache_key = query + computeURL();
759
+ var cached_results = cache.get(cache_key);
760
+ if(cached_results) {
761
+ populate_dropdown(query, cached_results);
762
+ } else {
763
+ // Are we doing an ajax search or local data search?
764
+ if(settings.url) {
765
+ var url = computeURL();
766
+ // Extract exisiting get params
767
+ var ajax_params = {};
768
+ ajax_params.data = {};
769
+ if(url.indexOf("?") > -1) {
770
+ var parts = url.split("?");
771
+ ajax_params.url = parts[0];
772
+
773
+ var param_array = parts[1].split("&");
774
+ $.each(param_array, function (index, value) {
775
+ var kv = value.split("=");
776
+ ajax_params.data[kv[0]] = kv[1];
777
+ });
778
+ } else {
779
+ ajax_params.url = url;
780
+ }
781
+
782
+ // Prepare the request
783
+ ajax_params.data[settings.queryParam] = query;
784
+ ajax_params.type = settings.method;
785
+ ajax_params.dataType = settings.contentType;
786
+ if(settings.crossDomain) {
787
+ ajax_params.dataType = "jsonp";
788
+ }
789
+
790
+ // Attach the success callback
791
+ ajax_params.success = function(results) {
792
+ if($.isFunction(settings.onResult)) {
793
+ results = settings.onResult.call(hidden_input, results);
794
+ }
795
+ cache.add(cache_key, settings.jsonContainer ? results[settings.jsonContainer] : results);
796
+
797
+ // only populate the dropdown if the results are associated with the active search query
798
+ if(input_box.val().toLowerCase() === query) {
799
+ populate_dropdown(query, settings.jsonContainer ? results[settings.jsonContainer] : results);
800
+ }
801
+ };
802
+
803
+ // Make the request
804
+ $.ajax(ajax_params);
805
+ } else if(settings.local_data) {
806
+ // Do the search through local data
807
+ var results = $.grep(settings.local_data, function (row) {
808
+ return row[settings.propertyToSearch].toLowerCase().indexOf(query.toLowerCase()) > -1;
809
+ });
810
+
811
+ if($.isFunction(settings.onResult)) {
812
+ results = settings.onResult.call(hidden_input, results);
813
+ }
814
+ cache.add(cache_key, results);
815
+ populate_dropdown(query, results);
816
+ }
817
+ }
818
+ }
819
+
820
+ // compute the dynamic URL
821
+ function computeURL() {
822
+ var url = settings.url;
823
+ if(typeof settings.url == 'function') {
824
+ url = settings.url.call();
825
+ }
826
+ return url;
827
+ }
828
+ };
829
+
830
+ // Really basic cache for the results
831
+ $.TokenList.Cache = function (options) {
832
+ var settings = $.extend({
833
+ max_size: 500
834
+ }, options);
835
+
836
+ var data = {};
837
+ var size = 0;
838
+
839
+ var flush = function () {
840
+ data = {};
841
+ size = 0;
842
+ };
843
+
844
+ this.add = function (query, results) {
845
+ if(size > settings.max_size) {
846
+ flush();
847
+ }
848
+
849
+ if(!data[query]) {
850
+ size += 1;
851
+ }
852
+
853
+ data[query] = results;
854
+ };
855
+
856
+ this.get = function (query) {
857
+ return data[query];
858
+ };
859
+ };
860
+ }(jQuery));