spree_backend 3.1.14 → 3.2.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (309) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/admin/logo.png +0 -0
  3. data/app/assets/javascripts/spree/backend/admin.js +2 -25
  4. data/app/assets/javascripts/spree/backend/checkouts/edit.js +2 -1
  5. data/app/assets/javascripts/spree/backend/line_items.js.coffee +2 -2
  6. data/app/assets/javascripts/spree/backend/line_items_on_order_edit.js +5 -2
  7. data/app/assets/javascripts/spree/backend/option_type_autocomplete.js +2 -2
  8. data/app/assets/javascripts/spree/backend/option_value_picker.js +2 -2
  9. data/app/assets/javascripts/spree/backend/payments/edit.js.coffee +10 -8
  10. data/app/assets/javascripts/spree/backend/product_picker.js +3 -2
  11. data/app/assets/javascripts/spree/backend/{shipments.js.erb → shipments.js} +1 -1
  12. data/app/assets/javascripts/spree/backend/states.js +9 -7
  13. data/app/assets/javascripts/spree/backend/stock_location.js +3 -0
  14. data/app/assets/javascripts/spree/backend/tag_picker.js +52 -0
  15. data/app/assets/javascripts/spree/backend/taxon_autocomplete.js +2 -2
  16. data/app/assets/javascripts/spree/backend/taxon_permalink_preview.js +12 -0
  17. data/app/assets/javascripts/spree/backend/taxonomy.js.coffee +2 -2
  18. data/app/assets/javascripts/spree/backend/taxons.js.coffee +1 -1
  19. data/app/assets/javascripts/spree/backend/user_picker.js +4 -3
  20. data/app/assets/javascripts/spree/backend.js +8 -7
  21. data/app/assets/stylesheets/spree/backend/components/_main.scss +5 -1
  22. data/app/assets/stylesheets/spree/backend/components/_sidebar.scss +7 -0
  23. data/app/assets/stylesheets/spree/backend/shared/_forms.scss +1 -1
  24. data/app/assets/stylesheets/spree/backend/spree_admin.css.scss +0 -1
  25. data/app/controllers/spree/admin/base_controller.rb +0 -11
  26. data/app/controllers/spree/admin/option_types_controller.rb +2 -14
  27. data/app/controllers/spree/admin/option_values_controller.rb +1 -1
  28. data/app/controllers/spree/admin/orders_controller.rb +7 -7
  29. data/app/controllers/spree/admin/payment_methods_controller.rb +4 -0
  30. data/app/controllers/spree/admin/product_properties_controller.rb +1 -1
  31. data/app/controllers/spree/admin/products_controller.rb +1 -1
  32. data/app/controllers/spree/admin/promotion_actions_controller.rb +5 -5
  33. data/app/controllers/spree/admin/promotion_rules_controller.rb +6 -6
  34. data/app/controllers/spree/admin/promotions_controller.rb +2 -2
  35. data/app/controllers/spree/admin/properties_controller.rb +1 -1
  36. data/app/controllers/spree/admin/prototypes_controller.rb +2 -2
  37. data/app/controllers/spree/admin/refunds_controller.rb +1 -1
  38. data/app/controllers/spree/admin/reimbursement_types_controller.rb +26 -0
  39. data/app/controllers/spree/admin/reimbursements_controller.rb +1 -1
  40. data/app/controllers/spree/admin/reports_controller.rb +1 -1
  41. data/app/controllers/spree/admin/resource_controller.rb +8 -8
  42. data/app/controllers/spree/admin/return_authorizations_controller.rb +3 -3
  43. data/app/controllers/spree/admin/return_index_controller.rb +1 -1
  44. data/app/controllers/spree/admin/shipping_methods_controller.rb +2 -2
  45. data/app/controllers/spree/admin/states_controller.rb +1 -1
  46. data/app/controllers/spree/admin/stock_items_controller.rb +2 -2
  47. data/app/controllers/spree/admin/stock_movements_controller.rb +1 -5
  48. data/app/controllers/spree/admin/store_credits_controller.rb +1 -1
  49. data/app/controllers/spree/admin/taxons_controller.rb +1 -10
  50. data/app/controllers/spree/admin/users_controller.rb +5 -41
  51. data/app/controllers/spree/admin/variants_controller.rb +3 -1
  52. data/app/helpers/spree/admin/base_helper.rb +1 -6
  53. data/app/helpers/spree/admin/navigation_helper.rb +9 -31
  54. data/app/helpers/spree/admin/promotion_rules_helper.rb +12 -0
  55. data/app/views/kaminari/_first_page.html.erb +1 -1
  56. data/app/views/kaminari/_last_page.html.erb +1 -1
  57. data/app/views/kaminari/_next_page.html.erb +1 -1
  58. data/app/views/kaminari/_page.html.erb +1 -1
  59. data/app/views/kaminari/_paginator.html.erb +2 -4
  60. data/app/views/kaminari/_prev_page.html.erb +1 -1
  61. data/app/views/spree/admin/adjustments/_adjustments_table.html.erb +1 -1
  62. data/app/views/spree/admin/adjustments/_form.html.erb +4 -4
  63. data/app/views/spree/admin/countries/_form.html.erb +2 -2
  64. data/app/views/spree/admin/countries/edit.html.erb +3 -3
  65. data/app/views/spree/admin/countries/index.html.erb +3 -3
  66. data/app/views/spree/admin/countries/new.html.erb +3 -3
  67. data/app/views/spree/admin/customer_returns/new.html.erb +1 -1
  68. data/app/views/spree/admin/images/_form.html.erb +2 -2
  69. data/app/views/spree/admin/option_types/_form.html.erb +2 -2
  70. data/app/views/spree/admin/option_types/edit.html.erb +5 -5
  71. data/app/views/spree/admin/option_types/new.html.erb +3 -3
  72. data/app/views/spree/admin/orders/_adjustments.html.erb +6 -4
  73. data/app/views/spree/admin/orders/_form.html.erb +1 -1
  74. data/app/views/spree/admin/orders/_line_items.html.erb +8 -6
  75. data/app/views/spree/admin/orders/_line_items_edit_form.html.erb +1 -1
  76. data/app/views/spree/admin/orders/_shipment.html.erb +9 -7
  77. data/app/views/spree/admin/orders/cart.html.erb +0 -4
  78. data/app/views/spree/admin/orders/edit.html.erb +0 -4
  79. data/app/views/spree/admin/orders/index.html.erb +20 -20
  80. data/app/views/spree/admin/payment_methods/_form.html.erb +5 -5
  81. data/app/views/spree/admin/payment_methods/index.html.erb +3 -3
  82. data/app/views/spree/admin/payments/_form.html.erb +6 -6
  83. data/app/views/spree/admin/payments/source_forms/_gateway.html.erb +6 -6
  84. data/app/views/spree/admin/products/_form.html.erb +14 -8
  85. data/app/views/spree/admin/products/_properties_form.erb +1 -1
  86. data/app/views/spree/admin/products/index.html.erb +6 -6
  87. data/app/views/spree/admin/products/new.html.erb +16 -16
  88. data/app/views/spree/admin/promotion_categories/_form.html.erb +3 -3
  89. data/app/views/spree/admin/promotion_categories/edit.html.erb +3 -3
  90. data/app/views/spree/admin/promotion_categories/index.html.erb +3 -3
  91. data/app/views/spree/admin/promotion_categories/new.html.erb +3 -3
  92. data/app/views/spree/admin/promotions/_actions.html.erb +4 -4
  93. data/app/views/spree/admin/promotions/_form.html.erb +10 -10
  94. data/app/views/spree/admin/promotions/_promotion_rule.html.erb +1 -1
  95. data/app/views/spree/admin/promotions/_rules.html.erb +4 -4
  96. data/app/views/spree/admin/promotions/actions/_create_adjustment.html.erb +1 -1
  97. data/app/views/spree/admin/promotions/actions/_create_item_adjustments.html.erb +2 -2
  98. data/app/views/spree/admin/promotions/actions/_create_line_items.html.erb +1 -1
  99. data/app/views/spree/admin/promotions/edit.html.erb +6 -6
  100. data/app/views/spree/admin/promotions/index.html.erb +5 -5
  101. data/app/views/spree/admin/promotions/new.html.erb +3 -3
  102. data/app/views/spree/admin/promotions/rules/_country.html.erb +6 -0
  103. data/app/views/spree/admin/promotions/rules/_landing_page.html.erb +1 -1
  104. data/app/views/spree/admin/promotions/rules/_product.html.erb +2 -2
  105. data/app/views/spree/admin/promotions/rules/_taxon.html.erb +2 -2
  106. data/app/views/spree/admin/properties/_form.html.erb +2 -2
  107. data/app/views/spree/admin/properties/edit.html.erb +3 -3
  108. data/app/views/spree/admin/properties/index.html.erb +6 -6
  109. data/app/views/spree/admin/prototypes/_prototypes.html.erb +1 -1
  110. data/app/views/spree/admin/prototypes/available.js.erb +1 -1
  111. data/app/views/spree/admin/prototypes/edit.html.erb +3 -3
  112. data/app/views/spree/admin/prototypes/index.html.erb +3 -3
  113. data/app/views/spree/admin/prototypes/new.html.erb +3 -3
  114. data/app/views/spree/admin/prototypes/show.html.erb +1 -1
  115. data/app/views/spree/admin/refunds/edit.html.erb +2 -0
  116. data/app/views/spree/admin/refunds/new.html.erb +2 -0
  117. data/app/views/spree/admin/reimbursement_types/_form.html.erb +32 -0
  118. data/app/views/spree/admin/reimbursement_types/edit.html.erb +11 -0
  119. data/app/views/spree/admin/reimbursement_types/index.html.erb +9 -0
  120. data/app/views/spree/admin/reimbursement_types/new.html.erb +11 -0
  121. data/app/views/spree/admin/reimbursements/edit.html.erb +1 -1
  122. data/app/views/spree/admin/reports/sales_total.html.erb +1 -1
  123. data/app/views/spree/admin/return_authorizations/_form.html.erb +4 -4
  124. data/app/views/spree/admin/return_index/customer_returns.html.erb +1 -2
  125. data/app/views/spree/admin/return_index/return_authorizations.html.erb +4 -4
  126. data/app/views/spree/admin/roles/edit.html.erb +1 -1
  127. data/app/views/spree/admin/roles/new.html.erb +1 -1
  128. data/app/views/spree/admin/shared/_calculator_fields.html.erb +2 -2
  129. data/app/views/spree/admin/shared/_destroy.js.erb +1 -1
  130. data/app/views/spree/admin/shared/_edit_resource_links.html.erb +2 -2
  131. data/app/views/spree/admin/shared/_head.html.erb +2 -1
  132. data/app/views/spree/admin/shared/_header.html.erb +4 -11
  133. data/app/views/spree/admin/shared/_index_table_options.html.erb +1 -1
  134. data/app/views/spree/admin/shared/_main_menu.html.erb +6 -0
  135. data/app/views/spree/admin/shared/_new_resource_links.html.erb +2 -2
  136. data/app/views/spree/admin/shared/_order_summary.html.erb +3 -3
  137. data/app/views/spree/admin/shared/_refunds.html.erb +1 -1
  138. data/app/views/spree/admin/shared/_report_order_criteria.html.erb +3 -3
  139. data/app/views/spree/admin/shared/_translations.html.erb +38 -38
  140. data/app/views/spree/admin/shared/{_update_order_state.js → _update_order_state.js.erb} +3 -3
  141. data/app/views/spree/admin/shared/named_types/_index.html.erb +2 -2
  142. data/app/views/spree/admin/shipping_categories/edit.html.erb +3 -3
  143. data/app/views/spree/admin/shipping_categories/index.html.erb +3 -3
  144. data/app/views/spree/admin/shipping_categories/new.html.erb +3 -3
  145. data/app/views/spree/admin/shipping_methods/_form.html.erb +14 -14
  146. data/app/views/spree/admin/shipping_methods/edit.html.erb +3 -3
  147. data/app/views/spree/admin/shipping_methods/index.html.erb +3 -3
  148. data/app/views/spree/admin/shipping_methods/new.html.erb +3 -3
  149. data/app/views/spree/admin/states/_form.html.erb +2 -2
  150. data/app/views/spree/admin/states/_state_list.html.erb +2 -2
  151. data/app/views/spree/admin/states/edit.html.erb +3 -3
  152. data/app/views/spree/admin/states/index.html.erb +3 -3
  153. data/app/views/spree/admin/states/new.html.erb +3 -3
  154. data/app/views/spree/admin/stock_locations/_form.html.erb +0 -8
  155. data/app/views/spree/admin/stock_locations/_transfer_stock_form.html.erb +1 -1
  156. data/app/views/spree/admin/stock_locations/edit.html.erb +3 -3
  157. data/app/views/spree/admin/stock_locations/index.html.erb +4 -4
  158. data/app/views/spree/admin/stock_locations/new.html.erb +3 -3
  159. data/app/views/spree/admin/stock_transfers/index.html.erb +3 -3
  160. data/app/views/spree/admin/stock_transfers/new.html.erb +1 -1
  161. data/app/views/spree/admin/stock_transfers/show.html.erb +3 -3
  162. data/app/views/spree/admin/tax_categories/_form.html.erb +7 -7
  163. data/app/views/spree/admin/tax_categories/edit.html.erb +3 -3
  164. data/app/views/spree/admin/tax_categories/new.html.erb +3 -3
  165. data/app/views/spree/admin/tax_rates/_form.html.erb +5 -5
  166. data/app/views/spree/admin/tax_rates/edit.html.erb +3 -3
  167. data/app/views/spree/admin/tax_rates/new.html.erb +3 -3
  168. data/app/views/spree/admin/taxonomies/_form.html.erb +2 -2
  169. data/app/views/spree/admin/taxonomies/_js_head.html.erb +0 -5
  170. data/app/views/spree/admin/taxonomies/new.html.erb +1 -1
  171. data/app/views/spree/admin/taxons/_form.html.erb +7 -7
  172. data/app/views/spree/admin/taxons/_taxon_table.html.erb +1 -1
  173. data/app/views/spree/admin/taxons/edit.html.erb +0 -15
  174. data/app/views/spree/admin/taxons/index.html.erb +1 -1
  175. data/app/views/spree/admin/trackers/_form.html.erb +1 -1
  176. data/app/views/spree/admin/trackers/edit.html.erb +3 -3
  177. data/app/views/spree/admin/trackers/index.html.erb +3 -3
  178. data/app/views/spree/admin/trackers/new.html.erb +3 -3
  179. data/app/views/spree/admin/users/_addresses_form.html.erb +2 -2
  180. data/app/views/spree/admin/users/_form.html.erb +3 -3
  181. data/app/views/spree/admin/users/index.html.erb +7 -7
  182. data/app/views/spree/admin/users/items.html.erb +2 -2
  183. data/app/views/spree/admin/users/new.html.erb +3 -3
  184. data/app/views/spree/admin/variants/_autocomplete_line_items_stock.js.erb +24 -7
  185. data/app/views/spree/admin/variants/_autocomplete_stock.js.erb +1 -0
  186. data/app/views/spree/admin/variants/_form.html.erb +7 -7
  187. data/app/views/spree/admin/variants/new.html.erb +3 -3
  188. data/app/views/spree/admin/zones/_country_members.html.erb +1 -1
  189. data/app/views/spree/admin/zones/_form.html.erb +6 -6
  190. data/app/views/spree/admin/zones/_state_members.html.erb +1 -1
  191. data/app/views/spree/admin/zones/edit.html.erb +3 -3
  192. data/app/views/spree/admin/zones/index.html.erb +5 -5
  193. data/app/views/spree/admin/zones/new.html.erb +3 -3
  194. data/config/routes.rb +4 -12
  195. data/lib/spree/backend/engine.rb +2 -6
  196. data/spec/controllers/spree/admin/base_controller_spec.rb +46 -0
  197. data/spec/controllers/spree/admin/customer_returns_controller_spec.rb +185 -0
  198. data/spec/controllers/spree/admin/general_settings_controller_spec.rb +41 -0
  199. data/spec/controllers/spree/admin/missing_products_controller_spec.rb +18 -0
  200. data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +197 -0
  201. data/spec/controllers/spree/admin/orders_controller_spec.rb +296 -0
  202. data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +49 -0
  203. data/spec/controllers/spree/admin/payments_controller_spec.rb +97 -0
  204. data/spec/controllers/spree/admin/products_controller_spec.rb +99 -0
  205. data/spec/controllers/spree/admin/promotion_actions_controller_spec.rb +21 -0
  206. data/spec/controllers/spree/admin/promotion_rules_controller_spec.rb +21 -0
  207. data/spec/controllers/spree/admin/promotions_controller_spec.rb +44 -0
  208. data/spec/controllers/spree/admin/refunds_controller_spec.rb +32 -0
  209. data/spec/controllers/spree/admin/reimbursements_controller_spec.rb +74 -0
  210. data/spec/controllers/spree/admin/reports_controller_spec.rb +42 -0
  211. data/spec/controllers/spree/admin/resource_controller_spec.rb +252 -0
  212. data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +225 -0
  213. data/spec/controllers/spree/admin/return_index_controller_spec.rb +37 -0
  214. data/spec/controllers/spree/admin/return_items_controller_spec.rb +27 -0
  215. data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +14 -0
  216. data/spec/controllers/spree/admin/stock_items_controller_spec.rb +19 -0
  217. data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +41 -0
  218. data/spec/controllers/spree/admin/stock_transfers_controller_spec.rb +41 -0
  219. data/spec/controllers/spree/admin/tax_categories_controller_spec.rb +34 -0
  220. data/spec/controllers/spree/admin/users_controller_spec.rb +161 -0
  221. data/spec/controllers/spree/admin/variants_controller_spec.rb +32 -0
  222. data/spec/features/admin/configuration/analytics_tracker_spec.rb +47 -0
  223. data/spec/features/admin/configuration/countries_spec.rb +24 -0
  224. data/spec/features/admin/configuration/general_settings_spec.rb +44 -0
  225. data/spec/features/admin/configuration/payment_methods_spec.rb +63 -0
  226. data/spec/features/admin/configuration/roles_spec.rb +47 -0
  227. data/spec/features/admin/configuration/shipping_methods_spec.rb +62 -0
  228. data/spec/features/admin/configuration/states_spec.rb +68 -0
  229. data/spec/features/admin/configuration/stock_locations_spec.rb +48 -0
  230. data/spec/features/admin/configuration/store_credit_categories_spec.rb +50 -0
  231. data/spec/features/admin/configuration/tax_categories_spec.rb +56 -0
  232. data/spec/features/admin/configuration/tax_rates_spec.rb +18 -0
  233. data/spec/features/admin/configuration/zones_spec.rb +39 -0
  234. data/spec/features/admin/homepage_spec.rb +89 -0
  235. data/spec/features/admin/locale_spec.rb +31 -0
  236. data/spec/features/admin/orders/adjustments_promotions_spec.rb +53 -0
  237. data/spec/features/admin/orders/adjustments_spec.rb +129 -0
  238. data/spec/features/admin/orders/cancelling_and_resuming_spec.rb +47 -0
  239. data/spec/features/admin/orders/customer_details_spec.rb +154 -0
  240. data/spec/features/admin/orders/line_items_spec.rb +51 -0
  241. data/spec/features/admin/orders/listing_spec.rb +224 -0
  242. data/spec/features/admin/orders/log_entries_spec.rb +55 -0
  243. data/spec/features/admin/orders/new_order_spec.rb +186 -0
  244. data/spec/features/admin/orders/order_details_spec.rb +662 -0
  245. data/spec/features/admin/orders/payments_spec.rb +231 -0
  246. data/spec/features/admin/orders/risk_analysis_spec.rb +48 -0
  247. data/spec/features/admin/orders/shipments_spec.rb +64 -0
  248. data/spec/features/admin/orders/state_changes_spec.rb +21 -0
  249. data/spec/features/admin/products/edit/images_spec.rb +86 -0
  250. data/spec/features/admin/products/edit/products_spec.rb +64 -0
  251. data/spec/features/admin/products/edit/taxons_spec.rb +41 -0
  252. data/spec/features/admin/products/edit/variants_spec.rb +56 -0
  253. data/spec/features/admin/products/option_types_spec.rb +114 -0
  254. data/spec/features/admin/products/products_spec.rb +445 -0
  255. data/spec/features/admin/products/properties_spec.rb +147 -0
  256. data/spec/features/admin/products/prototypes_spec.rb +112 -0
  257. data/spec/features/admin/products/stock_management_spec.rb +124 -0
  258. data/spec/features/admin/products/taxonomies_spec.rb +52 -0
  259. data/spec/features/admin/products/variant_spec.rb +50 -0
  260. data/spec/features/admin/promotions/adjustments_spec.rb +259 -0
  261. data/spec/features/admin/promotions/option_value_rule_spec.rb +70 -0
  262. data/spec/features/admin/promotions/tiered_calculator_spec.rb +70 -0
  263. data/spec/features/admin/refund_reasons/refund_reasons_spec.rb +57 -0
  264. data/spec/features/admin/reimbursement_type/edit_reimbursement_type_spec.rb +36 -0
  265. data/spec/features/admin/reimbursement_type/new_reimbursement_type_spec.rb +62 -0
  266. data/spec/features/admin/reports_spec.rb +61 -0
  267. data/spec/features/admin/return_authorization_reasons/return_authorization_reasons_spec.rb +63 -0
  268. data/spec/features/admin/returns/customer_returns_spec.rb +80 -0
  269. data/spec/features/admin/returns/return_authorizations_spec.rb +152 -0
  270. data/spec/features/admin/stock_transfer_spec.rb +75 -0
  271. data/spec/features/admin/store_credits_spec.rb +93 -0
  272. data/spec/features/admin/taxons_spec.rb +47 -0
  273. data/spec/features/admin/users_spec.rb +286 -0
  274. data/spec/helpers/admin/base_helper_spec.rb +30 -0
  275. data/spec/helpers/admin/navigation_helper_spec.rb +111 -0
  276. data/spec/helpers/admin/promotion_rules_helper_spec.rb +12 -0
  277. data/spec/helpers/admin/stock_movements_helper_spec.rb +30 -0
  278. data/spec/models/spree/resource_spec.rb +48 -0
  279. data/spec/routing/admin_path_spec.rb +22 -0
  280. data/spec/spec_helper.rb +144 -0
  281. data/spec/support/appear_before_matcher.rb +8 -0
  282. data/spec/support/ror_ringer.jpeg +0 -0
  283. data/spec/test_views/spree/admin/submodule/posts/edit.html.erb +1 -0
  284. data/spec/test_views/spree/admin/submodule/posts/new.html.erb +1 -0
  285. data/spec/test_views/spree/admin/widgets/edit.html.erb +1 -0
  286. data/spec/test_views/spree/admin/widgets/new.html.erb +1 -0
  287. data/spree_backend.gemspec +4 -3
  288. data/vendor/assets/javascripts/jquery.jstree/jquery.jstree.js +130 -154
  289. metadata +114 -34
  290. data/app/assets/images/admin/payment_banner.png +0 -0
  291. data/app/assets/images/admin/progress.gif +0 -0
  292. data/app/assets/javascripts/spree/backend/nested-attribute.js +0 -27
  293. data/app/assets/javascripts/spree/backend/orders/edit_form.js +0 -21
  294. data/app/assets/stylesheets/spree/backend/components/_variables.scss +0 -12
  295. data/app/assets/stylesheets/spree/backend/plugins/_js_tree.scss +0 -0
  296. data/app/assets/stylesheets/spree/backend/shared/_typography.scss +0 -5
  297. data/app/controllers/spree/admin/root_controller.rb +0 -18
  298. data/app/controllers/spree/admin/search_controller.rb +0 -41
  299. data/app/helpers/spree/admin/inventory_settings_helper.rb +0 -9
  300. data/app/helpers/spree/admin/products_helper.rb +0 -29
  301. data/app/helpers/spree/admin/tables_helper.rb +0 -15
  302. data/app/helpers/spree/promotion_rules_helper.rb +0 -13
  303. data/app/views/spree/admin/inventory_units/adjust.html.erb +0 -29
  304. data/app/views/spree/admin/orders/_line_item.html.erb +0 -21
  305. data/app/views/spree/admin/refund_reasons/destroy.js.erb +0 -1
  306. data/app/views/spree/admin/return_authorization_reasons/destroy.js.erb +0 -1
  307. data/app/views/spree/admin/search/products.rabl +0 -9
  308. data/app/views/spree/admin/search/users.rabl +0 -30
  309. data/app/views/spree/admin/stock_movements/edit.html.erb +0 -17
@@ -0,0 +1,114 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Option Types", type: :feature, js: true do
4
+ stub_authorization!
5
+
6
+ before(:each) do
7
+ visit spree.admin_path
8
+ click_link "Products"
9
+ end
10
+
11
+ context "listing option types" do
12
+ it "should list existing option types" do
13
+ create(:option_type, name: "tshirt-color", presentation: "Color")
14
+ create(:option_type, name: "tshirt-size", presentation: "Size")
15
+ click_link "Option Types"
16
+ within("table#listing_option_types") do
17
+ expect(page).to have_content("Color")
18
+ expect(page).to have_content("tshirt-color")
19
+ expect(page).to have_content("Size")
20
+ expect(page).to have_content("tshirt-size")
21
+ end
22
+ end
23
+ end
24
+
25
+ context "creating a new option type" do
26
+ it "should allow an admin to create a new option type" do
27
+ click_link "Option Types"
28
+ click_link "new_option_type_link"
29
+ expect(page).to have_content("New Option Type")
30
+ fill_in "option_type_name", with: "shirt colors"
31
+ fill_in "option_type_presentation", with: "colors"
32
+ click_button "Create"
33
+ expect(page).to have_content("successfully created!")
34
+
35
+ page.find('#option_type_option_values_attributes_0_name').set('color')
36
+ page.find('#option_type_option_values_attributes_0_presentation').set('black')
37
+
38
+ click_button "Update"
39
+ expect(page).to have_content("successfully updated!")
40
+ end
41
+ end
42
+
43
+ context "editing an existing option type" do
44
+ it "should allow an admin to update an existing option type" do
45
+ create(:option_type, name: "tshirt-color", presentation: "Color")
46
+ create(:option_type, name: "tshirt-size", presentation: "Size")
47
+ click_link "Option Types"
48
+ within('table#listing_option_types') { click_icon :edit }
49
+ fill_in "option_type_name", with: "foo-size 99"
50
+ click_button "Update"
51
+ expect(page).to have_content("successfully updated!")
52
+ expect(page).to have_content("foo-size 99")
53
+ end
54
+ end
55
+
56
+ # Regression test for #2277
57
+ it "can remove an option value from an option type" do
58
+ option_type = create(:option_type)
59
+ create(:option_value, option_type: option_type)
60
+ click_link "Option Types"
61
+ within('table#listing_option_types') { click_icon :edit }
62
+ expect(page).to have_content(option_type.name)
63
+ expect(all("tbody#option_values tr").count).to eq(1)
64
+ within("tbody#option_values") do
65
+ find('.spree_remove_fields').click
66
+ end
67
+ # Assert that the field is hidden automatically
68
+ expect(all("tbody#option_values tr").select(&:visible?).count).to eq(0)
69
+
70
+ # Then assert that on a page refresh that it's still not visible
71
+ visit page.current_url
72
+ # What *is* visible is a new option value field, with blank values
73
+ # Sometimes the page doesn't load before the all check is done
74
+ # lazily finding the element gives the page 10 seconds
75
+ expect(page).to have_css("tbody#option_values")
76
+ all("tbody#option_values tr input").all? { |input| input.value.blank? }
77
+ end
78
+
79
+ # Regression test for #3204
80
+ it "can remove a non-persisted option value from an option type" do
81
+ create(:option_type)
82
+ click_link "Option Types"
83
+ within('table#listing_option_types') { click_icon :edit }
84
+
85
+ wait_for_ajax
86
+ page.find("tbody#option_values", visible: true)
87
+
88
+ expect(all("tbody#option_values tr").select(&:visible?).count).to eq(1)
89
+
90
+ # Add a new option type
91
+ click_link "Add Option Value"
92
+ expect(all("tbody#option_values tr").select(&:visible?).count).to eq(2)
93
+
94
+ # Remove default option type
95
+ within("tbody#option_values") do
96
+ click_icon :delete
97
+ end
98
+ # Check that there was no HTTP request
99
+ expect(all("div#progress[style]").count).to eq(0)
100
+ # Assert that the field is hidden automatically
101
+ expect(all("tbody#option_values tr").select(&:visible?).count).to eq(1)
102
+
103
+ # Remove added option type
104
+ within("tbody#option_values") do
105
+ click_icon :delete
106
+ end
107
+ # Check that there was no HTTP request
108
+ expect(all("div#progress[style]").count).to eq(0)
109
+ # Assert that the field is hidden automatically
110
+ expect(all("tbody#option_values tr").select(&:visible?).count).to eq(0)
111
+
112
+ end
113
+
114
+ end
@@ -0,0 +1,445 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe "Products", type: :feature do
5
+ context "as admin user" do
6
+ stub_authorization!
7
+
8
+ def build_option_type_with_values(name, values)
9
+ ot = FactoryGirl.create(:option_type, name: name)
10
+ values.each do |val|
11
+ ot.option_values.create(name: val.downcase, presentation: val)
12
+ end
13
+ ot
14
+ end
15
+
16
+ context "listing products" do
17
+ context "sorting" do
18
+ before do
19
+ create(:product, name: 'apache baseball cap', price: 10)
20
+ create(:product, name: 'zomg shirt', price: 5)
21
+ end
22
+
23
+ it "should list existing products with correct sorting by name" do
24
+ visit spree.admin_products_path
25
+ # Name ASC
26
+ within_row(1) { expect(page).to have_content('apache baseball cap') }
27
+ within_row(2) { expect(page).to have_content("zomg shirt") }
28
+
29
+ # Name DESC
30
+ click_link "admin_products_listing_name_title"
31
+ within_row(1) { expect(page).to have_content("zomg shirt") }
32
+ within_row(2) { expect(page).to have_content('apache baseball cap') }
33
+ end
34
+
35
+ it "should list existing products with correct sorting by price" do
36
+ visit spree.admin_products_path
37
+ # Name ASC (default)
38
+ within_row(1) { expect(page).to have_content('apache baseball cap') }
39
+ within_row(2) { expect(page).to have_content("zomg shirt") }
40
+
41
+ # Price DESC
42
+ click_link "admin_products_listing_price_title"
43
+ within_row(1) { expect(page).to have_content("zomg shirt") }
44
+ within_row(2) { expect(page).to have_content('apache baseball cap') }
45
+ end
46
+ end
47
+
48
+ context "currency displaying" do
49
+ context "using Russian Rubles" do
50
+ before do
51
+ Spree::Config[:currency] = "RUB"
52
+ end
53
+
54
+ let!(:product) do
55
+ create(:product, name: "Just a product", price: 19.99)
56
+ end
57
+
58
+ # Regression test for #2737
59
+ context "uses руб as the currency symbol" do
60
+ it "on the products listing page" do
61
+ visit spree.admin_products_path
62
+ within_row(1) { expect(page).to have_content("19.99 ₽") }
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
68
+
69
+ context "searching products" do
70
+ it "should be able to search deleted products" do
71
+ create(:product, name: 'apache baseball cap', deleted_at: "2011-01-06 18:21:13")
72
+ create(:product, name: 'zomg shirt')
73
+
74
+ visit spree.admin_products_path
75
+ expect(page).to have_content("zomg shirt")
76
+ expect(page).not_to have_content("apache baseball cap")
77
+
78
+ check "Show Deleted"
79
+ click_on 'Search'
80
+
81
+ expect(page).to have_content("zomg shirt")
82
+ expect(page).to have_content("apache baseball cap")
83
+
84
+ uncheck "Show Deleted"
85
+ click_on 'Search'
86
+
87
+ expect(page).to have_content("zomg shirt")
88
+ expect(page).not_to have_content("apache baseball cap")
89
+ end
90
+
91
+ it "should be able to search products by their properties" do
92
+ create(:product, name: 'apache baseball cap', sku: "A100")
93
+ create(:product, name: 'apache baseball cap2', sku: "B100")
94
+ create(:product, name: 'zomg shirt')
95
+
96
+ visit spree.admin_products_path
97
+ fill_in "q_name_cont", with: "ap"
98
+ click_on 'Search'
99
+
100
+ expect(page).to have_content("apache baseball cap")
101
+ expect(page).to have_content("apache baseball cap2")
102
+ expect(page).not_to have_content("zomg shirt")
103
+
104
+ fill_in "q_variants_including_master_sku_cont", with: "A1"
105
+ click_on 'Search'
106
+
107
+ expect(page).to have_content("apache baseball cap")
108
+ expect(page).not_to have_content("apache baseball cap2")
109
+ expect(page).not_to have_content("zomg shirt")
110
+ end
111
+ end
112
+
113
+ context "creating a new product from a prototype", js: true do
114
+ def build_option_type_with_values(name, values)
115
+ ot = FactoryGirl.create(:option_type, name: name)
116
+ values.each do |val|
117
+ ot.option_values.create(name: val.downcase, presentation: val)
118
+ end
119
+ ot
120
+ end
121
+
122
+ let(:product_attributes) do
123
+ # FactoryGirl.attributes_for is un-deprecated!
124
+ # https://github.com/thoughtbot/factory_girl/issues/274#issuecomment-3592054
125
+ FactoryGirl.attributes_for(:simple_product)
126
+ end
127
+
128
+ let(:prototype) do
129
+ size = build_option_type_with_values("size", %w(Small Medium Large))
130
+ FactoryGirl.create(:prototype, name: "Size", option_types: [ size ])
131
+ end
132
+
133
+ let(:option_values_hash) do
134
+ hash = {}
135
+ prototype.option_types.each do |i|
136
+ hash[i.id.to_s] = i.option_value_ids
137
+ end
138
+ hash
139
+ end
140
+
141
+ before(:each) do
142
+ @option_type_prototype = prototype
143
+ @property_prototype = create(:prototype, name: "Random")
144
+ @shipping_category = create(:shipping_category)
145
+ visit spree.admin_products_path
146
+ click_link "admin_new_product"
147
+ within('#new_product') do
148
+ expect(page).to have_content("SKU")
149
+ end
150
+ end
151
+
152
+ it "should allow an admin to create a new product and variants from a prototype" do
153
+ fill_in "product_name", with: "Baseball Cap"
154
+ fill_in "product_sku", with: "B100"
155
+ fill_in "product_price", with: "100"
156
+ fill_in "product_available_on", with: "2012/01/24"
157
+ # Just so the datepicker gets out of poltergeists way.
158
+ page.execute_script("$('#ui-datepicker-div').hide();")
159
+ select "Size", from: "Prototype"
160
+ wait_for_ajax
161
+ check "Large"
162
+ select @shipping_category.name, from: "product_shipping_category_id"
163
+ click_button "Create"
164
+ expect(page).to have_content("successfully created!")
165
+ expect(Spree::Product.last.variants.length).to eq(1)
166
+ end
167
+
168
+ it "should not display variants when prototype does not contain option types" do
169
+ select "Random", from: "Prototype"
170
+
171
+ fill_in "product_name", with: "Baseball Cap"
172
+
173
+ expect(page).not_to have_content("Variants")
174
+ end
175
+
176
+ it "should keep option values selected if validation fails" do
177
+ fill_in "product_name", with: "Baseball Cap"
178
+ fill_in "product_sku", with: "B100"
179
+ fill_in "product_price", with: "100"
180
+ select "Size", from: "Prototype"
181
+ wait_for_ajax
182
+ check "Large"
183
+ click_button "Create"
184
+ expect(page).to have_content("Shipping Category can't be blank")
185
+ expect(field_labeled("Size")).to be_checked
186
+ expect(field_labeled("Large")).to be_checked
187
+ expect(field_labeled("Small")).not_to be_checked
188
+ end
189
+ end
190
+
191
+ context "creating a new product" do
192
+ before(:each) do
193
+ @shipping_category = create(:shipping_category)
194
+ visit spree.admin_products_path
195
+ click_link "admin_new_product"
196
+ within('#new_product') do
197
+ expect(page).to have_content("SKU")
198
+ end
199
+ end
200
+
201
+ it "should allow an admin to create a new product" do
202
+ fill_in "product_name", with: "Baseball Cap"
203
+ fill_in "product_sku", with: "B100"
204
+ fill_in "product_price", with: "100"
205
+ fill_in "product_available_on", with: "2012/01/24"
206
+ select @shipping_category.name, from: "product_shipping_category_id"
207
+ click_button "Create"
208
+ expect(page).to have_content("successfully created!")
209
+ click_button "Update"
210
+ expect(page).to have_content("successfully updated!")
211
+ end
212
+
213
+ it "should show validation errors" do
214
+ fill_in "product_name", with: "Baseball Cap"
215
+ fill_in "product_sku", with: "B100"
216
+ fill_in "product_price", with: "100"
217
+ click_button "Create"
218
+ expect(page).to have_content("Shipping Category can't be blank")
219
+ end
220
+
221
+ context "using a locale with a different decimal format " do
222
+ before do
223
+ # change English locale’s separator and delimiter to match 19,99 format
224
+ I18n.backend.store_translations(:en,
225
+ number: {
226
+ currency: {
227
+ format: {
228
+ separator: ",",
229
+ delimiter: "."
230
+ }
231
+ }
232
+ })
233
+ end
234
+
235
+ after do
236
+ # revert changes to English locale
237
+ I18n.backend.store_translations(:en,
238
+ number: {
239
+ currency: {
240
+ format: {
241
+ separator: ".",
242
+ delimiter: ","
243
+ }
244
+ }
245
+ })
246
+ end
247
+
248
+ it "should show localized price value on validation errors", js: true do
249
+ fill_in "product_price", with: "19,99"
250
+ click_button "Create"
251
+ expect(find('input#product_price').value).to eq('19,99')
252
+ end
253
+ end
254
+
255
+ # Regression test for #2097
256
+ it "can set the count on hand to a null value" do
257
+ fill_in "product_name", with: "Baseball Cap"
258
+ fill_in "product_price", with: "100"
259
+ select @shipping_category.name, from: "product_shipping_category_id"
260
+ click_button "Create"
261
+ expect(page).to have_content("successfully created!")
262
+ click_button "Update"
263
+ expect(page).to have_content("successfully updated!")
264
+ end
265
+ end
266
+
267
+
268
+ context "cloning a product", js: true do
269
+ it "should allow an admin to clone a product" do
270
+ create(:product)
271
+
272
+ visit spree.admin_products_path
273
+ within_row(1) do
274
+ click_icon :clone
275
+ end
276
+
277
+ expect(page).to have_content("Product has been cloned")
278
+ end
279
+
280
+ context "cloning a deleted product" do
281
+ it "should allow an admin to clone a deleted product" do
282
+ create(:product, name: "apache baseball cap")
283
+
284
+ visit spree.admin_products_path
285
+ click_on 'Filter'
286
+ check "Show Deleted"
287
+ click_on 'Search'
288
+
289
+ expect(page).to have_content("apache baseball cap")
290
+
291
+ within_row(1) do
292
+ click_icon :clone
293
+ end
294
+
295
+ expect(page).to have_content("Product has been cloned")
296
+ end
297
+ end
298
+ end
299
+
300
+ context 'updating a product' do
301
+ let(:product) { create(:product) }
302
+
303
+ let(:prototype) do
304
+ size = build_option_type_with_values("size", %w(Small Medium Large))
305
+ FactoryGirl.create(:prototype, name: "Size", option_types: [ size ])
306
+ end
307
+
308
+ before(:each) do
309
+ @option_type_prototype = prototype
310
+ @property_prototype = create(:prototype, name: "Random")
311
+ end
312
+
313
+ it 'should parse correctly available_on' do
314
+ visit spree.admin_product_path(product)
315
+ fill_in "product_available_on", with: "2012/12/25"
316
+ click_button "Update"
317
+ expect(page).to have_content("successfully updated!")
318
+ expect(Spree::Product.last.available_on.to_s).to eq("2012-12-25 00:00:00 UTC")
319
+ end
320
+
321
+ it 'should add option_types when selecting a prototype', js: true do
322
+ visit spree.admin_product_path(product)
323
+ within('#sidebar') do
324
+ click_link 'Properties'
325
+ end
326
+ click_link "Select From Prototype"
327
+
328
+ within("#prototypes tr#row_#{prototype.id}") do
329
+ click_link 'Select'
330
+ wait_for_ajax
331
+ end
332
+
333
+ within(:css, "tr.product_property:first-child") do
334
+ expect(first('input[type=text]').value).to eq('baseball_cap_color')
335
+ end
336
+ end
337
+
338
+ context "using a locale with a different decimal format" do
339
+ before do
340
+ # change English locale’s separator and delimiter to match 19,99 format
341
+ I18n.backend.store_translations(
342
+ :en,
343
+ number: {
344
+ currency: {
345
+ format: {
346
+ separator: ",",
347
+ delimiter: "."
348
+ }
349
+ },
350
+ format: {
351
+ separator: ",",
352
+ delimiter: "."
353
+ }
354
+ }
355
+ )
356
+ end
357
+
358
+ after do
359
+ # revert changes to English locale
360
+ I18n.backend.store_translations(
361
+ :en,
362
+ number: {
363
+ currency: {
364
+ format: {
365
+ separator: ".",
366
+ delimiter: ","
367
+ }
368
+ },
369
+ format: {
370
+ separator: ".",
371
+ delimiter: ","
372
+ }
373
+ }
374
+ )
375
+ end
376
+
377
+ it 'should parse correctly decimal values like weight' do
378
+ visit spree.admin_product_path(product)
379
+ fill_in 'product_weight', with: '1'
380
+ click_button 'Update'
381
+ weight_prev = find('#product_weight').value
382
+ click_button 'Update'
383
+ expect(find('#product_weight').value).to eq(weight_prev)
384
+ end
385
+ end
386
+ end
387
+
388
+ context 'deleting a product', js: true do
389
+ let!(:product) { create(:product) }
390
+
391
+ it "is still viewable" do
392
+ visit spree.admin_products_path
393
+ accept_alert do
394
+ click_icon :delete
395
+ wait_for_ajax
396
+ end
397
+ click_on 'Filter'
398
+ # This will show our deleted product
399
+ check "Show Deleted"
400
+ click_on 'Search'
401
+ click_link product.name
402
+ expect(find("#product_price").value.to_f).to eq(product.price.to_f)
403
+ end
404
+ end
405
+ end
406
+
407
+ context 'with only product permissions' do
408
+
409
+ before do
410
+ allow_any_instance_of(Spree::Admin::BaseController).to receive(:spree_current_user).and_return(nil)
411
+ end
412
+
413
+ custom_authorization! do |user|
414
+ can [:admin, :update, :index, :read], Spree::Product
415
+ end
416
+ let!(:product) { create(:product) }
417
+
418
+ it "should only display accessible links on index" do
419
+ visit spree.admin_products_path
420
+
421
+ expect(page).to have_link('Products')
422
+ expect(page).not_to have_link('Option Types')
423
+ expect(page).not_to have_link('Properties')
424
+ expect(page).not_to have_link('Prototypes')
425
+ expect(page).not_to have_link('New Product')
426
+ expect(page).not_to have_css('.icon-clone')
427
+ expect(page).to have_css('.icon-edit')
428
+ expect(page).not_to have_css('.delete-resource')
429
+ end
430
+
431
+ it "should only display accessible links on edit" do
432
+ visit spree.admin_product_path(product)
433
+
434
+ # product tabs should be hidden
435
+ expect(page).to have_link('Details')
436
+ expect(page).not_to have_link('Images')
437
+ expect(page).not_to have_link('Variants')
438
+ expect(page).not_to have_link('Properties')
439
+ expect(page).not_to have_link('Stock Management')
440
+
441
+ # no create permission
442
+ expect(page).not_to have_link('New Product')
443
+ end
444
+ end
445
+ end
@@ -0,0 +1,147 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Properties", type: :feature, js: true do
4
+ stub_authorization!
5
+
6
+ before(:each) do
7
+ visit spree.admin_products_path
8
+ end
9
+
10
+ context "Property index" do
11
+ before do
12
+ create(:property, name: 'shirt size', presentation: 'size')
13
+ create(:property, name: 'shirt fit', presentation: 'fit')
14
+ click_link "Products"
15
+ click_link "Properties"
16
+ end
17
+
18
+ context "listing product properties" do
19
+ it "should list the existing product properties" do
20
+ within_row(1) do
21
+ expect(column_text(1)).to eq("shirt size")
22
+ expect(column_text(2)).to eq("size")
23
+ end
24
+
25
+ within_row(2) do
26
+ expect(column_text(1)).to eq("shirt fit")
27
+ expect(column_text(2)).to eq("fit")
28
+ end
29
+ end
30
+ end
31
+
32
+ context "searching properties" do
33
+ it 'should list properties matching search query' do
34
+ click_on "Filter"
35
+ fill_in "q_name_cont", with: "size"
36
+ click_on 'Search'
37
+
38
+ expect(page).to have_content("shirt size")
39
+ expect(page).not_to have_content("shirt fit")
40
+ end
41
+ end
42
+ end
43
+
44
+ context "creating a property" do
45
+ it "should allow an admin to create a new product property" do
46
+ click_link "Products"
47
+ click_link "Properties"
48
+ click_link "new_property_link"
49
+ within('.content-header') { expect(page).to have_content("New Property") }
50
+
51
+ fill_in "property_name", with: "color of band"
52
+ fill_in "property_presentation", with: "color"
53
+ click_button "Create"
54
+ expect(page).to have_content("successfully created!")
55
+ end
56
+ end
57
+
58
+ context "editing a property" do
59
+ before(:each) do
60
+ create(:property)
61
+ click_link "Products"
62
+ click_link "Properties"
63
+ within_row(1) { click_icon :edit }
64
+ end
65
+
66
+ it "should allow an admin to edit an existing product property" do
67
+ fill_in "property_name", with: "model 99"
68
+ click_button "Update"
69
+ expect(page).to have_content("successfully updated!")
70
+ expect(page).to have_content("model 99")
71
+ end
72
+
73
+ it "should show validation errors" do
74
+ fill_in "property_name", with: ""
75
+ click_button "Update"
76
+ expect(page).to have_content("Name can't be blank")
77
+ end
78
+ end
79
+
80
+ context "linking a property to a product" do
81
+ before do
82
+ create(:product)
83
+ visit spree.admin_products_path
84
+ click_icon :edit
85
+ within('#sidebar') do
86
+ click_link "Properties"
87
+ end
88
+ end
89
+
90
+ # Regression test for #2279
91
+ it "successfully create and then remove product property" do
92
+ fill_in_property
93
+ # Sometimes the page doesn't load before the all check is done
94
+ # lazily finding the element gives the page 10 seconds
95
+ expect(page).to have_css("tbody#product_properties tr:nth-child(2)")
96
+ expect(all("tbody#product_properties tr").count).to eq(2)
97
+
98
+ delete_product_property
99
+
100
+ check_property_row_count(1)
101
+ end
102
+
103
+ # Regression test for #4466
104
+ it "successfully remove and create a product property at the same time" do
105
+ fill_in_property
106
+
107
+ fill_in "product_product_properties_attributes_1_property_name", with: "New Property"
108
+ fill_in "product_product_properties_attributes_1_value", with: "New Value"
109
+
110
+ delete_product_property
111
+
112
+ # Give fadeOut time to complete
113
+ expect(page).not_to have_selector("#product_product_properties_attributes_0_property_name")
114
+ expect(page).not_to have_selector("#product_product_properties_attributes_0_value")
115
+
116
+ click_button "Update"
117
+
118
+ expect(page).not_to have_content("Product is not found")
119
+
120
+ check_property_row_count(2)
121
+ end
122
+
123
+ def fill_in_property
124
+ fill_in "product_product_properties_attributes_0_property_name", with: "A Property"
125
+ fill_in "product_product_properties_attributes_0_value", with: "A Value"
126
+ click_button "Update"
127
+ within('#sidebar') do
128
+ click_link "Properties"
129
+ end
130
+ end
131
+
132
+ def delete_product_property
133
+ accept_alert do
134
+ click_icon :delete
135
+ wait_for_ajax # delete action must finish before reloading
136
+ end
137
+ end
138
+
139
+ def check_property_row_count(expected_row_count)
140
+ within('#sidebar') do
141
+ click_link "Properties"
142
+ end
143
+ expect(page).to have_css("tbody#product_properties")
144
+ expect(all("tbody#product_properties tr").count).to eq(expected_row_count)
145
+ end
146
+ end
147
+ end