spree_backend 4.3.3 → 4.4.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (263) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +222 -0
  3. data/.codeclimate.yml +36 -0
  4. data/.editorconfig +22 -0
  5. data/.eslintignore +7 -0
  6. data/.eslintrc.cjs +29 -0
  7. data/.gem_release.yml +4 -0
  8. data/.github/CONTRIBUTING.md +1 -0
  9. data/.github/ISSUE_TEMPLATE/bug_report.md +47 -0
  10. data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  11. data/.github/ISSUE_TEMPLATE.md +39 -0
  12. data/.github/dependabot.yml +7 -0
  13. data/.github/workflows/spelling_lint.yml +34 -0
  14. data/.gitignore +63 -0
  15. data/.rubocop.yml +197 -0
  16. data/.solargraph.yml +20 -0
  17. data/.stylelintignore +4 -0
  18. data/.stylelintrc +6 -0
  19. data/CODE_OF_CONDUCT.md +22 -0
  20. data/Gemfile +59 -3
  21. data/README.md +123 -0
  22. data/SECURITY.md +1 -0
  23. data/app/assets/config/spree_backend_manifest.js +1 -1
  24. data/app/assets/images/backend-cloud-arrow-up.svg +4 -0
  25. data/app/assets/images/backend-eye-open.svg +1 -1
  26. data/app/assets/images/backend-file-earmark-font.svg +4 -0
  27. data/app/assets/images/backend-file-earmark-image.svg +4 -0
  28. data/app/assets/images/backend-file-earmark-music.svg +4 -0
  29. data/app/assets/images/backend-file-earmark-pdf.svg +4 -0
  30. data/app/assets/images/backend-file-earmark-play.svg +4 -0
  31. data/app/assets/images/backend-file-earmark-spreadsheet.svg +3 -0
  32. data/app/assets/images/backend-file-earmark-zip.svg +4 -0
  33. data/app/assets/images/backend-file-earmark.svg +3 -0
  34. data/app/assets/images/backend-hdd.svg +4 -0
  35. data/app/assets/images/backend-link.svg +4 -0
  36. data/app/assets/images/backend-view.svg +1 -1
  37. data/app/assets/javascripts/spree/backend/adjustments.js +5 -5
  38. data/app/assets/javascripts/spree/backend/admin.js +4 -6
  39. data/app/assets/javascripts/spree/backend/calculator.js +1 -1
  40. data/app/assets/javascripts/spree/backend/checkouts/edit.js +1 -1
  41. data/app/assets/javascripts/spree/backend/cms/links.es6 +1 -1
  42. data/app/assets/javascripts/spree/backend/cms/live_preview.es6 +1 -1
  43. data/app/assets/javascripts/spree/backend/cms/page.es6 +22 -40
  44. data/app/assets/javascripts/spree/backend/cms/section.es6 +1 -1
  45. data/app/assets/javascripts/spree/backend/gateway.js +1 -1
  46. data/app/assets/javascripts/spree/backend/general_settings.js +1 -1
  47. data/app/assets/javascripts/spree/backend/global/_index.js +3 -1
  48. data/app/assets/javascripts/spree/backend/global/alerts.es6 +1 -1
  49. data/app/assets/javascripts/spree/backend/global/animate_css.es6 +19 -0
  50. data/app/assets/javascripts/spree/backend/global/fetch_request_utility.es6 +114 -0
  51. data/app/assets/javascripts/spree/backend/global/flatpickr.es6 +2 -1
  52. data/app/assets/javascripts/spree/backend/global/info_alert.es6 +1 -1
  53. data/app/assets/javascripts/spree/backend/global/radio_panel_toggle.es6 +1 -1
  54. data/app/assets/javascripts/spree/backend/global/ransack.es6 +7 -5
  55. data/app/assets/javascripts/spree/backend/global/responsive_menus.es6 +1 -1
  56. data/app/assets/javascripts/spree/backend/global/select2_autocomplete.es6 +4 -4
  57. data/app/assets/javascripts/spree/backend/global/select2_populate.es6 +2 -2
  58. data/app/assets/javascripts/spree/backend/global/side_scroll_indication.es6 +2 -2
  59. data/app/assets/javascripts/spree/backend/global/sortable.es6 +1 -1
  60. data/app/assets/javascripts/spree/backend/global/tinymce.es6 +3 -2
  61. data/app/assets/javascripts/spree/backend/line_items.js +7 -9
  62. data/app/assets/javascripts/spree/backend/line_items_on_order_edit.js +23 -28
  63. data/app/assets/javascripts/spree/backend/menus/_index.es6 +0 -1
  64. data/app/assets/javascripts/spree/backend/menus/menu_item.es6 +1 -1
  65. data/app/assets/javascripts/spree/backend/multi_currency.js +2 -2
  66. data/app/assets/javascripts/spree/backend/option_type_autocomplete.js +1 -1
  67. data/app/assets/javascripts/spree/backend/orders/edit.js +1 -1
  68. data/app/assets/javascripts/spree/backend/payments/edit.js +32 -22
  69. data/app/assets/javascripts/spree/backend/payments/new.js +1 -1
  70. data/app/assets/javascripts/spree/backend/product_picker.js +16 -25
  71. data/app/assets/javascripts/spree/backend/progress.js +5 -3
  72. data/app/assets/javascripts/spree/backend/promotions.js +3 -1
  73. data/app/assets/javascripts/spree/backend/returns/expedited_exchanges_warning.js +1 -1
  74. data/app/assets/javascripts/spree/backend/returns/return_item_selection.js +1 -1
  75. data/app/assets/javascripts/spree/backend/shipments.js +80 -79
  76. data/app/assets/javascripts/spree/backend/spree-select2.js +1 -1
  77. data/app/assets/javascripts/spree/backend/states.js +1 -1
  78. data/app/assets/javascripts/spree/backend/stock_location.js +1 -1
  79. data/app/assets/javascripts/spree/backend/stock_management.js +1 -1
  80. data/app/assets/javascripts/spree/backend/stock_movement.js +58 -13
  81. data/app/assets/javascripts/spree/backend/stock_transfer.js +62 -32
  82. data/app/assets/javascripts/spree/backend/taxon_autocomplete.js +9 -8
  83. data/app/assets/javascripts/spree/backend/taxons.js +17 -14
  84. data/app/assets/javascripts/spree/backend/user_picker.js +1 -1
  85. data/app/assets/javascripts/spree/backend/users/edit.js +1 -1
  86. data/app/assets/javascripts/spree/backend/variant_autocomplete.js +19 -11
  87. data/app/assets/javascripts/spree/backend/variant_management.js +1 -1
  88. data/app/assets/javascripts/spree/backend/zone.js +1 -1
  89. data/app/assets/javascripts/spree/backend.js +13 -33
  90. data/app/assets/javascripts/spree.js +2 -9
  91. data/app/assets/stylesheets/spree/backend/components/_main.scss +8 -0
  92. data/app/assets/stylesheets/spree/backend/plugins/_nav_x.scss +1 -1
  93. data/app/assets/stylesheets/spree/backend/plugins/_select2_custom.scss +1 -1
  94. data/app/assets/stylesheets/spree/backend/shared/_forms.scss +1 -1
  95. data/app/assets/stylesheets/spree/backend/shared/_sortable_tree.scss +62 -0
  96. data/app/assets/stylesheets/spree/backend/spree_admin.css.scss +3 -0
  97. data/app/assets/stylesheets/spree/backend/views/_digitals.scss +33 -0
  98. data/app/assets/stylesheets/spree/backend/views/_taxonomies.scss +3 -0
  99. data/app/controllers/spree/admin/base_controller.rb +4 -13
  100. data/app/controllers/spree/admin/digitals_controller.rb +33 -0
  101. data/app/controllers/spree/admin/general_settings_controller.rb +0 -5
  102. data/app/controllers/spree/admin/images_controller.rb +1 -1
  103. data/app/controllers/spree/admin/oauth_applications_controller.rb +17 -0
  104. data/app/controllers/spree/admin/orders/customer_details_controller.rb +2 -2
  105. data/app/controllers/spree/admin/orders_controller.rb +10 -2
  106. data/app/controllers/spree/admin/payment_methods_controller.rb +2 -2
  107. data/app/controllers/spree/admin/payments_controller.rb +1 -1
  108. data/app/controllers/spree/admin/products_controller.rb +4 -2
  109. data/app/controllers/spree/admin/promotions_controller.rb +1 -1
  110. data/app/controllers/spree/admin/properties_controller.rb +1 -1
  111. data/app/controllers/spree/admin/resource_controller.rb +9 -4
  112. data/app/controllers/spree/admin/return_index_controller.rb +1 -1
  113. data/app/controllers/spree/admin/stock_transfers_controller.rb +2 -2
  114. data/app/controllers/spree/admin/store_credits_controller.rb +2 -2
  115. data/app/controllers/spree/admin/stores_controller.rb +2 -2
  116. data/app/controllers/spree/admin/taxons_controller.rb +23 -38
  117. data/app/controllers/spree/admin/users_controller.rb +6 -19
  118. data/app/controllers/spree/admin/variants_controller.rb +1 -2
  119. data/app/controllers/spree/admin/webhooks_subscribers_controller.rb +48 -0
  120. data/app/helpers/spree/admin/base_helper.rb +27 -9
  121. data/app/helpers/spree/admin/digital_helper.rb +28 -0
  122. data/app/helpers/spree/admin/menu_helper.rb +0 -21
  123. data/app/helpers/spree/admin/navigation_helper.rb +19 -9
  124. data/app/helpers/spree/admin/sortable_tree_helper.rb +31 -0
  125. data/app/helpers/spree/admin/stores_helper.rb +1 -1
  126. data/app/helpers/spree/admin/webhooks_subscribers_helper.rb +31 -0
  127. data/app/javascript/spree/dashboard/controllers/clipboard_controller.js +12 -0
  128. data/app/javascript/spree/dashboard/controllers/password_toggle_controller.js +14 -0
  129. data/app/javascript/spree/dashboard/controllers/sortable_tree_controller.js +55 -0
  130. data/app/javascript/spree/dashboard/controllers/spree_controller.js +25 -0
  131. data/app/javascript/spree/dashboard/controllers/upload_button_controller.js +13 -0
  132. data/app/javascript/spree/dashboard/controllers/webhooks_subscriber_events_controller.js +19 -0
  133. data/app/javascript/spree/dashboard/index.js +49 -0
  134. data/app/{assets/javascripts/spree/backend/global/bootstrap.es6 → javascript/spree/dashboard/utilities/bootstrap.js} +6 -2
  135. data/app/javascript/spree/dashboard/utilities/request_utility.js +54 -0
  136. data/app/models/spree/backend_configuration.rb +11 -0
  137. data/app/views/spree/admin/adjustments/_adjustments_table.html.erb +2 -2
  138. data/app/views/spree/admin/adjustments/_form.html.erb +2 -2
  139. data/app/views/spree/admin/adjustments/index.html.erb +1 -0
  140. data/app/views/spree/admin/cms_pages/_form.html.erb +8 -8
  141. data/app/views/spree/admin/cms_pages/edit.html.erb +1 -6
  142. data/app/views/spree/admin/cms_sections/_form.html.erb +2 -2
  143. data/app/views/spree/admin/cms_sections/types/_featured_article.html.erb +6 -6
  144. data/app/views/spree/admin/cms_sections/types/_hero_image.html.erb +6 -6
  145. data/app/views/spree/admin/cms_sections/types/_image_gallery.html.erb +12 -12
  146. data/app/views/spree/admin/cms_sections/types/_rich_text_content.html.erb +1 -1
  147. data/app/views/spree/admin/cms_sections/types/_side_by_side_images.html.erb +12 -12
  148. data/app/views/spree/admin/countries/_form.html.erb +4 -4
  149. data/app/views/spree/admin/customer_returns/new.html.erb +1 -1
  150. data/app/views/spree/admin/digitals/_form.html.erb +35 -0
  151. data/app/views/spree/admin/digitals/index.html.erb +25 -0
  152. data/app/views/spree/admin/general_settings/edit.html.erb +1 -22
  153. data/app/views/spree/admin/menu_items/_form.html.erb +6 -6
  154. data/app/views/spree/admin/menus/_form.html.erb +3 -3
  155. data/app/views/spree/admin/menus/edit.html.erb +18 -18
  156. data/app/views/spree/admin/oauth_applications/_form.html.erb +22 -0
  157. data/app/views/spree/admin/oauth_applications/create.turbo_stream.erb +38 -0
  158. data/app/views/spree/admin/oauth_applications/edit.html.erb +13 -0
  159. data/app/views/spree/admin/oauth_applications/index.html.erb +51 -0
  160. data/app/views/spree/admin/oauth_applications/new.html.erb +15 -0
  161. data/app/views/spree/admin/option_types/_form.html.erb +3 -3
  162. data/app/views/spree/admin/option_types/_option_value_fields.html.erb +2 -2
  163. data/app/views/spree/admin/orders/_channel_form.html.erb +1 -1
  164. data/app/views/spree/admin/orders/_form.html.erb +1 -0
  165. data/app/views/spree/admin/orders/_line_items_edit_form.html.erb +1 -0
  166. data/app/views/spree/admin/orders/_order_actions.html.erb +6 -0
  167. data/app/views/spree/admin/orders/_search.html.erb +151 -0
  168. data/app/views/spree/admin/orders/index.html.erb +2 -151
  169. data/app/views/spree/admin/payment_methods/_form.html.erb +2 -2
  170. data/app/views/spree/admin/payments/_list.html.erb +1 -1
  171. data/app/views/spree/admin/products/_form.html.erb +19 -19
  172. data/app/views/spree/admin/products/index.html.erb +2 -0
  173. data/app/views/spree/admin/products/new.html.erb +6 -6
  174. data/app/views/spree/admin/promotion_actions/create.js.erb +1 -1
  175. data/app/views/spree/admin/promotion_categories/_form.html.erb +2 -2
  176. data/app/views/spree/admin/promotions/_form.html.erb +5 -5
  177. data/app/views/spree/admin/properties/_form.html.erb +3 -3
  178. data/app/views/spree/admin/prototypes/_form.html.erb +4 -4
  179. data/app/views/spree/admin/refunds/new.html.erb +2 -2
  180. data/app/views/spree/admin/reimbursement_types/_form.html.erb +2 -2
  181. data/app/views/spree/admin/return_authorizations/_form.html.erb +3 -3
  182. data/app/views/spree/admin/roles/_form.html.erb +1 -1
  183. data/app/views/spree/admin/shared/_account_nav.html.erb +1 -1
  184. data/app/views/spree/admin/shared/_address_form.html.erb +4 -4
  185. data/app/views/spree/admin/shared/_head.html.erb +4 -8
  186. data/app/views/spree/admin/shared/_main_menu.html.erb +12 -0
  187. data/app/views/spree/admin/shared/_new_resource_links.html.erb +1 -1
  188. data/app/views/spree/admin/shared/_product_tabs.html.erb +8 -0
  189. data/app/views/spree/admin/shared/_version.html.erb +1 -1
  190. data/app/views/spree/admin/shared/cms/_spree_product.html.erb +2 -2
  191. data/app/views/spree/admin/shared/cms/_spree_taxon.html.erb +2 -2
  192. data/app/views/spree/admin/shared/linkables/_spree_cms_page.erb +2 -2
  193. data/app/views/spree/admin/shared/linkables/_spree_product.html.erb +2 -2
  194. data/app/views/spree/admin/shared/linkables/_spree_taxon.html.erb +2 -2
  195. data/app/views/spree/admin/shared/linkables/_url.html.erb +1 -1
  196. data/app/views/spree/admin/shared/named_types/_form.html.erb +1 -1
  197. data/app/views/spree/admin/{menus/nested_menu_items/_item_bar.html.erb → shared/sortable_tree/_menu.html.erb} +10 -7
  198. data/app/views/spree/admin/shared/sortable_tree/_taxonomy.html.erb +34 -0
  199. data/app/views/spree/admin/shared/sub_menu/_apps.html.erb +3 -0
  200. data/app/views/spree/admin/shared/sub_menu/_integrations.html.erb +3 -0
  201. data/app/views/spree/admin/shipping_categories/_form.html.erb +1 -1
  202. data/app/views/spree/admin/shipping_methods/_form.html.erb +8 -8
  203. data/app/views/spree/admin/states/_form.html.erb +2 -2
  204. data/app/views/spree/admin/stock_locations/_form.html.erb +2 -2
  205. data/app/views/spree/admin/stock_movements/_form.html.erb +3 -3
  206. data/app/views/spree/admin/store_credit_categories/_form.html.erb +1 -1
  207. data/app/views/spree/admin/store_credits/_form.html.erb +4 -4
  208. data/app/views/spree/admin/stores/_form.html.erb +280 -227
  209. data/app/views/spree/admin/tax_categories/_form.html.erb +4 -4
  210. data/app/views/spree/admin/tax_rates/_form.html.erb +4 -3
  211. data/app/views/spree/admin/taxonomies/_form.html.erb +2 -2
  212. data/app/views/spree/admin/taxonomies/edit.html.erb +34 -29
  213. data/app/views/spree/admin/taxons/_form.html.erb +101 -57
  214. data/app/views/spree/admin/taxons/edit.html.erb +6 -3
  215. data/app/views/spree/admin/taxons/index.html.erb +1 -1
  216. data/app/views/spree/admin/taxons/new.html.erb +16 -0
  217. data/app/views/spree/admin/users/_form.html.erb +3 -3
  218. data/app/views/spree/admin/users/edit.html.erb +0 -40
  219. data/app/views/spree/admin/variants/_autocomplete.js.erb +5 -5
  220. data/app/views/spree/admin/variants/_autocomplete_line_items_stock.js.erb +2 -2
  221. data/app/views/spree/admin/variants/_autocomplete_stock.js.erb +6 -6
  222. data/app/views/spree/admin/variants/_split.js.erb +1 -1
  223. data/app/views/spree/admin/variants/index.html.erb +4 -1
  224. data/app/views/spree/admin/webhooks_subscribers/_form.html.erb +101 -0
  225. data/app/views/spree/admin/webhooks_subscribers/edit.html.erb +13 -0
  226. data/app/views/spree/admin/webhooks_subscribers/index.html.erb +47 -0
  227. data/app/views/spree/admin/webhooks_subscribers/new.html.erb +13 -0
  228. data/app/views/spree/admin/webhooks_subscribers/show.html.erb +59 -0
  229. data/app/views/spree/admin/zones/_country_members.html.erb +1 -1
  230. data/app/views/spree/admin/zones/_form.html.erb +2 -2
  231. data/app/views/spree/admin/zones/_state_members.html.erb +1 -1
  232. data/app/views/spree/layouts/admin.html.erb +1 -11
  233. data/codespell.txt +8 -0
  234. data/config/locales/en.yml +273 -0
  235. data/config/routes.rb +8 -4
  236. data/lib/generators/spree/backend/install/install_generator.rb +4 -2
  237. data/lib/generators/spree/backend/install/templates/app/javascript/spree-dashboard.js +7 -0
  238. data/lib/spree/backend/engine.rb +2 -1
  239. data/lib/spree/backend/testing_support/capybara_utils.rb +53 -0
  240. data/lib/spree/backend/testing_support/flash.rb +38 -0
  241. data/lib/spree/backend/testing_support/flatpickr_capybara.rb +126 -0
  242. data/lib/spree/backend/version.rb +9 -0
  243. data/lib/spree/backend.rb +2 -1
  244. data/lib/spree_backend.rb +17 -0
  245. data/license.md +13 -0
  246. data/package.json +46 -0
  247. data/rollup.config.js +41 -0
  248. data/spree_backend.gemspec +17 -16
  249. data/vendor/assets/javascripts/purify.js +1 -1
  250. data/vendor/assets/stylesheets/animate.css +2 -4
  251. data/yarn.lock +959 -0
  252. metadata +120 -38
  253. data/app/assets/javascripts/spree/backend/menus/menu.es6 +0 -57
  254. data/app/assets/javascripts/spree/backend/taxon_permalink_preview.js +0 -11
  255. data/app/assets/javascripts/spree/backend/taxon_tree_menu.js +0 -35
  256. data/app/assets/javascripts/spree/backend/taxonomy.js +0 -178
  257. data/app/views/spree/admin/taxonomies/_js_head.html.erb +0 -7
  258. data/vendor/assets/javascripts/jquery.jstree/jquery.jstree.js +0 -4564
  259. data/vendor/assets/javascripts/js.cookie.js +0 -163
  260. data/vendor/assets/javascripts/modernizr.js +0 -3
  261. data/vendor/assets/stylesheets/jquery.jstree/themes/spree/style.scss +0 -230
  262. data/vendor/assets/stylesheets/jquery.jstree/themes/spree/throbber.gif +0 -0
  263. /data/app/assets/stylesheets/spree/backend/views/{prototypes.scss → _prototypes.scss} +0 -0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_backend
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.3
4
+ version: 4.4.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
@@ -9,36 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-04-21 00:00:00.000000000 Z
12
+ date: 2021-12-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: spree_api
15
+ name: spree
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 4.3.3
20
+ version: 4.4.0.rc1
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: 4.3.3
28
- - !ruby/object:Gem::Dependency
29
- name: spree_core
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: 4.3.3
35
- type: :runtime
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- version: 4.3.3
27
+ version: 4.4.0.rc1
42
28
  - !ruby/object:Gem::Dependency
43
29
  name: babel-transpiler
44
30
  requirement: !ruby/object:Gem::Requirement
@@ -95,6 +81,20 @@ dependencies:
95
81
  - - "~>"
96
82
  - !ruby/object:Gem::Version
97
83
  version: '4.6'
84
+ - !ruby/object:Gem::Dependency
85
+ name: hotwire-rails
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :runtime
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: inline_svg
100
100
  requirement: !ruby/object:Gem::Requirement
@@ -109,6 +109,20 @@ dependencies:
109
109
  - - "~>"
110
110
  - !ruby/object:Gem::Version
111
111
  version: '1.5'
112
+ - !ruby/object:Gem::Dependency
113
+ name: jsbundling-rails
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ type: :runtime
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
112
126
  - !ruby/object:Gem::Dependency
113
127
  name: jquery-rails
114
128
  requirement: !ruby/object:Gem::Requirement
@@ -213,8 +227,28 @@ executables: []
213
227
  extensions: []
214
228
  extra_rdoc_files: []
215
229
  files:
230
+ - ".circleci/config.yml"
231
+ - ".codeclimate.yml"
232
+ - ".editorconfig"
233
+ - ".eslintignore"
234
+ - ".eslintrc.cjs"
235
+ - ".gem_release.yml"
236
+ - ".github/CONTRIBUTING.md"
237
+ - ".github/ISSUE_TEMPLATE.md"
238
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
239
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
240
+ - ".github/dependabot.yml"
241
+ - ".github/workflows/spelling_lint.yml"
242
+ - ".gitignore"
243
+ - ".rubocop.yml"
244
+ - ".solargraph.yml"
245
+ - ".stylelintignore"
246
+ - ".stylelintrc"
247
+ - CODE_OF_CONDUCT.md
216
248
  - Gemfile
249
+ - README.md
217
250
  - Rakefile
251
+ - SECURITY.md
218
252
  - app/assets/config/spree_backend_manifest.js
219
253
  - app/assets/images/admin/logo.png
220
254
  - app/assets/images/backend-add.svg
@@ -238,6 +272,7 @@ files:
238
272
  - app/assets/images/backend-circle.svg
239
273
  - app/assets/images/backend-clone.svg
240
274
  - app/assets/images/backend-close.svg
275
+ - app/assets/images/backend-cloud-arrow-up.svg
241
276
  - app/assets/images/backend-default-layout.svg
242
277
  - app/assets/images/backend-delete.svg
243
278
  - app/assets/images/backend-double-chevron-left.svg
@@ -249,16 +284,26 @@ files:
249
284
  - app/assets/images/backend-extensions.svg
250
285
  - app/assets/images/backend-eye-open.svg
251
286
  - app/assets/images/backend-eye-slash-fill.svg
287
+ - app/assets/images/backend-file-earmark-font.svg
288
+ - app/assets/images/backend-file-earmark-image.svg
289
+ - app/assets/images/backend-file-earmark-music.svg
290
+ - app/assets/images/backend-file-earmark-pdf.svg
291
+ - app/assets/images/backend-file-earmark-play.svg
292
+ - app/assets/images/backend-file-earmark-spreadsheet.svg
293
+ - app/assets/images/backend-file-earmark-zip.svg
294
+ - app/assets/images/backend-file-earmark.svg
252
295
  - app/assets/images/backend-file-richtext.svg
253
296
  - app/assets/images/backend-file.svg
254
297
  - app/assets/images/backend-filter.svg
255
298
  - app/assets/images/backend-folder.svg
256
299
  - app/assets/images/backend-fullscreen-exit.svg
257
300
  - app/assets/images/backend-fullscreen.svg
301
+ - app/assets/images/backend-hdd.svg
258
302
  - app/assets/images/backend-images.svg
259
303
  - app/assets/images/backend-info.svg
260
304
  - app/assets/images/backend-items.svg
261
305
  - app/assets/images/backend-leaf.svg
306
+ - app/assets/images/backend-link.svg
262
307
  - app/assets/images/backend-list.svg
263
308
  - app/assets/images/backend-location.svg
264
309
  - app/assets/images/backend-menu.svg
@@ -319,8 +364,9 @@ files:
319
364
  - app/assets/javascripts/spree/backend/general_settings.js
320
365
  - app/assets/javascripts/spree/backend/global/_index.js
321
366
  - app/assets/javascripts/spree/backend/global/alerts.es6
367
+ - app/assets/javascripts/spree/backend/global/animate_css.es6
322
368
  - app/assets/javascripts/spree/backend/global/api_functions.es6
323
- - app/assets/javascripts/spree/backend/global/bootstrap.es6
369
+ - app/assets/javascripts/spree/backend/global/fetch_request_utility.es6
324
370
  - app/assets/javascripts/spree/backend/global/flatpickr.es6
325
371
  - app/assets/javascripts/spree/backend/global/info_alert.es6
326
372
  - app/assets/javascripts/spree/backend/global/radio_panel_toggle.es6
@@ -335,7 +381,6 @@ files:
335
381
  - app/assets/javascripts/spree/backend/line_items.js
336
382
  - app/assets/javascripts/spree/backend/line_items_on_order_edit.js
337
383
  - app/assets/javascripts/spree/backend/menus/_index.es6
338
- - app/assets/javascripts/spree/backend/menus/menu.es6
339
384
  - app/assets/javascripts/spree/backend/menus/menu_item.es6
340
385
  - app/assets/javascripts/spree/backend/multi_currency.js
341
386
  - app/assets/javascripts/spree/backend/option_type_autocomplete.js
@@ -356,9 +401,6 @@ files:
356
401
  - app/assets/javascripts/spree/backend/stock_movement.js
357
402
  - app/assets/javascripts/spree/backend/stock_transfer.js
358
403
  - app/assets/javascripts/spree/backend/taxon_autocomplete.js
359
- - app/assets/javascripts/spree/backend/taxon_permalink_preview.js
360
- - app/assets/javascripts/spree/backend/taxon_tree_menu.js
361
- - app/assets/javascripts/spree/backend/taxonomy.js
362
404
  - app/assets/javascripts/spree/backend/taxons.js
363
405
  - app/assets/javascripts/spree/backend/user_picker.js
364
406
  - app/assets/javascripts/spree/backend/users/edit.js
@@ -391,12 +433,15 @@ files:
391
433
  - app/assets/stylesheets/spree/backend/shared/_base.scss
392
434
  - app/assets/stylesheets/spree/backend/shared/_forms.scss
393
435
  - app/assets/stylesheets/spree/backend/shared/_glyphicons_urls_fix.scss
436
+ - app/assets/stylesheets/spree/backend/shared/_sortable_tree.scss
394
437
  - app/assets/stylesheets/spree/backend/spree_admin.css.scss
395
438
  - app/assets/stylesheets/spree/backend/views/_cms_pages.scss
439
+ - app/assets/stylesheets/spree/backend/views/_digitals.scss
396
440
  - app/assets/stylesheets/spree/backend/views/_menus.scss
397
441
  - app/assets/stylesheets/spree/backend/views/_order_payments.scss
398
442
  - app/assets/stylesheets/spree/backend/views/_product_properties.scss
399
- - app/assets/stylesheets/spree/backend/views/prototypes.scss
443
+ - app/assets/stylesheets/spree/backend/views/_prototypes.scss
444
+ - app/assets/stylesheets/spree/backend/views/_taxonomies.scss
400
445
  - app/controllers/concerns/spree/admin/order_concern.rb
401
446
  - app/controllers/concerns/spree/admin/product_concern.rb
402
447
  - app/controllers/spree/admin/adjustments_controller.rb
@@ -405,12 +450,14 @@ files:
405
450
  - app/controllers/spree/admin/cms_sections_controller.rb
406
451
  - app/controllers/spree/admin/countries_controller.rb
407
452
  - app/controllers/spree/admin/customer_returns_controller.rb
453
+ - app/controllers/spree/admin/digitals_controller.rb
408
454
  - app/controllers/spree/admin/errors_controller.rb
409
455
  - app/controllers/spree/admin/general_settings_controller.rb
410
456
  - app/controllers/spree/admin/images_controller.rb
411
457
  - app/controllers/spree/admin/log_entries_controller.rb
412
458
  - app/controllers/spree/admin/menu_items_controller.rb
413
459
  - app/controllers/spree/admin/menus_controller.rb
460
+ - app/controllers/spree/admin/oauth_applications_controller.rb
414
461
  - app/controllers/spree/admin/option_types_controller.rb
415
462
  - app/controllers/spree/admin/option_values_controller.rb
416
463
  - app/controllers/spree/admin/orders/customer_details_controller.rb
@@ -455,11 +502,13 @@ files:
455
502
  - app/controllers/spree/admin/users_controller.rb
456
503
  - app/controllers/spree/admin/variants_controller.rb
457
504
  - app/controllers/spree/admin/variants_including_master_controller.rb
505
+ - app/controllers/spree/admin/webhooks_subscribers_controller.rb
458
506
  - app/controllers/spree/admin/zones_controller.rb
459
507
  - app/helpers/spree/admin/adjustments_helper.rb
460
508
  - app/helpers/spree/admin/base_helper.rb
461
509
  - app/helpers/spree/admin/cms_helper.rb
462
510
  - app/helpers/spree/admin/customer_returns_helper.rb
511
+ - app/helpers/spree/admin/digital_helper.rb
463
512
  - app/helpers/spree/admin/images_helper.rb
464
513
  - app/helpers/spree/admin/menu_helper.rb
465
514
  - app/helpers/spree/admin/navigation_helper.rb
@@ -468,10 +517,21 @@ files:
468
517
  - app/helpers/spree/admin/promotion_rules_helper.rb
469
518
  - app/helpers/spree/admin/reimbursement_type_helper.rb
470
519
  - app/helpers/spree/admin/reimbursements_helper.rb
520
+ - app/helpers/spree/admin/sortable_tree_helper.rb
471
521
  - app/helpers/spree/admin/stock_locations_helper.rb
472
522
  - app/helpers/spree/admin/stock_movements_helper.rb
473
523
  - app/helpers/spree/admin/stores_helper.rb
474
524
  - app/helpers/spree/admin/taxons_helper.rb
525
+ - app/helpers/spree/admin/webhooks_subscribers_helper.rb
526
+ - app/javascript/spree/dashboard/controllers/clipboard_controller.js
527
+ - app/javascript/spree/dashboard/controllers/password_toggle_controller.js
528
+ - app/javascript/spree/dashboard/controllers/sortable_tree_controller.js
529
+ - app/javascript/spree/dashboard/controllers/spree_controller.js
530
+ - app/javascript/spree/dashboard/controllers/upload_button_controller.js
531
+ - app/javascript/spree/dashboard/controllers/webhooks_subscriber_events_controller.js
532
+ - app/javascript/spree/dashboard/index.js
533
+ - app/javascript/spree/dashboard/utilities/bootstrap.js
534
+ - app/javascript/spree/dashboard/utilities/request_utility.js
475
535
  - app/models/spree/admin/resource.rb
476
536
  - app/models/spree/backend_configuration.rb
477
537
  - app/views/kaminari/admin-twitter-bootstrap-4/_first_page.html.erb
@@ -512,6 +572,8 @@ files:
512
572
  - app/views/spree/admin/customer_returns/edit.html.erb
513
573
  - app/views/spree/admin/customer_returns/index.html.erb
514
574
  - app/views/spree/admin/customer_returns/new.html.erb
575
+ - app/views/spree/admin/digitals/_form.html.erb
576
+ - app/views/spree/admin/digitals/index.html.erb
515
577
  - app/views/spree/admin/errors/forbidden.html.erb
516
578
  - app/views/spree/admin/general_settings/edit.html.erb
517
579
  - app/views/spree/admin/images/_form.html.erb
@@ -525,8 +587,12 @@ files:
525
587
  - app/views/spree/admin/menus/_form.html.erb
526
588
  - app/views/spree/admin/menus/edit.html.erb
527
589
  - app/views/spree/admin/menus/index.html.erb
528
- - app/views/spree/admin/menus/nested_menu_items/_item_bar.html.erb
529
590
  - app/views/spree/admin/menus/new.html.erb
591
+ - app/views/spree/admin/oauth_applications/_form.html.erb
592
+ - app/views/spree/admin/oauth_applications/create.turbo_stream.erb
593
+ - app/views/spree/admin/oauth_applications/edit.html.erb
594
+ - app/views/spree/admin/oauth_applications/index.html.erb
595
+ - app/views/spree/admin/oauth_applications/new.html.erb
530
596
  - app/views/spree/admin/option_types/_form.html.erb
531
597
  - app/views/spree/admin/option_types/_option_value_fields.html.erb
532
598
  - app/views/spree/admin/option_types/edit.html.erb
@@ -541,6 +607,7 @@ files:
541
607
  - app/views/spree/admin/orders/_line_items_edit_form.html.erb
542
608
  - app/views/spree/admin/orders/_order_actions.html.erb
543
609
  - app/views/spree/admin/orders/_risk_analysis.html.erb
610
+ - app/views/spree/admin/orders/_search.html.erb
544
611
  - app/views/spree/admin/orders/_shipment.html.erb
545
612
  - app/views/spree/admin/orders/_shipment_manifest.html.erb
546
613
  - app/views/spree/admin/orders/cart.html.erb
@@ -688,8 +755,12 @@ files:
688
755
  - app/views/spree/admin/shared/named_types/_form.html.erb
689
756
  - app/views/spree/admin/shared/named_types/_index.html.erb
690
757
  - app/views/spree/admin/shared/named_types/_new.html.erb
758
+ - app/views/spree/admin/shared/sortable_tree/_menu.html.erb
759
+ - app/views/spree/admin/shared/sortable_tree/_taxonomy.html.erb
760
+ - app/views/spree/admin/shared/sub_menu/_apps.html.erb
691
761
  - app/views/spree/admin/shared/sub_menu/_configuration.html.erb
692
762
  - app/views/spree/admin/shared/sub_menu/_content.html.erb
763
+ - app/views/spree/admin/shared/sub_menu/_integrations.html.erb
693
764
  - app/views/spree/admin/shared/sub_menu/_product.html.erb
694
765
  - app/views/spree/admin/shared/sub_menu/_promotion.html.erb
695
766
  - app/views/spree/admin/shared/sub_menu/_returns.html.erb
@@ -744,7 +815,6 @@ files:
744
815
  - app/views/spree/admin/tax_rates/index.html.erb
745
816
  - app/views/spree/admin/tax_rates/new.html.erb
746
817
  - app/views/spree/admin/taxonomies/_form.html.erb
747
- - app/views/spree/admin/taxonomies/_js_head.html.erb
748
818
  - app/views/spree/admin/taxonomies/_list.html.erb
749
819
  - app/views/spree/admin/taxonomies/edit.html.erb
750
820
  - app/views/spree/admin/taxonomies/index.html.erb
@@ -753,6 +823,7 @@ files:
753
823
  - app/views/spree/admin/taxons/_taxon_table.html.erb
754
824
  - app/views/spree/admin/taxons/edit.html.erb
755
825
  - app/views/spree/admin/taxons/index.html.erb
826
+ - app/views/spree/admin/taxons/new.html.erb
756
827
  - app/views/spree/admin/users/_addresses_form.html.erb
757
828
  - app/views/spree/admin/users/_form.html.erb
758
829
  - app/views/spree/admin/users/_lifetime_stats.html.erb
@@ -774,6 +845,11 @@ files:
774
845
  - app/views/spree/admin/variants/new.html.erb
775
846
  - app/views/spree/admin/variants/new.js.erb
776
847
  - app/views/spree/admin/variants/update.js.erb
848
+ - app/views/spree/admin/webhooks_subscribers/_form.html.erb
849
+ - app/views/spree/admin/webhooks_subscribers/edit.html.erb
850
+ - app/views/spree/admin/webhooks_subscribers/index.html.erb
851
+ - app/views/spree/admin/webhooks_subscribers/new.html.erb
852
+ - app/views/spree/admin/webhooks_subscribers/show.html.erb
777
853
  - app/views/spree/admin/zones/_country_members.html.erb
778
854
  - app/views/spree/admin/zones/_form.html.erb
779
855
  - app/views/spree/admin/zones/_state_members.html.erb
@@ -781,19 +857,29 @@ files:
781
857
  - app/views/spree/admin/zones/index.html.erb
782
858
  - app/views/spree/admin/zones/new.html.erb
783
859
  - app/views/spree/layouts/admin.html.erb
860
+ - codespell.txt
784
861
  - config/initializers/assets.rb
785
862
  - config/initializers/form_builder.rb
786
863
  - config/initializers/ransack.rb
864
+ - config/locales/en.yml
787
865
  - config/routes.rb
788
866
  - lib/generators/spree/backend/copy_views/copy_views_generator.rb
789
867
  - lib/generators/spree/backend/install/install_generator.rb
868
+ - lib/generators/spree/backend/install/templates/app/javascript/spree-dashboard.js
790
869
  - lib/generators/spree/backend/install/templates/vendor/assets/javascripts/spree/backend/all.js
791
870
  - lib/generators/spree/backend/install/templates/vendor/assets/stylesheets/spree/backend/all.css
792
871
  - lib/spree/backend.rb
793
872
  - lib/spree/backend/action_callbacks.rb
794
873
  - lib/spree/backend/callbacks.rb
795
874
  - lib/spree/backend/engine.rb
875
+ - lib/spree/backend/testing_support/capybara_utils.rb
876
+ - lib/spree/backend/testing_support/flash.rb
877
+ - lib/spree/backend/testing_support/flatpickr_capybara.rb
878
+ - lib/spree/backend/version.rb
796
879
  - lib/spree_backend.rb
880
+ - license.md
881
+ - package.json
882
+ - rollup.config.js
797
883
  - script/rails
798
884
  - spec/fixtures/files/favicon.ico
799
885
  - spec/fixtures/files/icon_512x512.png
@@ -801,26 +887,22 @@ files:
801
887
  - spree_backend.gemspec
802
888
  - vendor/assets/javascripts/cleave.js
803
889
  - vendor/assets/javascripts/handlebars.js
804
- - vendor/assets/javascripts/jquery.jstree/jquery.jstree.js
805
- - vendor/assets/javascripts/js.cookie.js
806
890
  - vendor/assets/javascripts/jsonapi-serializer.min.js
807
891
  - vendor/assets/javascripts/jsuri.js
808
- - vendor/assets/javascripts/modernizr.js
809
892
  - vendor/assets/javascripts/purify.js
810
893
  - vendor/assets/javascripts/sortable.js
811
894
  - vendor/assets/javascripts/sweetalert2.js
812
895
  - vendor/assets/javascripts/underscore-min.js
813
896
  - vendor/assets/stylesheets/animate.css
814
- - vendor/assets/stylesheets/jquery.jstree/themes/spree/style.scss
815
- - vendor/assets/stylesheets/jquery.jstree/themes/spree/throbber.gif
897
+ - yarn.lock
816
898
  homepage: https://spreecommerce.org
817
899
  licenses:
818
900
  - BSD-3-Clause
819
901
  metadata:
820
- bug_tracker_uri: https://github.com/spree/spree/issues
821
- changelog_uri: https://github.com/spree/spree/releases/tag/v4.3.3
902
+ bug_tracker_uri: https://github.com/spree/spree_backend/issues
903
+ changelog_uri: https://github.com/spree/spree_backend/releases/tag/v4.4.0.rc1
822
904
  documentation_uri: https://dev-docs.spreecommerce.org/
823
- source_code_uri: https://github.com/spree/spree/tree/v4.3.3
905
+ source_code_uri: https://github.com/spree/spree_backend/tree/v4.4.0.rc1
824
906
  post_install_message:
825
907
  rdoc_options: []
826
908
  require_paths:
@@ -832,12 +914,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
832
914
  version: '2.5'
833
915
  required_rubygems_version: !ruby/object:Gem::Requirement
834
916
  requirements:
835
- - - ">="
917
+ - - ">"
836
918
  - !ruby/object:Gem::Version
837
- version: '0'
919
+ version: 1.3.1
838
920
  requirements:
839
921
  - none
840
- rubygems_version: 3.5.3
922
+ rubygems_version: 3.2.22
841
923
  signing_key:
842
924
  specification_version: 4
843
925
  summary: Admin Dashboard for Spree eCommerce platform
@@ -1,57 +0,0 @@
1
- /* eslint-disable no-new */
2
-
3
- document.addEventListener('DOMContentLoaded', function() {
4
- const menuItemSortable = {
5
- group: {
6
- name: 'sortable-menu',
7
- pull: true,
8
- put: true
9
- },
10
- handle: '.move-handle',
11
- swapThreshold: 0.5,
12
- emptyInsertThreshold: 8,
13
- dragClass: 'menu-item-dragged',
14
- draggable: '.dragable',
15
- animation: 350,
16
- forceFallback: false,
17
- onEnd: function (evt) {
18
- handleMenuItemMove(evt)
19
- }
20
- }
21
-
22
- let containers = null;
23
- containers = document.querySelectorAll('.menu-container');
24
-
25
- for (let i = 0; i < containers.length; i++) {
26
- new Sortable(containers[i], menuItemSortable);
27
- }
28
- })
29
-
30
- function handleMenuItemMove(evt) {
31
- const data = {
32
- new_parent_id: parseInt(evt.to.dataset.parentId, 10) || null,
33
- new_position_idx: parseInt(evt.newIndex, 10)
34
- }
35
-
36
- fetch(`${Spree.routes.menus_items_api_v2}/${evt.item.dataset.itemId}/reposition`, {
37
- method: 'PATCH',
38
- headers: {
39
- Authorization: 'Bearer ' + OAUTH_TOKEN,
40
- 'Content-Type': 'application/json'
41
- },
42
- body: JSON.stringify(data)
43
- })
44
- .then(response => {
45
- if (response.ok !== true) {
46
- handleMenuItemMoveError()
47
- }
48
- })
49
- .catch(err => {
50
- console.error(err);
51
- });
52
- }
53
-
54
- function handleMenuItemMoveError () {
55
- // eslint-disable-next-line no-undef
56
- show_flash('error', Spree.translations.move_could_not_be_saved)
57
- }
@@ -1,11 +0,0 @@
1
- $(document).ready(function () {
2
- if ($('#permalink_part_display').length) {
3
- var field = $('#permalink_part')
4
- var target = $('#permalink_part_display')
5
- var permalinkPartDefault = target.text().trim()
6
- target.text(permalinkPartDefault + field.val())
7
- field.on('keyup blur', function () {
8
- target.text(permalinkPartDefault + $(this).val())
9
- })
10
- };
11
- })
@@ -1,35 +0,0 @@
1
- var root = typeof exports !== 'undefined' && exports !== null ? exports : this
2
-
3
- root.taxon_tree_menu = function (obj, context) {
4
- var adminBaseUrl = Spree.url(Spree.routes.admin_taxonomy_taxons_path)
5
- var editUrl = adminBaseUrl.clone()
6
- editUrl.setPath(editUrl.path() + '/' + obj.attr('id') + '/edit')
7
- return {
8
- create: {
9
- label: '<i class="icon icon-add"></i>' + Spree.translations.add,
10
- action: function (obj) {
11
- return context.create(obj)
12
- }
13
- },
14
- rename: {
15
- label: '<i class="icon icon-edit"></i> ' + Spree.translations.rename,
16
- action: function (obj) {
17
- return context.rename(obj)
18
- }
19
- },
20
- remove: {
21
- label: '<i class="icon icon-delete"></i> ' + Spree.translations.remove,
22
- action: function (obj) {
23
- return context.remove(obj)
24
- }
25
- },
26
- edit: {
27
- separator_before: true,
28
- label: '<i class="icon icon-settings"></i> ' + Spree.translations.edit,
29
- action: function () {
30
- window.location = editUrl.toString()
31
- return window.location
32
- }
33
- }
34
- }
35
- }
@@ -1,178 +0,0 @@
1
- /* globals show_flash, base_url, taxon_tree_menu */
2
-
3
- function handleAjaxError (lastRollback) {
4
- $.jstree.rollback(lastRollback)
5
- show_flash('error', '<strong>' + Spree.translations.server_error + '</strong><br />' + Spree.translations.taxonomy_tree_error)
6
- }
7
-
8
- function handleMove (e, data) {
9
- var lastRollback = data.rlbk
10
- var position = data.rslt.cp
11
- var node = data.rslt.o
12
- var newParent = data.rslt.np
13
- var url = Spree.url(base_url).clone()
14
- url.setPath(url.path() + '/' + node.prop('id'))
15
- if (newParent.attr('id') === data.rslt.op.attr('id') && position > data.rslt.cop) {
16
- position = position - 1
17
- }
18
- $.ajax({
19
- type: 'POST',
20
- dataType: 'json',
21
- url: url.toString(),
22
- data: {
23
- _method: 'put',
24
- 'taxon[parent_id]': newParent.prop('id'),
25
- 'taxon[child_index]': position,
26
- token: Spree.api_key
27
- }
28
- }).fail(function () {
29
- handleAjaxError(lastRollback)
30
- })
31
- return true
32
- }
33
-
34
- function handleCreate (e, data) {
35
- var lastRollback = data.rlbk
36
- var node = data.rslt.obj
37
- var name = data.rslt.name
38
- var position = data.rslt.position
39
- var newParent = data.rslt.parent
40
- return $.ajax({
41
- type: 'POST',
42
- dataType: 'json',
43
- url: base_url.toString(),
44
- data: {
45
- 'taxon[name]': name,
46
- 'taxon[parent_id]': newParent.prop('id'),
47
- 'taxon[child_index]': position,
48
- token: Spree.api_key
49
- }
50
- }).done(function (data) {
51
- node.prop('id', data.id)
52
- }).fail(function () {
53
- return handleAjaxError(lastRollback)
54
- })
55
- }
56
-
57
- function handleRename (e, data) {
58
- var lastRollback = data.rlbk
59
- var node = data.rslt.obj
60
- var name = data.rslt.new_name
61
- var url = Spree.url(base_url).clone()
62
- url.setPath(url.path() + '/' + node.prop('id'))
63
- return $.ajax({
64
- type: 'POST',
65
- dataType: 'json',
66
- url: url.toString(),
67
- data: {
68
- _method: 'put',
69
- 'taxon[name]': name,
70
- token: Spree.api_key
71
- }
72
- }).fail(function () {
73
- handleAjaxError(lastRollback)
74
- })
75
- }
76
-
77
- function handleDelete (e, data) {
78
- var lastRollback = data.rlbk
79
- var node = data.rslt.obj
80
- var deleteUrl = base_url.clone()
81
- deleteUrl.setPath(deleteUrl.path() + '/' + node.prop('id'))
82
- if (confirm(Spree.translations.are_you_sure_delete)) {
83
- $.ajax({
84
- type: 'POST',
85
- dataType: 'json',
86
- url: deleteUrl.toString(),
87
- data: {
88
- _method: 'delete',
89
- token: Spree.api_key
90
- }
91
- }).fail(function () {
92
- handleAjaxError(lastRollback)
93
- })
94
- } else {
95
- $.jstree.rollback(lastRollback)
96
- lastRollback = null
97
- }
98
- }
99
-
100
- var root = typeof exports !== 'undefined' && exports !== null ? exports : this
101
-
102
- root.setup_taxonomy_tree = function (taxonomyId) {
103
- var $taxonomyTree = $('#taxonomy_tree')
104
- if (taxonomyId !== void 0) {
105
- // this is defined within admin/taxonomies/edit
106
- root.base_url = Spree.url(Spree.routes.taxonomy_taxons_path)
107
- $.ajax({
108
- url: Spree.url(base_url.path().replace('/taxons', '/jstree')).toString(),
109
- data: {
110
- token: Spree.api_key
111
- }
112
- }).done(function (taxonomy) {
113
- // eslint-disable-next-line no-unused-vars
114
- var lastRollback = null
115
- var conf = {
116
- json_data: {
117
- data: taxonomy,
118
- ajax: {
119
- url: function (e) {
120
- return Spree.url(base_url.path() + '/' + e.prop('id') + '/jstree' + '?token=' + Spree.api_key).toString()
121
- }
122
- }
123
- },
124
- themes: {
125
- theme: 'spree',
126
- url: Spree.url(Spree.routes.jstree_theme_path)
127
- },
128
- strings: {
129
- new_node: Spree.translations.new_taxon,
130
- loading: Spree.translations.loading + '...'
131
- },
132
- crrm: {
133
- move: {
134
- check_move: function (m) {
135
- var newParent, node, position
136
- position = m.cp
137
- node = m.o
138
- newParent = m.np
139
- if (!newParent || node.prop('rel') === 'root') {
140
- return false
141
- }
142
- // can't drop before root
143
- if (newParent.prop('id') === 'taxonomy_tree' && position === 0) {
144
- return false
145
- }
146
- return true
147
- }
148
- }
149
- },
150
- contextmenu: {
151
- items: function (obj) {
152
- return taxon_tree_menu(obj, this)
153
- }
154
- },
155
- plugins: ['themes', 'json_data', 'dnd', 'crrm', 'contextmenu']
156
- }
157
- return $taxonomyTree.jstree(conf).bind('move_node.jstree', handleMove).bind('remove.jstree', handleDelete).bind('create.jstree', handleCreate).bind('rename.jstree', handleRename).bind('loaded.jstree', function () {
158
- return $(this).jstree('core').toggle_node($('.jstree-icon').first())
159
- })
160
- })
161
-
162
- $taxonomyTree.on('dblclick', 'a', function () {
163
- var iOS = /iPad|iPhone|iPod/.test(navigator.platform || '')
164
- if (iOS) {
165
- $taxonomyTree.jstree('show_contextmenu', this)
166
- } else {
167
- $taxonomyTree.jstree('rename', this)
168
- }
169
- })
170
-
171
- // suppress form submit on enter/return
172
- $(document).keypress(function (event) {
173
- if (event.keyCode === 13) {
174
- event.preventDefault()
175
- }
176
- })
177
- }
178
- }