spree_backend 4.1.15 → 4.2.0.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (270) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/backend-add.svg +5 -0
  3. data/app/assets/images/backend-adjust.svg +5 -0
  4. data/app/assets/images/backend-approve.svg +3 -0
  5. data/app/assets/images/backend-arrow-down.svg +1 -0
  6. data/app/assets/images/backend-arrow-left.svg +1 -0
  7. data/app/assets/images/backend-arrow-right.svg +1 -0
  8. data/app/assets/images/backend-arrow-up.svg +1 -0
  9. data/app/assets/images/backend-calendar.svg +9 -0
  10. data/app/assets/images/backend-cancel.svg +7 -0
  11. data/app/assets/images/backend-capture.svg +3 -0
  12. data/app/assets/images/backend-cart.svg +1 -0
  13. data/app/assets/images/backend-chevron-down.svg +1 -0
  14. data/app/assets/images/backend-chevron-left.svg +1 -0
  15. data/app/assets/images/backend-chevron-right.svg +1 -0
  16. data/app/assets/images/backend-chevron-up.svg +1 -0
  17. data/app/assets/images/backend-clone.svg +7 -0
  18. data/app/assets/images/backend-close.svg +7 -0
  19. data/app/assets/images/backend-delete.svg +6 -0
  20. data/app/assets/images/backend-double-chevron-left.svg +15 -0
  21. data/app/assets/images/backend-double-chevron-right.svg +17 -0
  22. data/app/assets/images/backend-edit.svg +14 -0
  23. data/app/assets/images/backend-enter.svg +6 -0
  24. data/app/assets/images/backend-envelope.svg +3 -0
  25. data/app/assets/images/backend-exit.svg +13 -0
  26. data/app/assets/images/backend-extensions.svg +4 -0
  27. data/app/assets/images/backend-eye-open.svg +8 -0
  28. data/app/assets/images/backend-file.svg +6 -0
  29. data/app/assets/images/backend-filter.svg +3 -0
  30. data/app/assets/images/backend-folder.svg +4 -0
  31. data/app/assets/images/backend-images.svg +7 -0
  32. data/app/assets/images/backend-info.svg +7 -0
  33. data/app/assets/images/backend-items.svg +5 -0
  34. data/app/assets/images/backend-leaf.svg +7 -0
  35. data/app/assets/images/backend-list.svg +5 -0
  36. data/app/assets/images/backend-location.svg +4 -0
  37. data/app/assets/images/backend-menu.svg +5 -0
  38. data/app/assets/images/backend-money.svg +1 -0
  39. data/app/assets/images/backend-move.svg +5 -0
  40. data/app/assets/images/backend-ok.svg +3 -0
  41. data/app/assets/images/backend-pagination-double-arrow-right.svg +8 -0
  42. data/app/assets/images/backend-payments.svg +8 -0
  43. data/app/assets/images/backend-pencil.svg +1 -0
  44. data/app/assets/images/backend-products.svg +5 -0
  45. data/app/assets/images/backend-promotion.svg +8 -0
  46. data/app/assets/images/backend-recycle.svg +5 -0
  47. data/app/assets/images/backend-remove.svg +6 -0
  48. data/app/assets/images/backend-report.svg +6 -0
  49. data/app/assets/images/backend-resume.svg +5 -0
  50. data/app/assets/images/backend-returns.svg +3 -0
  51. data/app/assets/images/backend-save.svg +3 -0
  52. data/app/assets/images/backend-search.svg +1 -0
  53. data/app/assets/images/backend-settings.svg +6 -0
  54. data/app/assets/images/backend-shipping.svg +3 -0
  55. data/app/assets/images/backend-slack.svg +3 -0
  56. data/app/assets/images/backend-sort.svg +5 -0
  57. data/app/assets/images/backend-split.svg +3 -0
  58. data/app/assets/images/backend-store.svg +14 -0
  59. data/app/assets/images/backend-tick.svg +3 -0
  60. data/app/assets/images/backend-update.svg +3 -0
  61. data/app/assets/images/backend-user.svg +3 -0
  62. data/app/assets/images/backend-users.svg +6 -0
  63. data/app/assets/images/backend-view.svg +8 -0
  64. data/app/assets/images/backend-void.svg +7 -0
  65. data/app/assets/javascripts/spree/backend/admin.js +156 -147
  66. data/app/assets/javascripts/spree/backend/checkouts/edit.js +1 -0
  67. data/app/assets/javascripts/spree/backend/flatpickr_locals.js +37 -0
  68. data/app/assets/javascripts/spree/backend/multi_currency.js +38 -0
  69. data/app/assets/javascripts/spree/backend/payments/edit.js +4 -3
  70. data/app/assets/javascripts/spree/backend/payments/new.js +18 -18
  71. data/app/assets/javascripts/spree/backend/promotions.js +1 -1
  72. data/app/assets/javascripts/spree/backend/spree-select2.js +18 -4
  73. data/app/assets/javascripts/spree/backend/stock_management.js +2 -1
  74. data/app/assets/javascripts/spree/backend/taxon_tree_menu.js +4 -4
  75. data/app/assets/javascripts/spree/backend/taxonomy.js +8 -1
  76. data/app/assets/javascripts/spree/backend/taxons.js +25 -16
  77. data/app/assets/javascripts/spree/backend/user_picker.js +1 -1
  78. data/app/assets/javascripts/spree/backend/variant_autocomplete.js +1 -1
  79. data/app/assets/javascripts/spree/backend/variant_management.js +2 -1
  80. data/app/assets/javascripts/spree/backend.js +5 -2
  81. data/app/assets/stylesheets/spree/backend/components/_buttons.scss +27 -11
  82. data/app/assets/stylesheets/spree/backend/components/_filters.scss +35 -5
  83. data/app/assets/stylesheets/spree/backend/components/_icons.scss +39 -4
  84. data/app/assets/stylesheets/spree/backend/components/_main.scss +32 -6
  85. data/app/assets/stylesheets/spree/backend/components/_navbar.scss +16 -8
  86. data/app/assets/stylesheets/spree/backend/components/_sidebar.scss +119 -55
  87. data/app/assets/stylesheets/spree/backend/components/_tables.scss +62 -19
  88. data/app/assets/stylesheets/spree/backend/components/_taxon_products_view.scss +26 -63
  89. data/app/assets/stylesheets/spree/backend/global/_variables.scss +5 -1
  90. data/app/assets/stylesheets/spree/backend/plugins/_flatpickr.scss +95 -0
  91. data/app/assets/stylesheets/spree/backend/plugins/_jquery_ui.scss +0 -117
  92. data/app/assets/stylesheets/spree/backend/plugins/_select2.scss +73 -24
  93. data/app/assets/stylesheets/spree/backend/shared/_base.scss +40 -0
  94. data/app/assets/stylesheets/spree/backend/shared/_forms.scss +38 -0
  95. data/app/assets/stylesheets/spree/backend/spree_admin.css.scss +5 -0
  96. data/app/assets/stylesheets/spree/backend/views/_order_payments.scss +12 -0
  97. data/app/assets/stylesheets/spree/backend/views/_product_properties.scss +11 -0
  98. data/app/assets/stylesheets/spree/backend/views/prototypes.scss +42 -0
  99. data/app/assets/stylesheets/spree/backend.css +1 -1
  100. data/app/controllers/spree/admin/general_settings_controller.rb +27 -0
  101. data/app/controllers/spree/admin/prices_controller.rb +39 -0
  102. data/app/controllers/spree/admin/stock_transfers_controller.rb +8 -1
  103. data/app/controllers/spree/admin/stores_controller.rb +61 -1
  104. data/app/controllers/spree/admin/taxons_controller.rb +5 -1
  105. data/app/helpers/spree/admin/base_helper.rb +25 -8
  106. data/app/helpers/spree/admin/navigation_helper.rb +50 -19
  107. data/app/helpers/spree/admin/orders_helper.rb +3 -3
  108. data/app/views/kaminari/{twitter-bootstrap-4 → admin-twitter-bootstrap-4}/_first_page.html.erb +1 -1
  109. data/app/views/kaminari/{twitter-bootstrap-4 → admin-twitter-bootstrap-4}/_gap.html.erb +1 -1
  110. data/app/views/kaminari/{twitter-bootstrap-4 → admin-twitter-bootstrap-4}/_last_page.html.erb +1 -1
  111. data/app/views/kaminari/{twitter-bootstrap-4 → admin-twitter-bootstrap-4}/_next_page.html.erb +1 -1
  112. data/app/views/kaminari/{twitter-bootstrap-4 → admin-twitter-bootstrap-4}/_page.html.erb +0 -0
  113. data/app/views/kaminari/{twitter-bootstrap-4 → admin-twitter-bootstrap-4}/_paginator.html.erb +1 -1
  114. data/app/views/kaminari/{twitter-bootstrap-4 → admin-twitter-bootstrap-4}/_prev_page.html.erb +1 -1
  115. data/app/views/spree/admin/adjustments/_adjustment.html.erb +2 -2
  116. data/app/views/spree/admin/adjustments/_adjustments_table.html.erb +16 -16
  117. data/app/views/spree/admin/adjustments/edit.html.erb +2 -2
  118. data/app/views/spree/admin/adjustments/index.html.erb +3 -3
  119. data/app/views/spree/admin/adjustments/new.html.erb +1 -1
  120. data/app/views/spree/admin/countries/_form.html.erb +9 -4
  121. data/app/views/spree/admin/countries/index.html.erb +27 -24
  122. data/app/views/spree/admin/customer_returns/_reimbursements_table.html.erb +37 -35
  123. data/app/views/spree/admin/customer_returns/_return_item_decision.html.erb +2 -0
  124. data/app/views/spree/admin/customer_returns/_return_item_selection.html.erb +45 -43
  125. data/app/views/spree/admin/customer_returns/index.html.erb +3 -1
  126. data/app/views/spree/admin/customer_returns/new.html.erb +1 -1
  127. data/app/views/spree/admin/general_settings/_form.html.erb +27 -0
  128. data/app/views/spree/admin/general_settings/edit.html.erb +4 -3
  129. data/app/views/spree/admin/images/edit.html.erb +2 -2
  130. data/app/views/spree/admin/images/index.html.erb +7 -7
  131. data/app/views/spree/admin/images/new.html.erb +2 -2
  132. data/app/views/spree/admin/log_entries/index.html.erb +4 -3
  133. data/app/views/spree/admin/option_types/_option_value_fields.html.erb +1 -1
  134. data/app/views/spree/admin/option_types/edit.html.erb +22 -20
  135. data/app/views/spree/admin/option_types/index.html.erb +27 -25
  136. data/app/views/spree/admin/orders/_adjustments.html.erb +26 -26
  137. data/app/views/spree/admin/orders/_line_items.html.erb +7 -7
  138. data/app/views/spree/admin/orders/_order_actions.html.erb +1 -1
  139. data/app/views/spree/admin/orders/_risk_analysis.html.erb +44 -42
  140. data/app/views/spree/admin/orders/_shipment.html.erb +6 -6
  141. data/app/views/spree/admin/orders/_shipment_manifest.html.erb +5 -5
  142. data/app/views/spree/admin/orders/_store_form.html.erb +3 -3
  143. data/app/views/spree/admin/orders/customer_details/_form.html.erb +1 -1
  144. data/app/views/spree/admin/orders/index.html.erb +135 -127
  145. data/app/views/spree/admin/payment_methods/index.html.erb +6 -4
  146. data/app/views/spree/admin/payments/_capture_events.html.erb +18 -16
  147. data/app/views/spree/admin/payments/_form.html.erb +1 -1
  148. data/app/views/spree/admin/payments/_list.html.erb +39 -37
  149. data/app/views/spree/admin/payments/index.html.erb +2 -3
  150. data/app/views/spree/admin/payments/new.html.erb +1 -1
  151. data/app/views/spree/admin/payments/show.html.erb +1 -1
  152. data/app/views/spree/admin/payments/source_forms/_gateway.html.erb +30 -30
  153. data/app/views/spree/admin/payments/source_views/_gateway.html.erb +20 -18
  154. data/app/views/spree/admin/payments/source_views/_storecredit.html.erb +28 -26
  155. data/app/views/spree/admin/prices/_variant_prices.html.erb +43 -0
  156. data/app/views/spree/admin/prices/index.html.erb +21 -0
  157. data/app/views/spree/admin/product_properties/_product_property_fields.html.erb +16 -4
  158. data/app/views/spree/admin/product_properties/index.html.erb +24 -19
  159. data/app/views/spree/admin/products/_add_stock_form.html.erb +1 -1
  160. data/app/views/spree/admin/products/_autocomplete.js.erb +27 -21
  161. data/app/views/spree/admin/products/_form.html.erb +40 -9
  162. data/app/views/spree/admin/products/edit.html.erb +1 -1
  163. data/app/views/spree/admin/products/index.html.erb +24 -19
  164. data/app/views/spree/admin/products/new.html.erb +11 -2
  165. data/app/views/spree/admin/products/stock.html.erb +3 -3
  166. data/app/views/spree/admin/promotion_categories/index.html.erb +4 -1
  167. data/app/views/spree/admin/promotions/_actions.html.erb +2 -2
  168. data/app/views/spree/admin/promotions/_form.html.erb +44 -17
  169. data/app/views/spree/admin/promotions/_promotion_action.html.erb +1 -1
  170. data/app/views/spree/admin/promotions/_promotion_rule.html.erb +1 -1
  171. data/app/views/spree/admin/promotions/_rules.html.erb +4 -4
  172. data/app/views/spree/admin/promotions/edit.html.erb +2 -2
  173. data/app/views/spree/admin/promotions/index.html.erb +5 -3
  174. data/app/views/spree/admin/promotions/new.html.erb +7 -6
  175. data/app/views/spree/admin/promotions/rules/_country.html.erb +1 -1
  176. data/app/views/spree/admin/promotions/rules/_item_total.html.erb +5 -5
  177. data/app/views/spree/admin/promotions/rules/_option_value.html.erb +6 -13
  178. data/app/views/spree/admin/promotions/rules/_product.html.erb +1 -1
  179. data/app/views/spree/admin/promotions/rules/_taxon.html.erb +1 -1
  180. data/app/views/spree/admin/properties/index.html.erb +5 -3
  181. data/app/views/spree/admin/prototypes/_prototypes.html.erb +30 -28
  182. data/app/views/spree/admin/prototypes/index.html.erb +21 -19
  183. data/app/views/spree/admin/prototypes/show.html.erb +21 -8
  184. data/app/views/spree/admin/refunds/edit.html.erb +2 -2
  185. data/app/views/spree/admin/refunds/new.html.erb +2 -2
  186. data/app/views/spree/admin/reimbursement_types/_form.html.erb +4 -4
  187. data/app/views/spree/admin/reimbursement_types/index.html.erb +4 -2
  188. data/app/views/spree/admin/reimbursements/edit.html.erb +66 -63
  189. data/app/views/spree/admin/reimbursements/index.html.erb +21 -20
  190. data/app/views/spree/admin/reimbursements/show.html.erb +66 -60
  191. data/app/views/spree/admin/reports/index.html.erb +18 -17
  192. data/app/views/spree/admin/reports/sales_total.html.erb +20 -19
  193. data/app/views/spree/admin/return_authorizations/_form.html.erb +3 -2
  194. data/app/views/spree/admin/return_authorizations/edit.html.erb +3 -3
  195. data/app/views/spree/admin/return_authorizations/index.html.erb +3 -1
  196. data/app/views/spree/admin/return_authorizations/new.html.erb +2 -2
  197. data/app/views/spree/admin/return_index/customer_returns.html.erb +4 -4
  198. data/app/views/spree/admin/return_index/return_authorizations.html.erb +4 -4
  199. data/app/views/spree/admin/roles/index.html.erb +21 -19
  200. data/app/views/spree/admin/shared/_account_nav.html.erb +51 -65
  201. data/app/views/spree/admin/shared/_address_form.html.erb +31 -73
  202. data/app/views/spree/admin/shared/_cal_close.html.erb +10 -0
  203. data/app/views/spree/admin/shared/_content_header.html.erb +40 -21
  204. data/app/views/spree/admin/shared/_edit_resource_links.html.erb +2 -2
  205. data/app/views/spree/admin/shared/_header.html.erb +14 -11
  206. data/app/views/spree/admin/shared/_index_table_options.html.erb +5 -7
  207. data/app/views/spree/admin/shared/_main_menu.html.erb +25 -14
  208. data/app/views/spree/admin/shared/_new_resource_links.html.erb +2 -2
  209. data/app/views/spree/admin/shared/_order_summary.html.erb +2 -0
  210. data/app/views/spree/admin/shared/_order_tabs.html.erb +9 -9
  211. data/app/views/spree/admin/shared/_product_tabs.html.erb +13 -5
  212. data/app/views/spree/admin/shared/_refunds.html.erb +31 -29
  213. data/app/views/spree/admin/shared/_report_order_criteria.html.erb +27 -6
  214. data/app/views/spree/admin/shared/_sidebar.html.erb +19 -1
  215. data/app/views/spree/admin/shared/_table_filter.html.erb +3 -3
  216. data/app/views/spree/admin/shared/_translations.html.erb +33 -1
  217. data/app/views/spree/admin/shared/_version.html.erb +1 -1
  218. data/app/views/spree/admin/shared/named_types/_index.html.erb +3 -1
  219. data/app/views/spree/admin/shipping_categories/index.html.erb +3 -1
  220. data/app/views/spree/admin/shipping_methods/index.html.erb +3 -1
  221. data/app/views/spree/admin/state_changes/index.html.erb +5 -2
  222. data/app/views/spree/admin/states/_state_list.html.erb +25 -24
  223. data/app/views/spree/admin/states/index.html.erb +1 -1
  224. data/app/views/spree/admin/stock_locations/_transfer_stock_form.html.erb +2 -2
  225. data/app/views/spree/admin/stock_locations/index.html.erb +3 -1
  226. data/app/views/spree/admin/stock_movements/index.html.erb +28 -26
  227. data/app/views/spree/admin/stock_transfers/_stock_movements.html.erb +20 -18
  228. data/app/views/spree/admin/stock_transfers/index.html.erb +6 -4
  229. data/app/views/spree/admin/stock_transfers/new.html.erb +3 -3
  230. data/app/views/spree/admin/stock_transfers/show.html.erb +3 -3
  231. data/app/views/spree/admin/store_credit_categories/index.html.erb +3 -1
  232. data/app/views/spree/admin/store_credits/index.html.erb +3 -1
  233. data/app/views/spree/admin/stores/_form.html.erb +128 -68
  234. data/app/views/spree/admin/stores/edit.html.erb +1 -1
  235. data/app/views/spree/admin/stores/index.html.erb +4 -2
  236. data/app/views/spree/admin/tax_categories/index.html.erb +29 -27
  237. data/app/views/spree/admin/tax_rates/index.html.erb +3 -1
  238. data/app/views/spree/admin/taxonomies/_list.html.erb +24 -22
  239. data/app/views/spree/admin/taxonomies/edit.html.erb +2 -2
  240. data/app/views/spree/admin/taxonomies/index.html.erb +1 -1
  241. data/app/views/spree/admin/taxons/_form.html.erb +3 -3
  242. data/app/views/spree/admin/taxons/_taxon_table.html.erb +24 -22
  243. data/app/views/spree/admin/taxons/edit.html.erb +6 -2
  244. data/app/views/spree/admin/taxons/index.html.erb +1 -1
  245. data/app/views/spree/admin/users/_lifetime_stats.html.erb +24 -23
  246. data/app/views/spree/admin/users/_sidebar.html.erb +5 -5
  247. data/app/views/spree/admin/users/_user_page_actions.html.erb +1 -1
  248. data/app/views/spree/admin/users/edit.html.erb +2 -2
  249. data/app/views/spree/admin/users/index.html.erb +25 -23
  250. data/app/views/spree/admin/users/items.html.erb +3 -2
  251. data/app/views/spree/admin/users/orders.html.erb +30 -29
  252. data/app/views/spree/admin/variants/_autocomplete_line_items_stock.js.erb +3 -3
  253. data/app/views/spree/admin/variants/_autocomplete_stock.js.erb +2 -2
  254. data/app/views/spree/admin/variants/_form.html.erb +14 -2
  255. data/app/views/spree/admin/variants/_split.js.erb +2 -2
  256. data/app/views/spree/admin/variants/index.html.erb +7 -5
  257. data/app/views/spree/admin/zones/index.html.erb +4 -4
  258. data/app/views/spree/layouts/admin.html.erb +33 -27
  259. data/config/initializers/ransack.rb +31 -0
  260. data/config/routes.rb +1 -0
  261. data/lib/spree/backend.rb +2 -0
  262. data/lib/spree_backend.rb +0 -1
  263. data/spec/fixtures/thinking-cat.jpg +0 -0
  264. data/spree_backend.gemspec +6 -4
  265. data/vendor/assets/javascripts/js.cookie.js +154 -156
  266. data/vendor/assets/javascripts/purify.js +1217 -0
  267. data/vendor/assets/javascripts/sortable.js +3709 -0
  268. data/vendor/assets/stylesheets/animate.css +7 -3156
  269. data/vendor/assets/stylesheets/jquery.jstree/themes/spree/style.scss +23 -9
  270. metadata +138 -25
@@ -0,0 +1,6 @@
1
+ <svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2">
2
+ <g fill-rule="nonzero" stroke="currentColor" stroke-width="9.5">
3
+ <path fill="currentColor" d="M401.722 230.445c23.142-14.24 38.654-39.707 38.654-68.787 0-44.569-36.308-80.829-80.932-80.829-44.623 0-80.932 36.26-80.932 80.829 0 29.08 15.512 54.547 38.655 68.787-49.972 11.194-85.037 41.775-85.037 78.782 0 30.285 80.031 38.366 127.314 38.366 47.283 0 127.314-8.081 127.314-38.366 0-37.007-35.065-67.588-85.036-78.782zm-106.538-68.787c0-35.375 28.83-64.156 64.26-64.156 35.43 0 64.26 28.781 64.26 64.156 0 35.376-28.83 64.151-64.26 64.151-35.43 0-64.26-28.775-64.26-64.151zm64.26 169.262c-67.969 0-108.655-14.338-110.637-21.749.052-36.777 49.666-66.689 110.637-66.689 60.965 0 110.575 29.907 110.636 66.678-1.932 7.406-42.622 21.76-110.636 21.76z"/>
4
+ <path fill="currentColor" d="M218.769 305.288c26.479-15.872 44.227-44.258 44.227-76.67 0-49.677-41.543-90.092-92.599-90.092-51.056 0-92.599 40.415-92.599 90.092 0 32.412 17.748 60.798 44.227 76.67-57.175 12.477-97.294 46.562-97.294 87.811 0 33.755 91.567 42.762 145.666 42.762 54.099 0 145.666-9.007 145.666-42.762 0-41.249-40.119-75.334-97.294-87.811zm-121.895-76.67c0-39.429 32.986-71.509 73.523-71.509s73.523 32.08 73.523 71.509c0 39.43-32.986 71.503-73.523 71.503s-73.523-32.073-73.523-71.503zm73.523 188.66c-77.767 0-124.318-15.982-126.585-24.242.059-40.991 56.825-74.331 126.585-74.331 69.753 0 126.514 33.333 126.584 74.319-2.21 8.254-48.766 24.254-126.584 24.254z"/>
5
+ </g>
6
+ </svg>
@@ -0,0 +1,8 @@
1
+ <svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2">
2
+ <path fill="currentColor" d="M256 192c0 35.328-28.672 64-64 64 0 35.328 28.672 64 64 64s64-28.672 64-64-28.672-64-64-64zm0-128C124.736 64 0 212.736 0 256c0 43.264 124.736 192 256 192s256-148.736 256-192c0-43.264-124.736-192-256-192zm0 320c-70.688 0-128-57.312-128-128s57.312-128 128-128 128 57.312 128 128-57.312 128-128 128z" fill-rule="nonzero"/>
3
+ </svg>
4
+
5
+
6
+ <!-- To give Spree backwards compatability this file is duplicated in the following SVG files -->
7
+ <!-- VIEW EYE-OPEN -->
8
+ <!-- If you update this file, be sure to make the same changes in all of the files above -->
@@ -0,0 +1,7 @@
1
+ <svg width="100%" height="100%" viewBox="0 0 512 512" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
2
+ <g transform="matrix(5.37908e-15,-16.6134,-16.6134,-5.37908e-15,470.536,472.199)">
3
+ <path d="M14.061,12.927L24.78,23.646C25.073,23.939 25.073,24.414 24.78,24.707C24.487,25 24.013,25 23.72,24.707L13,13.987L2.28,24.707C1.987,25 1.513,25 1.22,24.707C0.927,24.414 0.927,23.939 1.22,23.646L11.939,12.927L1.22,2.207C0.927,1.914 0.927,1.439 1.22,1.146C1.366,1 1.558,0.927 1.75,0.927C1.942,0.927 2.134,1 2.28,1.146L13,11.866L23.72,1.146C23.866,1 24.058,0.927 24.25,0.927C24.442,0.927 24.634,1 24.78,1.146C25.073,1.439 25.073,1.914 24.78,2.207L14.061,12.927Z" style="fill-rule:nonzero;stroke:currentColor;stroke-width:2.05px;"/>
4
+ </g>
5
+ </svg>
6
+
7
+ <!-- CANCEL CLOSE VOID-->
@@ -4,74 +4,83 @@ under the spree namespace that do stuff we find helpful.
4
4
  Hopefully, this will evolve into a propper class.
5
5
  **/
6
6
 
7
- /* global Cookies, AUTH_TOKEN, order_number */
7
+ /* global AUTH_TOKEN, order_number, Sortable, flatpickr, DOMPurify */
8
+
9
+ //= require spree/backend/flatpickr_locals
8
10
 
9
11
  jQuery(function ($) {
10
12
  // Add some tips
11
- $('.with-tip').tooltip()
13
+ $('.with-tip').each(function() {
14
+ $(this).tooltip({
15
+ container: $(this)
16
+ })
17
+ })
18
+
19
+ $('.with-tip').on('show.bs.tooltip', function(event) {
20
+ if (('ontouchstart' in window)) {
21
+ event.preventDefault()
22
+ }
23
+ })
12
24
 
13
25
  $('.js-show-index-filters').click(function () {
14
26
  $('.filter-well').slideToggle()
15
27
  $(this).parents('.filter-wrap').toggleClass('collapsed')
16
- $('span.icon', $(this)).toggleClass('icon-chevron-down')
17
28
  })
18
29
 
19
- $('#main-sidebar').find('[data-toggle="collapse"]').on('click', function () {
20
- if ($(this).find('.icon-chevron-left').length === 1) {
21
- $(this).find('.icon-chevron-left').removeClass('icon-chevron-left').addClass('icon-chevron-down')
22
- } else {
23
- $(this).find('.icon-chevron-down').removeClass('icon-chevron-down').addClass('icon-chevron-left')
24
- }
25
- })
26
-
27
- // Sidebar nav toggle functionality
28
- var sidebar_toggle = $('#sidebar-toggle')
30
+ // Responsive Menus
31
+ var body = $('body')
32
+ var modalBackdrop = $('#multi-backdrop')
33
+
34
+ // Fail safe on resize
35
+ var resizeTimer;
36
+ window.addEventListener('resize', function () {
37
+ document.body.classList.remove('modal-open', 'sidebar-open', 'contextualSideMenu-open');
38
+ document.body.classList.add('resize-animation-stopper');
39
+ clearTimeout(resizeTimer);
40
+ resizeTimer = setTimeout(function () {
41
+ document.body.classList.remove('resize-animation-stopper');
42
+ }, 400);
43
+ });
44
+
45
+ function closeAllMenus() {
46
+ body.removeClass()
47
+ body.addClass('admin')
48
+ modalBackdrop.removeClass('show')
49
+ }
29
50
 
30
- sidebar_toggle.on('click', function() {
31
- var wrapper = $('#wrapper')
32
- var main = $('#main-part')
33
- var sidebar = $('#main-sidebar')
34
- var version = $('.spree-version')
35
- var collapsed = sidebar.find('[aria-expanded="true"]')
36
- var collapsedIcons = sidebar.find('.icon-chevron-down')
51
+ modalBackdrop.click(closeAllMenus)
37
52
 
38
- wrapper.toggleClass('sidebar-minimized')
53
+ // Main Menu Functionality
54
+ var sidebarOpen = $('#sidebar-open')
55
+ var sidebarClose = $('#sidebar-close')
56
+ var activeItem = $('#main-sidebar').find('.selected')
39
57
 
40
- collapsed
41
- .attr('aria-expanded', 'false')
42
- .next()
43
- .removeClass('show')
58
+ activeItem.closest('.nav-sidebar').addClass('active-option')
59
+ activeItem.closest('.nav-pills').addClass('in show')
44
60
 
45
- collapsedIcons
46
- .removeClass('icon-chevron-down')
47
- .addClass('icon-chevron-left')
61
+ function openMenu() {
62
+ closeAllMenus()
63
+ body.addClass('sidebar-open modal-open')
64
+ modalBackdrop.addClass('show')
65
+ }
66
+ sidebarOpen.click(openMenu)
67
+ sidebarClose.click(closeAllMenus)
48
68
 
49
- // these should match `spree/backend/app/helpers/spree/admin/navigation_helper.rb#main_part_classes`
50
- main
51
- .toggleClass('col-12 sidebar-collapsed')
52
- .toggleClass('col-9 offset-3 col-md-10 offset-md-2')
69
+ // Contextual Sidebar Menu
70
+ var contextualSidebarMenuToggle = $('#contextual-menu-toggle')
71
+ var contextualSidebarMenuClose = $('#contextual-menu-close')
53
72
 
54
- if (wrapper.hasClass('sidebar-minimized')) {
55
- Cookies.set('sidebar-minimized', 'true', { path: '/admin' })
56
- version.removeClass('d-md-block')
73
+ function toggleContextualMenu() {
74
+ if (document.body.classList.contains('contextualSideMenu-open')) {
75
+ closeAllMenus()
57
76
  } else {
58
- Cookies.set('sidebar-minimized', 'false', { path: '/admin' })
59
- version.addClass('d-md-block')
60
- }
61
- })
62
-
63
- $('.sidebar-menu-item').mouseover(function () {
64
- if ($('#wrapper').hasClass('sidebar-minimized')) {
65
- $(this).addClass('menu-active')
66
- $(this).find('ul.nav').addClass('submenu-active')
77
+ closeAllMenus()
78
+ body.addClass('contextualSideMenu-open modal-open')
79
+ modalBackdrop.addClass('show')
67
80
  }
68
- })
69
- $('.sidebar-menu-item').mouseout(function () {
70
- if ($('#wrapper').hasClass('sidebar-minimized')) {
71
- $(this).removeClass('menu-active')
72
- $(this).find('ul.nav').removeClass('submenu-active')
73
- }
74
- })
81
+ }
82
+ contextualSidebarMenuToggle.click(toggleContextualMenu)
83
+ contextualSidebarMenuClose.click(toggleContextualMenu)
75
84
 
76
85
  // TODO: remove this js temp behaviour and fix this decent
77
86
  // Temp quick search
@@ -84,28 +93,6 @@ jQuery(function ($) {
84
93
  return false
85
94
  })
86
95
 
87
- // Main menu active item submenu show
88
- var active_item = $('#main-sidebar').find('.selected')
89
- active_item.closest('.nav-pills').addClass('in show')
90
- active_item.closest('.nav-sidebar')
91
- .find('.icon-chevron-left')
92
- .removeClass('icon-chevron-left')
93
- .addClass('icon-chevron-down')
94
-
95
- // Replace ▼ and ▲ in sort_link with nicer icons
96
- $('.sort_link').each(function () {
97
- // Remove the &nbsp in the text
98
- var sortLinkText = $(this).text().replace('\xA0', '')
99
-
100
- if (sortLinkText.indexOf('▼') >= 0) {
101
- $(this).text(sortLinkText.replace('▼', ''))
102
- $(this).append('<span class="icon icon-chevron-down"></span>')
103
- } else if (sortLinkText.indexOf('▲') >= 0) {
104
- $(this).text(sortLinkText.replace('▲', ''))
105
- $(this).append('<span class="icon icon-chevron-up"></span>')
106
- }
107
- })
108
-
109
96
  // Clickable ransack filters
110
97
  $('.js-add-filter').click(function () {
111
98
  var ransackField = $(this).data('ransack-field')
@@ -148,8 +135,9 @@ jQuery(function ($) {
148
135
  }
149
136
 
150
137
  label = ransackField(label.text()) + ': ' + ransackValue
138
+ var cleanLabel = DOMPurify.sanitize(label)
151
139
 
152
- filter = '<span class="js-filter badge badge-secondary" data-ransack-field="' + ransackFieldId + '">' + label + '<span class="icon icon-delete js-delete-filter"></span></span>'
140
+ filter = '<span class="js-filter badge badge-secondary" data-ransack-field="' + ransackFieldId + '">' + cleanLabel + '<i class="icon icon-cancel ml-2 js-delete-filter"></i></span>'
153
141
  $(".js-filters").append(filter).show()
154
142
  }
155
143
  })
@@ -179,20 +167,46 @@ jQuery(function ($) {
179
167
  $('#table-filter form').append(perPageInput)
180
168
  }
181
169
  })
170
+ })
171
+
172
+ function handleAlert (element) {
173
+ element.classList.add('animate__animated', 'animate__bounceInUp')
174
+ element.addEventListener('animationend', function () {
175
+ element.classList.remove('animate__bounceInUp')
176
+ element.classList.add('animate__fadeOutDownBig', 'animate__delay-3s')
177
+ })
178
+ }
182
179
 
183
- // Make flash messages disappear
184
- setTimeout(function () { $('.alert-auto-disappear').slideUp() }, 5000)
180
+ // Triggers alert if required on document ready.
181
+ $(document).ready(function () {
182
+ var element = document.querySelector('.flash-alert')
183
+
184
+ if (element) {
185
+ handleAlert(element)
186
+ }
185
187
  })
186
188
 
187
189
  $.fn.visible = function (cond) { this[ cond ? 'show' : 'hide' ]() }
190
+ // Triggers alerts when requested by javascript.
188
191
  // eslint-disable-next-line camelcase
189
192
  function show_flash (type, message) {
193
+ var cleanMessage = DOMPurify.sanitize(message)
194
+ var existingAlert = document.querySelector('.flash-alert')
195
+
196
+ if (existingAlert) {
197
+ existingAlert.remove()
198
+ }
199
+
190
200
  var flashDiv = $('.alert-' + type)
191
201
  if (flashDiv.length === 0) {
192
- flashDiv = $('<div class="alert alert-' + type + '" />')
193
- $('#content').prepend(flashDiv)
202
+ flashDiv = $('<div class="d-flex justify-content-center position-fixed flash-alert">' +
203
+ '<div class="alert alert-' + type + ' mx-2">' + cleanMessage + '</div></div>')
204
+
205
+ $('body').append(flashDiv)
206
+
207
+ var ajaxFlashNotfication = document.querySelector('.flash-alert')
208
+ handleAlert(ajaxFlashNotfication)
194
209
  }
195
- flashDiv.html(message).show().delay(10000).slideUp()
196
210
  }
197
211
 
198
212
  // Apply to individual radio button that makes another element visible when checked
@@ -208,31 +222,34 @@ $.fn.radioControlsVisibilityOfElement = function (dependentElementSelector) {
208
222
  if (this.checked) { this.click() }
209
223
  })
210
224
  }
211
- // eslint-disable-next-line camelcase
212
- function handle_date_picker_fields () {
213
- $('.datepicker').datepicker({
225
+
226
+ document.addEventListener('DOMContentLoaded', function() {
227
+ var dateFrom = flatpickr('.datePickerFrom', {
228
+ time_24hr: true,
214
229
  dateFormat: Spree.translations.date_picker,
215
- dayNames: Spree.translations.abbr_day_names,
216
- dayNamesMin: Spree.translations.abbr_day_names,
217
- firstDay: Spree.translations.first_day,
218
- monthNames: Spree.translations.month_names,
219
- prevText: Spree.translations.previous,
220
- nextText: Spree.translations.next,
221
- showOn: 'focus',
222
- showAnim: ''
230
+ monthSelectorType: 'static',
231
+ onChange: function(selectedDates) {
232
+ dateTo.set('minDate', selectedDates[0])
233
+ }
223
234
  })
224
235
 
225
- // Correctly display range dates
226
- $('.date-range-filter .datepicker-from').datepicker('option', 'onSelect', function (selectedDate) {
227
- $('.date-range-filter .datepicker-to').datepicker('option', 'minDate', selectedDate)
236
+ var dateTo = flatpickr('.datePickerTo', {
237
+ monthSelectorType: 'static',
238
+ time_24hr: true,
239
+ dateFormat: Spree.translations.date_picker,
240
+ onChange: function(selectedDates) {
241
+ dateFrom.set('maxDate', selectedDates[0])
242
+ }
228
243
  })
229
- $('.date-range-filter .datepicker-to').datepicker('option', 'onSelect', function (selectedDate) {
230
- $('.date-range-filter .datepicker-from').datepicker('option', 'maxDate', selectedDate)
244
+
245
+ flatpickr('.datepicker', {
246
+ monthSelectorType: 'static',
247
+ time_24hr: true,
248
+ dateFormat: Spree.translations.date_picker
231
249
  })
232
- }
250
+ })
233
251
 
234
- $(document).ready(function(){
235
- handle_date_picker_fields()
252
+ $(document).ready(function() {
236
253
  $('.observe_field').on('change', function() {
237
254
  target = $(this).data('update')
238
255
  $(target).hide()
@@ -277,7 +294,10 @@ $(document).ready(function(){
277
294
  _method: 'delete',
278
295
  authenticity_token: AUTH_TOKEN
279
296
  },
280
- dataType: 'script'
297
+ dataType: 'script',
298
+ complete: function() {
299
+ el.blur()
300
+ }
281
301
  }).done(function () {
282
302
  var $flash_element = $('.alert-success')
283
303
  if ($flash_element.length) {
@@ -288,6 +308,8 @@ $(document).ready(function(){
288
308
  }).fail(function (response) {
289
309
  show_flash('error', response.responseText)
290
310
  })
311
+ } else {
312
+ el.blur()
291
313
  }
292
314
  return false
293
315
  })
@@ -317,7 +339,7 @@ $(document).ready(function(){
317
339
  return false
318
340
  })
319
341
 
320
- $('body').on('click', '.select_properties_from_prototype', function(){
342
+ $('body').on('click', '.select_properties_from_prototype', function() {
321
343
  $('#busy_indicator').show()
322
344
  var clicked_link = $(this)
323
345
  $.ajax({
@@ -331,60 +353,47 @@ $(document).ready(function(){
331
353
  return false
332
354
  })
333
355
 
334
- // Fix sortable helper
335
- var fixHelper = function (e, ui) {
336
- ui.children().each(function () {
337
- $(this).width($(this).width())
338
- })
339
- return ui
356
+ // Sortable List Up-Down
357
+ var parentEl = document.getElementsByClassName("sortable")[0];
358
+ if (parentEl) {
359
+ var element = parentEl.querySelector('tbody')
340
360
  }
341
361
 
342
- $('table.sortable').ready(function () {
343
- var tdCount = $(this).find('tbody tr:first-child td').length
344
- $('table.sortable tbody').sortable(
345
- {
346
- handle: '.handle',
347
- helper: fixHelper,
348
- placeholder: 'ui-sortable-placeholder',
349
- update: function(event, ui) {
350
- var tbody = this
351
- $('#progress').show()
352
- var positions = { authenticity_token: AUTH_TOKEN }
353
- $.each($('tr', tbody), function(position, obj) {
354
- reg = /spree_(\w+_?)+_(\d+)/
355
- parts = reg.exec($(obj).prop('id'))
356
- if (parts) {
357
- positions['positions[' + parts[2] + ']'] = position + 1
358
- }
359
- })
360
- $.ajax({
361
- type: 'POST',
362
- dataType: 'script',
363
- url: $(ui.item).closest('table.sortable').data('sortable-link'),
364
- data: positions
365
- }).done(function () {
366
- $('#progress').hide()
367
- })
368
- },
369
- start: function (event, ui) {
370
- // Set correct height for placehoder (from dragged tr)
371
- ui.placeholder.height(ui.item.height())
372
- // Fix placeholder content to make it correct width
373
- ui.placeholder.html("<td colspan='" + (tdCount - 1) + "'></td><td class='actions'></td>")
374
- },
375
- stop: function (event, ui) {
376
- // Fix odd/even classes after reorder
377
- $('table.sortable tr:even').removeClass('odd even').addClass('even')
378
- $('table.sortable tr:odd').removeClass('odd even').addClass('odd')
379
- }
380
-
381
- })
382
- })
362
+ if (element) {
363
+ Sortable.create(element, {
364
+ handle: '.move-handle',
365
+ animation: 550,
366
+ ghostClass: 'bg-light',
367
+ dragClass: "sortable-drag-v",
368
+ easing: 'cubic-bezier(1, 0, 0, 1)',
369
+ swapThreshold: 0.9,
370
+ forceFallback: true,
371
+ onEnd: function (evt) {
372
+ var itemEl = evt.item
373
+ var positions = { authenticity_token: AUTH_TOKEN }
374
+ $.each($('tr', element), function(position, obj) {
375
+ reg = /spree_(\w+_?)+_(\d+)/
376
+ parts = reg.exec($(obj).prop('id'))
377
+ if (parts) {
378
+ positions['positions[' + parts[2] + ']'] = position + 1
379
+ }
380
+ })
381
+ $.ajax({
382
+ type: 'POST',
383
+ dataType: 'json',
384
+ url: $(itemEl).closest('table.sortable').data('sortable-link'),
385
+ data: positions
386
+ })
387
+ }
388
+ })
389
+ }
383
390
 
391
+ // Close notifications
384
392
  $('a.dismiss').click(function () {
385
393
  $(this).parent().fadeOut()
386
394
  })
387
395
 
396
+ // Utility
388
397
  window.Spree.advanceOrder = function() {
389
398
  $.ajax({
390
399
  type: 'PUT',
@@ -59,6 +59,7 @@ $(document).ready(function () {
59
59
  if (billAddress) {
60
60
  $('#order_bill_address_attributes_firstname').val(billAddress.firstname)
61
61
  $('#order_bill_address_attributes_lastname').val(billAddress.lastname)
62
+ $('#order_bill_address_attributes_company').val(billAddress.company)
62
63
  $('#order_bill_address_attributes_address1').val(billAddress.address1)
63
64
  $('#order_bill_address_attributes_address2').val(billAddress.address2)
64
65
  $('#order_bill_address_attributes_city').val(billAddress.city)
@@ -0,0 +1,37 @@
1
+ /* global flatpickr */
2
+ document.addEventListener('DOMContentLoaded', function() {
3
+ flatpickr.l10ns.default.firstDayOfWeek = Spree.translations.firstDay
4
+ flatpickr.l10ns.default.rangeSeparator = Spree.translations.rangeSep
5
+ flatpickr.l10ns.default.weekAbbreviation = Spree.translations.weekAbbr
6
+ flatpickr.l10ns.default.scrollTitle = Spree.translations.scrollTitle
7
+ flatpickr.l10ns.default.toggleTitle = Spree.translations.toggleTitle
8
+ flatpickr.l10ns.default.amPM = [Spree.translations.am, Spree.translations.pm]
9
+ flatpickr.l10ns.default.yearAriaLabel = Spree.translations.yearAriaLabel
10
+ flatpickr.l10ns.default.hourAriaLabel = Spree.translations.hourAriaLabel
11
+ flatpickr.l10ns.default.minuteAriaLabel = Spree.translations.minuteAriaLabel
12
+ flatpickr.l10ns.default.weekdays = {
13
+ shorthand: [
14
+ Spree.translations.sun,
15
+ Spree.translations.mon,
16
+ Spree.translations.tue,
17
+ Spree.translations.wed,
18
+ Spree.translations.thu,
19
+ Spree.translations.fri,
20
+ Spree.translations.sat]
21
+ }
22
+ flatpickr.l10ns.default.months = {
23
+ longhand: [
24
+ Spree.translations.lh_jan,
25
+ Spree.translations.lh_feb,
26
+ Spree.translations.lh_mar,
27
+ Spree.translations.lh_apr,
28
+ Spree.translations.lh_may,
29
+ Spree.translations.lh_jun,
30
+ Spree.translations.lh_jul,
31
+ Spree.translations.lh_aug,
32
+ Spree.translations.lh_sep,
33
+ Spree.translations.lh_oct,
34
+ Spree.translations.lh_nov,
35
+ Spree.translations.lh_dec]
36
+ }
37
+ })
@@ -0,0 +1,38 @@
1
+ //= require spree/backend
2
+
3
+ $(document).ready(function () {
4
+ $.expr[':'].Contains = function (a, i, m) {
5
+ return (
6
+ (a.textContent || a.innerText || '')
7
+ .toUpperCase()
8
+ .indexOf(m[3].toUpperCase()) >= 0
9
+ )
10
+ }
11
+
12
+ function listFilter (list) {
13
+ var input = $('#variant-price-search')
14
+
15
+ $(input)
16
+ .change(function () {
17
+ var filter = $(this).val()
18
+ if (filter) {
19
+ $(list).find('.panel-title:not(:Contains(' + filter + '))').parent().hide()
20
+ $(list).find('.panel-title:Contains(' + filter + ')').parent().show()
21
+ } else {
22
+ $(list)
23
+ .find('.panel')
24
+ .parent()
25
+ .show()
26
+ }
27
+ return false
28
+ })
29
+ .keyup(function () {
30
+ $(this).change()
31
+ })
32
+ }
33
+
34
+ // ondomready
35
+ $(function () {
36
+ listFilter($('#variant-prices'))
37
+ })
38
+ })
@@ -95,8 +95,8 @@ jQuery(function ($) {
95
95
  }
96
96
 
97
97
  PaymentView.prototype.$new_button = function (action) {
98
- return $('<a><span class="icon icon-' + action + '"></span></a>').attr({
99
- 'class': 'payment-action-' + action + ' btn btn-default btn-sm icon-link no-text with-tip',
98
+ return $('<a><i class="icon icon-' + action + '"></i></a>').attr({
99
+ 'class': 'payment-action-' + action + ' btn btn-outline-secondary btn-sm no-filter',
100
100
  title: Spree.translations[action]
101
101
  }).data({
102
102
  action: action
@@ -203,8 +203,9 @@ jQuery(function ($) {
203
203
  var amount = this.constructor.normalize_amount(this.payment.display_amount())
204
204
  return $('<input />').prop({
205
205
  id: 'amount',
206
+ class: 'form-control',
206
207
  value: amount
207
- }).width(width).css({
208
+ }).width(width * 2).css({
208
209
  'text-align': 'right'
209
210
  })
210
211
  }
@@ -1,12 +1,23 @@
1
- //= require jquery.payment
1
+ /* global Cleave */
2
+
2
3
  $(document).ready(function () {
3
4
  if ($('#new_payment').length) {
4
- $('.cardNumber').payment('formatCardNumber')
5
- $('.cardExpiry').payment('formatCardExpiry')
6
- $('.cardCode').payment('formatCardCVC')
7
-
8
- $('.cardNumber').change(function () {
9
- $('.ccType').val($.payment.cardType(this.value))
5
+ /* eslint-disable no-new */
6
+ new Cleave('.cardNumber', {
7
+ creditCard: true,
8
+ onCreditCardTypeChanged: function (type) {
9
+ $('.ccType').val(type)
10
+ }
11
+ })
12
+ /* eslint-disable no-new */
13
+ new Cleave('.cardExpiry', {
14
+ date: true,
15
+ datePattern: ['m', 'Y']
16
+ })
17
+ /* eslint-disable no-new */
18
+ new Cleave('.cardCode', {
19
+ numericOnly: true,
20
+ blocks: [3]
10
21
  })
11
22
 
12
23
  $('.payment_methods_radios').click(
@@ -35,16 +46,5 @@ $(document).ready(function () {
35
46
  }
36
47
  }
37
48
  )
38
-
39
- $('.cvvLink').click(function (event) {
40
- var windowName = 'cvv_info'
41
- var windowOptions = 'left=20,top=20,width=500,height=500,toolbar=0,resizable=0,scrollbars=1'
42
- window.open($(this).prop('href'), windowName, windowOptions)
43
- event.preventDefault()
44
- })
45
-
46
- $('select.jump_menu').change(function () {
47
- window.location = this.options[this.selectedIndex].value
48
- })
49
49
  }
50
50
  })
@@ -147,7 +147,7 @@ function initProductActions () {
147
147
  var quantity = $container.find('input[name="add_quantity"]').val()
148
148
  if (variant_id) {
149
149
  // Add to the table
150
- var newRow = '<tr><td>' + productName + '</td><td>' + quantity + '</td><td><img src="/assets/admin/icons/cross.png"/></td></tr>'
150
+ var newRow = '<tr><td>' + product_name + '</td><td>' + quantity + '</td><td><i class="icon icon-cancel"></i></td></tr>'
151
151
  $container.find('table').append(newRow)
152
152
  // Add to serialized string in hidden text field
153
153
  var $hiddenField = $container.find('.line_items_string')
@@ -1,7 +1,21 @@
1
- jQuery(function ($) {
2
- // Make select beautiful
1
+ document.addEventListener('DOMContentLoaded', function() {
2
+ // Inititate Select2 on any select element with the class .select2
3
3
  $('select.select2').select2({
4
- allowClear: true,
5
- dropdownAutoWidth: true
4
+ allowClear: true
5
+ })
6
+
7
+ // BELOW: z-index fix for Select2 v3.x to lower the z-index of an opened Select2.
8
+ // The javascript below is not needed if Spree is updated to use Select2 v4.x
9
+ window.addEventListener('click', function(e) {
10
+ var select2Drop = document.getElementById('select2-drop')
11
+
12
+ if (select2Drop) {
13
+ if (select2Drop.contains(e.target)) {
14
+ // Clicking inside the Select2 dropdown does nothing...
15
+ } else {
16
+ // Clicking outside the Select2 dropdown close all open Select2 dropdowns.
17
+ $('*').select2('close')
18
+ }
19
+ }
6
20
  })
7
21
  })
@@ -6,7 +6,8 @@ $(function () {
6
6
  $.ajax({
7
7
  type: this.method,
8
8
  url: this.action,
9
- data: $(this).serialize()
9
+ data: $(this).serialize(),
10
+ dataType: 'json'
10
11
  })
11
12
  return false
12
13
  })