spree_backend 4.1.13 → 4.2.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (305) 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.js +5 -3
  66. data/app/assets/javascripts/spree/backend/address_states.js +20 -9
  67. data/app/assets/javascripts/spree/backend/admin.js +160 -149
  68. data/app/assets/javascripts/spree/backend/calculator.js +2 -0
  69. data/app/assets/javascripts/spree/backend/checkouts/edit.js +99 -70
  70. data/app/assets/javascripts/spree/backend/flatpickr_locals.js +37 -0
  71. data/app/assets/javascripts/spree/backend/line_items_on_order_edit.js +1 -1
  72. data/app/assets/javascripts/spree/backend/multi_currency.js +38 -0
  73. data/app/assets/javascripts/spree/backend/option_type_autocomplete.js +31 -37
  74. data/app/assets/javascripts/spree/backend/option_value_picker.js +50 -23
  75. data/app/assets/javascripts/spree/backend/payments/edit.js +4 -3
  76. data/app/assets/javascripts/spree/backend/payments/new.js +18 -18
  77. data/app/assets/javascripts/spree/backend/product_picker.js +35 -19
  78. data/app/assets/javascripts/spree/backend/promotions.js +33 -28
  79. data/app/assets/javascripts/spree/backend/shipments.js +28 -37
  80. data/app/assets/javascripts/spree/backend/spree-select2.js +38 -5
  81. data/app/assets/javascripts/spree/backend/stock_management.js +2 -1
  82. data/app/assets/javascripts/spree/backend/stock_transfer.js +32 -13
  83. data/app/assets/javascripts/spree/backend/taxon_autocomplete.js +30 -43
  84. data/app/assets/javascripts/spree/backend/taxon_tree_menu.js +4 -4
  85. data/app/assets/javascripts/spree/backend/taxonomy.js +8 -1
  86. data/app/assets/javascripts/spree/backend/taxons.js +85 -63
  87. data/app/assets/javascripts/spree/backend/user_picker.js +16 -18
  88. data/app/assets/javascripts/spree/backend/variant_autocomplete.js +23 -22
  89. data/app/assets/javascripts/spree/backend/variant_management.js +2 -1
  90. data/app/assets/stylesheets/spree/backend.css +1 -1
  91. data/app/assets/stylesheets/spree/backend/components/_badges.scss +1 -1
  92. data/app/assets/stylesheets/spree/backend/components/_buttons.scss +27 -11
  93. data/app/assets/stylesheets/spree/backend/components/_filters.scss +35 -5
  94. data/app/assets/stylesheets/spree/backend/components/_icons.scss +39 -4
  95. data/app/assets/stylesheets/spree/backend/components/_main.scss +32 -6
  96. data/app/assets/stylesheets/spree/backend/components/_navbar.scss +16 -8
  97. data/app/assets/stylesheets/spree/backend/components/_sidebar.scss +119 -55
  98. data/app/assets/stylesheets/spree/backend/components/_tables.scss +62 -19
  99. data/app/assets/stylesheets/spree/backend/components/_taxon_products_view.scss +26 -63
  100. data/app/assets/stylesheets/spree/backend/global/_variables.scss +6 -2
  101. data/app/assets/stylesheets/spree/backend/plugins/_flatpickr.scss +95 -0
  102. data/app/assets/stylesheets/spree/backend/plugins/_jquery_ui.scss +0 -117
  103. data/app/assets/stylesheets/spree/backend/plugins/_select2_custom.scss +11 -0
  104. data/app/assets/stylesheets/spree/backend/plugins/select2_bootstrap4.scss +622 -0
  105. data/app/assets/stylesheets/spree/backend/shared/_base.scss +40 -0
  106. data/app/assets/stylesheets/spree/backend/shared/_forms.scss +38 -0
  107. data/app/assets/stylesheets/spree/backend/spree_admin.css.scss +7 -1
  108. data/app/assets/stylesheets/spree/backend/views/_order_payments.scss +12 -0
  109. data/app/assets/stylesheets/spree/backend/views/_product_properties.scss +11 -0
  110. data/app/assets/stylesheets/spree/backend/views/prototypes.scss +42 -0
  111. data/app/controllers/spree/admin/adjustments_controller.rb +8 -0
  112. data/app/controllers/spree/admin/general_settings_controller.rb +27 -0
  113. data/app/controllers/spree/admin/orders_controller.rb +15 -2
  114. data/app/controllers/spree/admin/prices_controller.rb +39 -0
  115. data/app/controllers/spree/admin/products_controller.rb +2 -2
  116. data/app/controllers/spree/admin/states_controller.rb +1 -1
  117. data/app/controllers/spree/admin/stock_transfers_controller.rb +8 -1
  118. data/app/controllers/spree/admin/stores_controller.rb +66 -1
  119. data/app/controllers/spree/admin/taxons_controller.rb +20 -6
  120. data/app/helpers/spree/admin/base_helper.rb +46 -13
  121. data/app/helpers/spree/admin/navigation_helper.rb +61 -20
  122. data/app/helpers/spree/admin/orders_helper.rb +2 -2
  123. data/app/helpers/spree/admin/payments_helper.rb +3 -3
  124. data/app/helpers/spree/admin/stock_movements_helper.rb +2 -0
  125. data/app/helpers/spree/admin/stores_helper.rb +9 -0
  126. data/app/views/kaminari/{twitter-bootstrap-4 → admin-twitter-bootstrap-4}/_first_page.html.erb +1 -1
  127. data/app/views/kaminari/{twitter-bootstrap-4 → admin-twitter-bootstrap-4}/_gap.html.erb +1 -1
  128. data/app/views/kaminari/{twitter-bootstrap-4 → admin-twitter-bootstrap-4}/_last_page.html.erb +1 -1
  129. data/app/views/kaminari/{twitter-bootstrap-4 → admin-twitter-bootstrap-4}/_next_page.html.erb +1 -1
  130. data/app/views/kaminari/{twitter-bootstrap-4 → admin-twitter-bootstrap-4}/_page.html.erb +0 -0
  131. data/app/views/kaminari/{twitter-bootstrap-4 → admin-twitter-bootstrap-4}/_paginator.html.erb +1 -1
  132. data/app/views/kaminari/{twitter-bootstrap-4 → admin-twitter-bootstrap-4}/_prev_page.html.erb +1 -1
  133. data/app/views/spree/admin/adjustments/_adjustment.html.erb +2 -2
  134. data/app/views/spree/admin/adjustments/_adjustments_table.html.erb +16 -16
  135. data/app/views/spree/admin/adjustments/edit.html.erb +2 -2
  136. data/app/views/spree/admin/adjustments/index.html.erb +3 -3
  137. data/app/views/spree/admin/adjustments/new.html.erb +1 -1
  138. data/app/views/spree/admin/countries/_form.html.erb +9 -4
  139. data/app/views/spree/admin/countries/index.html.erb +27 -24
  140. data/app/views/spree/admin/customer_returns/_reimbursements_table.html.erb +37 -35
  141. data/app/views/spree/admin/customer_returns/_return_item_decision.html.erb +5 -1
  142. data/app/views/spree/admin/customer_returns/_return_item_selection.html.erb +47 -43
  143. data/app/views/spree/admin/customer_returns/index.html.erb +5 -3
  144. data/app/views/spree/admin/customer_returns/new.html.erb +2 -2
  145. data/app/views/spree/admin/general_settings/edit.html.erb +28 -4
  146. data/app/views/spree/admin/images/edit.html.erb +2 -2
  147. data/app/views/spree/admin/images/index.html.erb +7 -7
  148. data/app/views/spree/admin/images/new.html.erb +2 -2
  149. data/app/views/spree/admin/log_entries/index.html.erb +4 -3
  150. data/app/views/spree/admin/option_types/_form.html.erb +9 -0
  151. data/app/views/spree/admin/option_types/_option_value_fields.html.erb +1 -1
  152. data/app/views/spree/admin/option_types/edit.html.erb +22 -20
  153. data/app/views/spree/admin/option_types/index.html.erb +29 -25
  154. data/app/views/spree/admin/orders/_add_line_item.html.erb +1 -1
  155. data/app/views/spree/admin/orders/_add_product.html.erb +1 -1
  156. data/app/views/spree/admin/orders/_adjustments.html.erb +26 -26
  157. data/app/views/spree/admin/orders/_channel_form.html.erb +18 -0
  158. data/app/views/spree/admin/orders/_line_items.html.erb +7 -7
  159. data/app/views/spree/admin/orders/_order_actions.html.erb +1 -1
  160. data/app/views/spree/admin/orders/_risk_analysis.html.erb +44 -42
  161. data/app/views/spree/admin/orders/_shipment.html.erb +9 -7
  162. data/app/views/spree/admin/orders/_shipment_manifest.html.erb +5 -5
  163. data/app/views/spree/admin/orders/_store_form.html.erb +4 -4
  164. data/app/views/spree/admin/orders/channel.html.erb +7 -0
  165. data/app/views/spree/admin/orders/customer_details/_autocomplete.js.erb +35 -12
  166. data/app/views/spree/admin/orders/customer_details/_form.html.erb +3 -3
  167. data/app/views/spree/admin/orders/customer_details/edit.html.erb +1 -1
  168. data/app/views/spree/admin/orders/index.html.erb +139 -132
  169. data/app/views/spree/admin/payment_methods/_form.html.erb +65 -46
  170. data/app/views/spree/admin/payment_methods/index.html.erb +7 -5
  171. data/app/views/spree/admin/payments/_capture_events.html.erb +18 -16
  172. data/app/views/spree/admin/payments/_form.html.erb +1 -1
  173. data/app/views/spree/admin/payments/_list.html.erb +39 -37
  174. data/app/views/spree/admin/payments/index.html.erb +2 -3
  175. data/app/views/spree/admin/payments/new.html.erb +1 -1
  176. data/app/views/spree/admin/payments/show.html.erb +1 -1
  177. data/app/views/spree/admin/payments/source_forms/_gateway.html.erb +30 -30
  178. data/app/views/spree/admin/payments/source_views/_gateway.html.erb +20 -18
  179. data/app/views/spree/admin/payments/source_views/_storecredit.html.erb +28 -26
  180. data/app/views/spree/admin/prices/_variant_prices.html.erb +43 -0
  181. data/app/views/spree/admin/prices/index.html.erb +21 -0
  182. data/app/views/spree/admin/product_properties/_product_property_fields.html.erb +16 -4
  183. data/app/views/spree/admin/product_properties/index.html.erb +24 -19
  184. data/app/views/spree/admin/products/_add_stock_form.html.erb +1 -1
  185. data/app/views/spree/admin/products/_autocomplete.js.erb +27 -21
  186. data/app/views/spree/admin/products/_form.html.erb +44 -13
  187. data/app/views/spree/admin/products/edit.html.erb +1 -1
  188. data/app/views/spree/admin/products/index.html.erb +26 -20
  189. data/app/views/spree/admin/products/new.html.erb +12 -3
  190. data/app/views/spree/admin/products/stock.html.erb +3 -3
  191. data/app/views/spree/admin/promotion_categories/index.html.erb +4 -1
  192. data/app/views/spree/admin/promotion_rules/create.js.erb +1 -1
  193. data/app/views/spree/admin/promotions/_actions.html.erb +2 -2
  194. data/app/views/spree/admin/promotions/_form.html.erb +45 -18
  195. data/app/views/spree/admin/promotions/_promotion_action.html.erb +1 -1
  196. data/app/views/spree/admin/promotions/_promotion_rule.html.erb +1 -1
  197. data/app/views/spree/admin/promotions/_rules.html.erb +4 -4
  198. data/app/views/spree/admin/promotions/actions/_create_line_items.html.erb +1 -1
  199. data/app/views/spree/admin/promotions/edit.html.erb +2 -2
  200. data/app/views/spree/admin/promotions/index.html.erb +5 -3
  201. data/app/views/spree/admin/promotions/new.html.erb +7 -6
  202. data/app/views/spree/admin/promotions/rules/_country.html.erb +1 -1
  203. data/app/views/spree/admin/promotions/rules/_item_total.html.erb +5 -5
  204. data/app/views/spree/admin/promotions/rules/_option_value.html.erb +13 -19
  205. data/app/views/spree/admin/promotions/rules/_product.html.erb +2 -2
  206. data/app/views/spree/admin/promotions/rules/_taxon.html.erb +2 -2
  207. data/app/views/spree/admin/promotions/rules/_user.html.erb +1 -1
  208. data/app/views/spree/admin/properties/index.html.erb +5 -3
  209. data/app/views/spree/admin/prototypes/_prototypes.html.erb +30 -28
  210. data/app/views/spree/admin/prototypes/index.html.erb +21 -19
  211. data/app/views/spree/admin/prototypes/show.html.erb +21 -8
  212. data/app/views/spree/admin/refunds/edit.html.erb +2 -2
  213. data/app/views/spree/admin/refunds/new.html.erb +3 -3
  214. data/app/views/spree/admin/reimbursement_types/_form.html.erb +4 -4
  215. data/app/views/spree/admin/reimbursement_types/index.html.erb +4 -2
  216. data/app/views/spree/admin/reimbursements/edit.html.erb +68 -63
  217. data/app/views/spree/admin/reimbursements/index.html.erb +21 -20
  218. data/app/views/spree/admin/reimbursements/show.html.erb +68 -60
  219. data/app/views/spree/admin/reports/index.html.erb +18 -17
  220. data/app/views/spree/admin/reports/sales_total.html.erb +20 -19
  221. data/app/views/spree/admin/return_authorizations/_form.html.erb +10 -7
  222. data/app/views/spree/admin/return_authorizations/edit.html.erb +3 -3
  223. data/app/views/spree/admin/return_authorizations/index.html.erb +5 -3
  224. data/app/views/spree/admin/return_authorizations/new.html.erb +2 -2
  225. data/app/views/spree/admin/return_index/customer_returns.html.erb +6 -6
  226. data/app/views/spree/admin/return_index/return_authorizations.html.erb +6 -6
  227. data/app/views/spree/admin/roles/index.html.erb +21 -19
  228. data/app/views/spree/admin/shared/_account_nav.html.erb +51 -65
  229. data/app/views/spree/admin/shared/_address_form.html.erb +31 -73
  230. data/app/views/spree/admin/shared/_cal_close.html.erb +10 -0
  231. data/app/views/spree/admin/shared/_content_header.html.erb +40 -21
  232. data/app/views/spree/admin/shared/_edit_resource_links.html.erb +2 -2
  233. data/app/views/spree/admin/shared/_head.html.erb +4 -0
  234. data/app/views/spree/admin/shared/_header.html.erb +14 -11
  235. data/app/views/spree/admin/shared/_index_table_options.html.erb +5 -7
  236. data/app/views/spree/admin/shared/_main_menu.html.erb +25 -14
  237. data/app/views/spree/admin/shared/_new_resource_links.html.erb +2 -2
  238. data/app/views/spree/admin/shared/_order_summary.html.erb +27 -21
  239. data/app/views/spree/admin/shared/_order_tabs.html.erb +18 -9
  240. data/app/views/spree/admin/shared/_product_tabs.html.erb +13 -5
  241. data/app/views/spree/admin/shared/_refunds.html.erb +31 -29
  242. data/app/views/spree/admin/shared/_report_order_criteria.html.erb +27 -6
  243. data/app/views/spree/admin/shared/_sidebar.html.erb +19 -1
  244. data/app/views/spree/admin/shared/_table_filter.html.erb +3 -3
  245. data/app/views/spree/admin/shared/_translations.html.erb +34 -1
  246. data/app/views/spree/admin/shared/_update_order_state.js.erb +6 -2
  247. data/app/views/spree/admin/shared/_version.html.erb +1 -1
  248. data/app/views/spree/admin/shared/named_types/_index.html.erb +4 -2
  249. data/app/views/spree/admin/shipping_categories/index.html.erb +3 -1
  250. data/app/views/spree/admin/shipping_methods/_form.html.erb +2 -2
  251. data/app/views/spree/admin/shipping_methods/index.html.erb +8 -2
  252. data/app/views/spree/admin/state_changes/index.html.erb +5 -2
  253. data/app/views/spree/admin/states/_state_list.html.erb +25 -24
  254. data/app/views/spree/admin/states/index.html.erb +1 -1
  255. data/app/views/spree/admin/stock_locations/_form.html.erb +1 -1
  256. data/app/views/spree/admin/stock_locations/_transfer_stock_form.html.erb +2 -2
  257. data/app/views/spree/admin/stock_locations/index.html.erb +5 -3
  258. data/app/views/spree/admin/stock_movements/index.html.erb +28 -26
  259. data/app/views/spree/admin/stock_transfers/_stock_movements.html.erb +20 -18
  260. data/app/views/spree/admin/stock_transfers/index.html.erb +46 -39
  261. data/app/views/spree/admin/stock_transfers/new.html.erb +4 -4
  262. data/app/views/spree/admin/stock_transfers/show.html.erb +3 -3
  263. data/app/views/spree/admin/store_credit_categories/index.html.erb +3 -1
  264. data/app/views/spree/admin/store_credits/index.html.erb +3 -1
  265. data/app/views/spree/admin/stores/_form.html.erb +199 -70
  266. data/app/views/spree/admin/stores/edit.html.erb +1 -1
  267. data/app/views/spree/admin/stores/index.html.erb +14 -7
  268. data/app/views/spree/admin/tax_categories/index.html.erb +29 -27
  269. data/app/views/spree/admin/tax_rates/index.html.erb +5 -3
  270. data/app/views/spree/admin/taxonomies/_list.html.erb +24 -22
  271. data/app/views/spree/admin/taxonomies/edit.html.erb +2 -2
  272. data/app/views/spree/admin/taxonomies/index.html.erb +1 -1
  273. data/app/views/spree/admin/taxons/_form.html.erb +40 -36
  274. data/app/views/spree/admin/taxons/_taxon_table.html.erb +24 -22
  275. data/app/views/spree/admin/taxons/edit.html.erb +6 -2
  276. data/app/views/spree/admin/taxons/index.html.erb +2 -2
  277. data/app/views/spree/admin/users/_addresses_form.html.erb +4 -6
  278. data/app/views/spree/admin/users/_lifetime_stats.html.erb +24 -23
  279. data/app/views/spree/admin/users/_sidebar.html.erb +5 -5
  280. data/app/views/spree/admin/users/_user_page_actions.html.erb +1 -1
  281. data/app/views/spree/admin/users/edit.html.erb +2 -2
  282. data/app/views/spree/admin/users/index.html.erb +25 -23
  283. data/app/views/spree/admin/users/items.html.erb +3 -2
  284. data/app/views/spree/admin/users/orders.html.erb +30 -29
  285. data/app/views/spree/admin/variants/_autocomplete_line_items_stock.js.erb +3 -3
  286. data/app/views/spree/admin/variants/_autocomplete_stock.js.erb +2 -2
  287. data/app/views/spree/admin/variants/_form.html.erb +16 -4
  288. data/app/views/spree/admin/variants/_split.js.erb +2 -2
  289. data/app/views/spree/admin/variants/index.html.erb +7 -5
  290. data/app/views/spree/admin/zones/index.html.erb +5 -5
  291. data/app/views/spree/layouts/admin.html.erb +33 -27
  292. data/config/initializers/ransack.rb +31 -0
  293. data/config/routes.rb +8 -1
  294. data/lib/spree/backend.rb +2 -0
  295. data/lib/spree_backend.rb +0 -1
  296. data/spec/fixtures/thinking-cat.jpg +0 -0
  297. data/spree_backend.gemspec +7 -5
  298. data/vendor/assets/javascripts/js.cookie.js +154 -156
  299. data/vendor/assets/javascripts/purify.js +1217 -0
  300. data/vendor/assets/javascripts/sortable.js +3709 -0
  301. data/vendor/assets/stylesheets/animate.css +7 -3156
  302. data/vendor/assets/stylesheets/jquery.jstree/themes/spree/style.scss +23 -9
  303. metadata +141 -26
  304. data/app/assets/javascripts/spree/backend/tag_picker.js +0 -52
  305. data/app/assets/stylesheets/spree/backend/plugins/_select2.scss +0 -141
@@ -1,8 +1,8 @@
1
1
  module Spree
2
2
  module Admin
3
3
  class TaxonsController < Spree::Admin::BaseController
4
- before_action :load_taxonomy, only: [:create, :edit, :update]
5
- before_action :load_taxon, only: [:edit, :update]
4
+ before_action :load_taxonomy, only: [:create, :edit, :update, :remove_icon]
5
+ before_action :load_taxon, only: [:edit, :update, :remove_icon]
6
6
  before_action :set_permalink_part, only: [:edit, :update]
7
7
  respond_to :html, :js
8
8
 
@@ -62,10 +62,22 @@ module Spree
62
62
  end
63
63
  end
64
64
 
65
+ def remove_icon
66
+ if @taxon.icon.destroy
67
+ flash[:success] = Spree.t('notice_messages.icon_removed')
68
+ redirect_to edit_admin_taxonomy_taxon_url(@taxonomy.id, @taxon.id)
69
+ else
70
+ flash[:error] = Spree.t('errors.messages.cannot_remove_icon')
71
+ render :edit
72
+ end
73
+ end
74
+
65
75
  private
66
76
 
67
77
  def set_permalink_part
68
78
  @permalink_part = @taxon.permalink.split('/').last
79
+ @parent_permalink = @taxon.permalink.split('/')[0...-1].join('/')
80
+ @parent_permalink += '/' unless @parent_permalink.blank?
69
81
  end
70
82
 
71
83
  def taxon_params
@@ -77,7 +89,11 @@ module Spree
77
89
  end
78
90
 
79
91
  def load_taxonomy
80
- @taxonomy = Taxonomy.find(params[:taxonomy_id])
92
+ @taxonomy = if defined?(SpreeGlobalize)
93
+ Taxonomy.includes(:translations, taxons: [:translations]).find(params[:taxonomy_id])
94
+ else
95
+ Taxonomy.find(params[:taxonomy_id])
96
+ end
81
97
  end
82
98
 
83
99
  def set_position
@@ -91,9 +107,7 @@ module Spree
91
107
 
92
108
  def set_permalink_params
93
109
  if params.key? 'permalink_part'
94
- parent_permalink = @taxon.permalink.split('/')[0...-1].join('/')
95
- parent_permalink += '/' unless parent_permalink.blank?
96
- params[:taxon][:permalink] = parent_permalink + params[:permalink_part]
110
+ params[:taxon][:permalink] = @parent_permalink + params[:permalink_part]
97
111
  end
98
112
  end
99
113
 
@@ -3,15 +3,13 @@ module Spree
3
3
  module BaseHelper
4
4
  def flash_alert(flash)
5
5
  if flash.present?
6
- close_button = button_tag(class: 'close', 'data-dismiss' => 'alert', 'aria-label' => Spree.t(:close)) do
7
- content_tag('span', '&times;'.html_safe, 'aria-hidden' => true)
8
- end
9
6
  message = flash[:error] || flash[:notice] || flash[:success]
10
7
  flash_class = 'danger' if flash[:error]
11
8
  flash_class = 'info' if flash[:notice]
12
9
  flash_class = 'success' if flash[:success]
13
- flash_div = content_tag(:div, (close_button + message), class: "alert alert-#{flash_class} alert-auto-disappear")
14
- content_tag(:div, flash_div, class: 'col-12')
10
+ flash_div = content_tag(:div, message, class: "alert alert-#{flash_class} mx-2")
11
+ content_tag(:div, flash_div,
12
+ class: 'd-flex justify-content-center position-fixed flash-alert ')
15
13
  end
16
14
  end
17
15
 
@@ -37,6 +35,15 @@ module Spree
37
35
  end
38
36
  end
39
37
 
38
+ def svg_icon(name:, classes: '', width:, height:)
39
+ if name.ends_with?('.svg')
40
+ icon_name = File.basename(name, File.extname(name))
41
+ inline_svg_tag "backend-#{icon_name}.svg", class: "icon-#{icon_name} #{classes}", size: "#{width}px*#{height}px"
42
+ else
43
+ inline_svg_tag "backend-#{name}.svg", class: "icon-#{name} #{classes}", size: "#{width}px*#{height}px"
44
+ end
45
+ end
46
+
40
47
  def datepicker_field_value(date)
41
48
  unless date.blank?
42
49
  l(date, format: Spree.t('date_picker.format', default: '%Y/%m/%d'))
@@ -86,7 +93,9 @@ module Spree
86
93
  class: 'input_integer form-control'
87
94
  }
88
95
  when :boolean
89
- {}
96
+ {
97
+ class: 'form-check-input'
98
+ }
90
99
  when :string
91
100
  {
92
101
  size: 10,
@@ -120,17 +129,31 @@ module Spree
120
129
 
121
130
  fields = object.preferences.keys.map do |key|
122
131
  if object.has_preference?(key)
123
- form.label("preferred_#{key}", Spree.t(key) + ': ') +
124
- preference_field_for(form, "preferred_#{key}", type: object.preference_type(key))
132
+ case key
133
+ when :currency
134
+ content_tag(:div, form.label("preferred_#{key}", Spree.t(key)) +
135
+ (form.select "preferred_#{key}", currency_options(object.preferences[key]), {}, { class: 'form-control select2' }),
136
+ class: 'form-group', id: [object.class.to_s.parameterize, 'preference', key].join('-'))
137
+ else
138
+ if object.preference_type(key) == :boolean
139
+ content_tag(:div, preference_field_for(form, "preferred_#{key}", type: object.preference_type(key)) +
140
+ form.label("preferred_#{key}", Spree.t(key), class: 'form-check-label'),
141
+ class: 'form-group form-check', id: [object.class.to_s.parameterize, 'preference', key].join('-'))
142
+ else
143
+ content_tag(:div, form.label("preferred_#{key}", Spree.t(key)) +
144
+ preference_field_for(form, "preferred_#{key}", type: object.preference_type(key)),
145
+ class: 'form-group', id: [object.class.to_s.parameterize, 'preference', key].join('-'))
146
+ end
147
+ end
125
148
  end
126
149
  end
127
- safe_join(fields, '<br />'.html_safe)
150
+ safe_join(fields)
128
151
  end
129
152
 
130
153
  # renders hidden field and link to remove record using nested_attributes
131
154
  def link_to_icon_remove_fields(form)
132
155
  url = form.object.persisted? ? [:admin, form.object] : '#'
133
- link_to_with_icon('delete', '', url,
156
+ link_to_with_icon('delete.svg', '', url,
134
157
  class: 'spree_remove_fields btn btn-sm btn-danger',
135
158
  data: {
136
159
  action: 'remove'
@@ -152,11 +175,11 @@ module Spree
152
175
  def order_time(time)
153
176
  return '' if time.blank?
154
177
 
155
- [I18n.l(time.to_date), time.strftime('%l:%M %p').strip].join(' ')
178
+ [I18n.l(time.to_date), time.strftime('%l:%M %p %Z').strip].join(' ')
156
179
  end
157
180
 
158
181
  def required_span_tag
159
- content_tag(:span, ' *', class: 'required')
182
+ content_tag(:span, ' *', class: 'required font-weight-bold text-danger')
160
183
  end
161
184
 
162
185
  def product_preview_link(product)
@@ -165,7 +188,17 @@ module Spree
165
188
  button_link_to(
166
189
  Spree.t(:preview_product),
167
190
  spree.product_url(product),
168
- class: 'btn-outline-secondary', icon: 'eye-open', id: 'admin_preview_product', target: :blank
191
+ class: 'btn-outline-secondary', icon: 'view.svg', id: 'admin_preview_product', target: :blank
192
+ )
193
+ end
194
+
195
+ def taxon_preview_link(taxon)
196
+ return unless frontend_available?
197
+
198
+ button_link_to(
199
+ Spree.t(:preview_taxon),
200
+ seo_url(taxon),
201
+ class: 'btn-outline-secondary', icon: 'view.svg', id: 'admin_preview_taxon', target: :blank
169
202
  )
170
203
  end
171
204
  end
@@ -15,6 +15,9 @@ module Spree
15
15
  # Example:
16
16
  # # Link to /admin/orders, also highlight tab for ProductsController and ShipmentsController
17
17
  # tab :orders, :products, :shipments
18
+
19
+ ICON_SIZE = 16
20
+
18
21
  def tab(*args)
19
22
  options = { label: args.first.to_s }
20
23
 
@@ -48,7 +51,7 @@ module Spree
48
51
  link_to(
49
52
  titleized_label,
50
53
  destination_url,
51
- class: "sidebar-submenu-item w-100 py-1 px-3 d-block #{'text-success' if selected}"
54
+ class: "sidebar-submenu-item w-100 py-2 py-md-1 pl-3 d-block #{'text-success' if selected}"
52
55
  )
53
56
  end
54
57
 
@@ -61,9 +64,15 @@ module Spree
61
64
  # Single main menu item
62
65
  def main_menu_item(text, url: nil, icon: nil)
63
66
  link_to url, 'data-toggle': 'collapse', class: 'd-flex w-100 p-3 position-relative align-items-center' do
64
- content_tag(:span, nil, class: "icon icon-#{icon} mr-2") +
65
- content_tag(:span, " #{text}", class: 'text') +
66
- content_tag(:span, nil, class: 'icon icon-chevron-left position-absolute')
67
+ if icon.ends_with?('.svg')
68
+ svg_icon(name: icon, classes: 'mr-2', width: ICON_SIZE, height: ICON_SIZE) +
69
+ content_tag(:span, " #{text}", class: 'text') +
70
+ svg_icon(name: 'chevron-left.svg', classes: 'drop-menu-indicator position-absolute', width: (ICON_SIZE - 4), height: (ICON_SIZE - 4))
71
+ else
72
+ content_tag(:span, nil, class: "icon icon-#{icon} mr-2") +
73
+ content_tag(:span, " #{text}", class: 'text') +
74
+ svg_icon(name: 'chevron-left.svg', classes: 'drop-menu-indicator position-absolute', width: (ICON_SIZE - 4), height: (ICON_SIZE - 4))
75
+ end
67
76
  end
68
77
  end
69
78
 
@@ -86,17 +95,17 @@ module Spree
86
95
  end
87
96
  else
88
97
  per_page_default = Spree::Config.admin_orders_per_page
89
- per_page_options = %w{15 30 45 60}
98
+ per_page_options = %w{25 50 75}
90
99
  end
91
100
 
92
101
  selected_option = params[:per_page].try(:to_i) || per_page_default
93
102
 
94
103
  select_tag(:per_page,
95
104
  options_for_select(per_page_options, selected_option),
96
- class: "form-control pull-right js-per-page-select per-page-selected-#{selected_option}")
105
+ class: "w-auto form-control js-per-page-select per-page-selected-#{selected_option} custom-select")
97
106
  end
98
107
 
99
- # helper method to create proper url to apply per page filtering
108
+ # helper method to create proper url to apply per page ing
100
109
  # fixes https://github.com/spree/spree/issues/6888
101
110
  def per_page_dropdown_params(args = nil)
102
111
  args = params.permit!.to_h.clone
@@ -121,9 +130,9 @@ module Spree
121
130
 
122
131
  def link_to_clone(resource, options = {})
123
132
  options[:data] = { action: 'clone', 'original-title': Spree.t(:clone) }
124
- options[:class] = 'btn btn-primary btn-sm with-tip'
133
+ options[:class] = 'btn btn-warning btn-sm with-tip'
125
134
  options[:method] = :post
126
- options[:icon] = :clone
135
+ options[:icon] = 'clone.svg'
127
136
  button_link_to '', clone_object_url(resource), options
128
137
  end
129
138
 
@@ -131,7 +140,7 @@ module Spree
131
140
  options[:data] = { action: 'clone', 'original-title': Spree.t(:clone) }
132
141
  options[:class] = 'btn btn-warning btn-sm with-tip'
133
142
  options[:method] = :post
134
- options[:icon] = :clone
143
+ options[:icon] = 'clone.svg'
135
144
  button_link_to '', clone_admin_promotion_path(promotion), options
136
145
  end
137
146
 
@@ -139,13 +148,13 @@ module Spree
139
148
  url = options[:url] || edit_object_url(resource)
140
149
  options[:data] = { action: 'edit' }
141
150
  options[:class] = 'btn btn-primary btn-sm'
142
- link_to_with_icon('edit', Spree.t(:edit), url, options)
151
+ link_to_with_icon('edit.svg', Spree.t(:edit), url, options)
143
152
  end
144
153
 
145
154
  def link_to_edit_url(url, options = {})
146
155
  options[:data] = { action: 'edit' }
147
156
  options[:class] = 'btn btn-primary btn-sm'
148
- link_to_with_icon('edit', Spree.t(:edit), url, options)
157
+ link_to_with_icon('edit.svg', Spree.t(:edit), url, options)
149
158
  end
150
159
 
151
160
  def link_to_delete(resource, options = {})
@@ -153,7 +162,7 @@ module Spree
153
162
  name = options[:name] || Spree.t(:delete)
154
163
  options[:class] = 'btn btn-danger btn-sm delete-resource'
155
164
  options[:data] = { confirm: Spree.t(:are_you_sure), action: 'remove' }
156
- link_to_with_icon 'delete', name, url, options
165
+ link_to_with_icon 'delete.svg', name, url, options
157
166
  end
158
167
 
159
168
  def link_to_with_icon(icon_name, text, url, options = {})
@@ -162,20 +171,32 @@ module Spree
162
171
  text = options[:no_text] ? '' : content_tag(:span, text, class: 'text')
163
172
  options.delete(:no_text)
164
173
  if icon_name
165
- icon = content_tag(:span, '', class: "#{'mr-2' unless text.empty?} icon icon-#{icon_name}")
174
+ icon = if icon_name.ends_with?('.svg')
175
+ svg_icon(name: icon_name, classes: "#{'mr-2' unless text.empty?} icon icon-#{icon_name}", width: ICON_SIZE, height: ICON_SIZE)
176
+ else
177
+ content_tag(:span, '', class: "#{'mr-2' unless text.empty?} icon icon-#{icon_name}")
178
+ end
166
179
  text = "#{icon} #{text}"
167
180
  end
168
181
  link_to(text.html_safe, url, options)
169
182
  end
170
183
 
171
184
  def spree_icon(icon_name)
172
- icon_name ? content_tag(:i, '', class: icon_name) : ''
185
+ if icon_name.ends_with?('.svg')
186
+ icon_name ? svg_icon(name: icon_name, classes: icon_name, width: ICON_SIZE, height: ICON_SIZE) : ''
187
+ else
188
+ icon_name ? content_tag(:span, '', class: icon_name) : ''
189
+ end
173
190
  end
174
191
 
175
192
  # Override: Add disable_with option to prevent multiple request on consecutive clicks
176
193
  def button(text, icon_name = nil, button_type = 'submit', options = {})
177
194
  if icon_name
178
- icon = content_tag(:span, '', class: "icon icon-#{icon_name}")
195
+ icon = if icon_name.ends_with?('.svg')
196
+ svg_icon(name: icon_name, classes: "icon icon-#{icon_name}", width: ICON_SIZE, height: ICON_SIZE)
197
+ else
198
+ content_tag(:span, '', class: "icon icon-#{icon_name}")
199
+ end
179
200
  text = "#{icon} #{text}"
180
201
  end
181
202
  button_tag(
@@ -192,7 +213,7 @@ module Spree
192
213
  if html_options[:method] &&
193
214
  !html_options[:method].to_s.casecmp('get').zero? &&
194
215
  !html_options[:remote]
195
- form_tag(url, method: html_options.delete(:method), class: 'd-inline') do
216
+ form_tag(url, method: html_options.delete(:method)) do
196
217
  button(text, html_options.delete(:icon), nil, html_options)
197
218
  end
198
219
  else
@@ -206,11 +227,15 @@ module Spree
206
227
  html_options[:class] = html_options[:class] ? "btn #{html_options[:class]}" : 'btn btn-outline-secondary'
207
228
 
208
229
  if html_options[:icon]
209
- icon = content_tag(:span, '', class: "icon icon-#{html_options[:icon]}")
230
+ icon = if html_options[:icon].ends_with?('.svg')
231
+ svg_icon(name: html_options[:icon], classes: "icon icon-#{html_options[:icon]}", width: ICON_SIZE, height: ICON_SIZE)
232
+ else
233
+ content_tag(:span, '', class: "icon icon-#{html_options[:icon]}")
234
+ end
210
235
  text = "#{icon} #{text}"
211
236
  end
212
237
 
213
- link_to(text.html_safe, url, html_options)
238
+ link_to(text.html_safe, url, html_options.except(:icon))
214
239
  end
215
240
  end
216
241
 
@@ -222,7 +247,17 @@ module Spree
222
247
  options[:class] = 'sidebar-menu-item d-block w-100'
223
248
  options[:class] << ' selected' if is_selected
224
249
  content_tag(:li, options) do
225
- link_to(link_text, url, class: "#{'text-success' if is_selected} py-1 px-3 d-block sidebar-submenu-item")
250
+ link_to(link_text, url, class: "#{'text-success' if is_selected} sidebar-submenu-item w-100 py-2 py-md-1 pl-3 d-block")
251
+ end
252
+ end
253
+
254
+ def active_badge(condition, options = {})
255
+ label = options[:label]
256
+ label ||= condition ? Spree.t(:say_yes) : Spree.t(:say_no)
257
+ css_class = condition ? 'badge-active' : 'badge-inactive'
258
+
259
+ content_tag(:strong, class: "badge #{css_class} text-uppercase") do
260
+ label
226
261
  end
227
262
  end
228
263
 
@@ -235,6 +270,9 @@ module Spree
235
270
  end
236
271
 
237
272
  def main_sidebar_classes
273
+ ActiveSupport::Deprecation.warn(<<-DEPRECATION, caller)
274
+ Admin::NavigationsHelper#main_sidebar_classes is deprecated and will be removed in Spree 5.0.
275
+ DEPRECATION
238
276
  if cookies['sidebar-minimized'] == 'true'
239
277
  'col-3 col-md-2 sidebar'
240
278
  else
@@ -243,6 +281,9 @@ module Spree
243
281
  end
244
282
 
245
283
  def wrapper_classes
284
+ ActiveSupport::Deprecation.warn(<<-DEPRECATION, caller)
285
+ Admin::NavigationsHelper#wrapper_classes is deprecated and will be removed in Spree 5.0.
286
+ DEPRECATION
246
287
  'sidebar-minimized' if cookies['sidebar-minimized'] == 'true'
247
288
  end
248
289
  end
@@ -12,11 +12,11 @@ module Spree
12
12
  label.capitalize,
13
13
  [event, :admin, order],
14
14
  method: :put,
15
- icon: event.to_s,
15
+ icon: event.to_s + '.svg',
16
16
  data: { confirm: Spree.t(:order_sure_want_to, event: label) }
17
17
  )
18
18
  end
19
- safe_join(links, '&nbsp;'.html_safe)
19
+ safe_join(links, ''.html_safe)
20
20
  end
21
21
 
22
22
  def line_item_shipment_price(line_item, quantity)
@@ -2,9 +2,9 @@ module Spree
2
2
  module Admin
3
3
  module PaymentsHelper
4
4
  def payment_method_name(payment)
5
- # HACK: to allow us to retrieve the name of a "deleted" payment method
6
- id = payment.payment_method_id
7
- Spree::PaymentMethod.find_with_destroyed(id).name
5
+ payment_method = payment.payment_method
6
+
7
+ link_to payment_method.name, spree.edit_admin_payment_method_path(payment_method)
8
8
  end
9
9
  end
10
10
  end
@@ -5,6 +5,8 @@ module Spree
5
5
  if stock_movement.originator.respond_to?(:number)
6
6
  if stock_movement.originator.respond_to?(:order)
7
7
  link_to stock_movement.originator.number, [:edit, :admin, stock_movement.originator.order]
8
+ elsif stock_movement.originator.is_a?(Spree::StockTransfer)
9
+ link_to stock_movement.originator.number, spree.admin_stock_transfer_url(stock_movement.originator)
8
10
  else
9
11
  stock_movement.originator.number
10
12
  end
@@ -0,0 +1,9 @@
1
+ module Spree
2
+ module Admin
3
+ module StoresHelper
4
+ def selected_checkout_zone(store)
5
+ store&.checkout_zone || Spree::Zone.default_checkout_zone
6
+ end
7
+ end
8
+ end
9
+ end
@@ -8,6 +8,6 @@
8
8
  -%>
9
9
  <% unless current_page.first? %>
10
10
  <li class="first page-item">
11
- <%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, remote: remote, class: 'page-link' %>
11
+ <%= link_to_unless current_page.first?, svg_icon(name: "double-chevron-left.svg", width: '13', height: '16', classes: 'spree-icon-arrow-left mb-0'), url, remote: remote, class: 'page-link', 'aria-label': 'First page' %>
12
12
  </li>
13
13
  <% end %>
@@ -5,7 +5,7 @@
5
5
  per_page: number of items to fetch per page
6
6
  remote: data-remote
7
7
  -%>
8
- <li class="page gap disabled page-item">
8
+ <li class="page gap disabled page-item d-none d-lg-flex">
9
9
  <a href="#" onclick="return false;" class="page-link">
10
10
  <%= raw(t 'views.pagination.truncate') %>
11
11
  </a>
@@ -8,6 +8,6 @@
8
8
  -%>
9
9
  <% unless current_page.last? %>
10
10
  <li class="last next page-item"><%# "next" class present for border styling in twitter bootstrap %>
11
- <%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, remote: remote, class: 'page-link' %>
11
+ <%= link_to_unless current_page.last?, svg_icon(name: "double-chevron-right.svg", width: '13', height: '16', classes: 'spree-icon-arrow-right mb-0'), url, remote: remote, class: 'page-link', 'aria-label': 'Last page' %>
12
12
  </li>
13
13
  <% end %>
@@ -8,6 +8,6 @@
8
8
  -%>
9
9
  <% unless current_page.last? %>
10
10
  <li class="next_page page-item">
11
- <%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, rel: 'next', remote: remote, class: 'page-link' %>
11
+ <%= link_to_unless current_page.last?, svg_icon(name: "chevron-right.svg", width: '13', height: '16', classes: 'spree-icon-arrow-right mb-0'), url, rel: 'next', remote: remote, class: 'page-link', 'aria-label': 'Next page' %>
12
12
  </li>
13
13
  <% end %>