spree_backend 4.6.2 → 4.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +20 -101
  3. data/.codeclimate.yml +1 -1
  4. data/.rubocop.yml +5 -2
  5. data/Gemfile +10 -14
  6. data/app/assets/javascripts/spree/backend/global/tinymce.es6 +2 -2
  7. data/app/assets/javascripts/spree/backend/stock_transfer.js +1 -1
  8. data/app/controllers/spree/admin/products_controller.rb +22 -0
  9. data/app/helpers/spree/admin/navigation_helper.rb +77 -11
  10. data/app/helpers/spree/admin/orders_helper.rb +0 -18
  11. data/app/models/spree/admin/actions/action.rb +48 -0
  12. data/app/models/spree/admin/actions/action_builder.rb +79 -0
  13. data/app/models/spree/admin/actions/action_style.rb +11 -0
  14. data/app/models/spree/admin/actions/adjustments_default_actions_builder.rb +28 -0
  15. data/app/models/spree/admin/actions/images_default_actions_builder.rb +29 -0
  16. data/app/models/spree/admin/actions/order_default_actions_builder.rb +92 -0
  17. data/app/models/spree/admin/actions/orders_default_actions_builder.rb +29 -0
  18. data/app/models/spree/admin/actions/payments_default_actions_builder.rb +33 -0
  19. data/app/models/spree/admin/actions/product_properties_default_actions_builder.rb +42 -0
  20. data/app/models/spree/admin/actions/products_default_actions_builder.rb +29 -0
  21. data/app/models/spree/admin/actions/root.rb +15 -0
  22. data/app/models/spree/admin/actions/store_credits_default_actions_builder.rb +28 -0
  23. data/app/models/spree/admin/actions/user_default_actions_builder.rb +29 -0
  24. data/app/models/spree/admin/actions/users_default_actions_builder.rb +29 -0
  25. data/app/models/spree/admin/actions/variants_default_actions_builder.rb +30 -0
  26. data/app/models/spree/admin/item_manager.rb +50 -0
  27. data/app/models/spree/admin/main_menu/default_configuration_builder.rb +263 -0
  28. data/app/models/spree/admin/main_menu/item.rb +30 -0
  29. data/app/models/spree/admin/main_menu/item_builder.rb +37 -0
  30. data/app/models/spree/admin/main_menu/root.rb +17 -0
  31. data/app/models/spree/admin/main_menu/section.rb +31 -0
  32. data/app/models/spree/admin/main_menu/section_builder.rb +36 -0
  33. data/app/models/spree/admin/permission_checks.rb +50 -0
  34. data/app/models/spree/admin/tabs/order_default_tabs_builder.rb +147 -0
  35. data/app/models/spree/admin/tabs/product_default_tabs_builder.rb +144 -0
  36. data/app/models/spree/admin/tabs/root.rb +15 -0
  37. data/app/models/spree/admin/tabs/tab.rb +38 -0
  38. data/app/models/spree/admin/tabs/tab_builder.rb +63 -0
  39. data/app/models/spree/admin/tabs/user_default_tabs_builder.rb +77 -0
  40. data/app/views/spree/admin/adjustments/index.html.erb +9 -1
  41. data/app/views/spree/admin/cms_sections/types/_image_gallery.html.erb +27 -33
  42. data/app/views/spree/admin/cms_sections/types/_side_by_side_images.html.erb +18 -22
  43. data/app/views/spree/admin/images/index.html.erb +12 -3
  44. data/app/views/spree/admin/orders/_order_actions.html.erb +10 -15
  45. data/app/views/spree/admin/orders/index.html.erb +11 -6
  46. data/app/views/spree/admin/payments/index.html.erb +9 -4
  47. data/app/views/spree/admin/prices/index.html.erb +12 -2
  48. data/app/views/spree/admin/product_properties/index.html.erb +13 -13
  49. data/app/views/spree/admin/products/_add_stock_form.html.erb +12 -1
  50. data/app/views/spree/admin/products/edit.html.erb +12 -1
  51. data/app/views/spree/admin/products/index.html.erb +11 -2
  52. data/app/views/spree/admin/shared/_main_menu.html.erb +19 -77
  53. data/app/views/spree/admin/shared/_order_tabs.html.erb +10 -83
  54. data/app/views/spree/admin/shared/_product_tabs.html.erb +12 -64
  55. data/app/views/spree/admin/store_credits/index.html.erb +9 -1
  56. data/app/views/spree/admin/users/_tabs.html.erb +11 -30
  57. data/app/views/spree/admin/users/_user_page_actions.html.erb +9 -1
  58. data/app/views/spree/admin/users/index.html.erb +11 -2
  59. data/app/views/spree/admin/variants/index.html.erb +12 -2
  60. data/app/views/spree/admin/webhooks_subscribers/index.html.erb +0 -11
  61. data/config/locales/en.yml +6 -4
  62. data/lib/spree/backend/configuration.rb +0 -17
  63. data/lib/spree/backend/engine.rb +28 -1
  64. data/lib/spree/backend/version.rb +1 -1
  65. data/spree_backend.gemspec +2 -2
  66. data/yarn.lock +58 -22
  67. metadata +36 -17
  68. data/app/views/spree/admin/shared/sub_menu/_apps.html.erb +0 -3
  69. data/app/views/spree/admin/shared/sub_menu/_configuration.html.erb +0 -19
  70. data/app/views/spree/admin/shared/sub_menu/_content.html.erb +0 -4
  71. data/app/views/spree/admin/shared/sub_menu/_integrations.html.erb +0 -5
  72. data/app/views/spree/admin/shared/sub_menu/_orders.html.erb +0 -5
  73. data/app/views/spree/admin/shared/sub_menu/_organizations.html.erb +0 -3
  74. data/app/views/spree/admin/shared/sub_menu/_product.html.erb +0 -8
  75. data/app/views/spree/admin/shared/sub_menu/_promotion.html.erb +0 -4
  76. data/app/views/spree/admin/shared/sub_menu/_returns.html.erb +0 -4
  77. data/app/views/spree/admin/shared/sub_menu/_stock.html.erb +0 -4
@@ -4,7 +4,18 @@
4
4
  </h5>
5
5
  </div>
6
6
  <% content_for :page_actions do %>
7
- <%= external_page_preview_link(@product) %>
7
+ <% stock_actions.items.each do |action| %>
8
+ <% next unless action.available?(current_ability) %>
9
+ <%= button_link_to(
10
+ Spree.t(action.label_translation_key),
11
+ action.url(@product),
12
+ class: action.classes,
13
+ icon: action.icon_key,
14
+ id: action.id,
15
+ target: action.target,
16
+ data: action.data_attributes
17
+ ) %>
18
+ <% end if product_actions&.items %>
8
19
  <% end %>
9
20
  <div class="card-body">
10
21
  <%= form_for [:admin, Spree::StockMovement.new], url: admin_stock_items_path do |f| %>
@@ -1,5 +1,16 @@
1
1
  <% content_for :page_actions do %>
2
- <%= external_page_preview_link(@product) %>
2
+ <% product_actions.items.each do |action| %>
3
+ <% next unless action.available?(current_ability) %>
4
+ <%= button_link_to(
5
+ Spree.t(action.label_translation_key),
6
+ action.url(@product),
7
+ class: action.classes,
8
+ icon: action.icon_key,
9
+ id: action.id,
10
+ target: action.target,
11
+ data: action.data_attributes
12
+ ) %>
13
+ <% end if product_actions&.items %>
3
14
  <% end %>
4
15
 
5
16
  <%= render partial: 'spree/admin/shared/product_tabs', locals: {current: :details} %>
@@ -3,8 +3,17 @@
3
3
  <% end %>
4
4
 
5
5
  <% content_for :page_actions do %>
6
- <%= button_link_to Spree.t(:new_product), new_object_url, { class: "btn-success", icon: 'add.svg', id: 'admin_new_product' } %>
7
- <% end if can?(:create, Spree::Product) %>
6
+ <% products_actions.items.each do |action| %>
7
+ <% next unless action.available?(current_ability) %>
8
+ <%= button_link_to(
9
+ Spree.t(action.label_translation_key),
10
+ action.url,
11
+ class: action.classes,
12
+ icon: action.icon_key,
13
+ id: action.id
14
+ ) %>
15
+ <% end %>
16
+ <% end %>
8
17
 
9
18
  <% content_for :page_tabs do %>
10
19
  <li class="nav-item">
@@ -11,83 +11,25 @@
11
11
  </button>
12
12
  </div>
13
13
 
14
- <ul class="nav nav-sidebar" id="sidebarDashboard">
15
- <%= tab Spree.t('admin.home'), url: spree.admin_dashboard_path, match_path: '/dashboard', icon: 'house-door-fill.svg' %>
16
- </ul>
17
-
18
- <% if can? :admin, Spree::Order %>
19
- <ul class="nav nav-sidebar" id="sidebarOrder">
20
- <%= main_menu_tree Spree.t(:orders), icon: "inbox-fill.svg", sub_menu: "orders", url: "#sidebar-orders" %>
21
- </ul>
22
- <% end %>
23
-
24
- <% if can?(:admin, Spree::ReturnAuthorization) || can?(:admin, Spree::CustomerReturn) %>
25
- <ul class="nav nav-sidebar" id="sidebarReturn">
26
- <%= main_menu_tree Spree.t(:returns), icon: "reply-fill.svg", sub_menu: "returns", url: "#sidebar-returns" %>
27
- </ul>
28
- <% end %>
29
-
30
- <% if can? :admin, Spree::Product %>
31
- <ul class="nav nav-sidebar" id="sidebarProduct">
32
- <%= main_menu_tree Spree.t(:products), icon: "tags-fill.svg", sub_menu: "product", url: "#sidebar-product" %>
33
- </ul>
34
- <% end %>
35
-
36
- <% if can?(:admin, Spree::StockLocation) || can?(:admin, Spree::StockTransfer) %>
37
- <ul class="nav nav-sidebar" id="sidebarStock">
38
- <%= main_menu_tree Spree.t(:stock), icon: "box-seam.svg", sub_menu: "stock", url: "#sidebar-stock" %>
39
- </ul>
40
- <% end %>
41
-
42
- <% if can? :admin, Spree::Admin::ReportsController %>
43
- <ul class="nav nav-sidebar" id="sidebarReport">
44
- <%= tab *Spree::Backend::Configuration::REPORT_TABS, icon: 'pie-chart-fill.svg' %>
45
- </ul>
46
- <% end %>
47
-
48
- <% if can? :admin, Spree::Promotion %>
49
- <ul class="nav nav-sidebar" id="sidebarPromotion">
50
- <%= main_menu_tree Spree.t(:promotions), icon: "percent.svg", sub_menu: "promotion", url: "#sidebar-promotions" %>
51
- </ul>
52
- <% end %>
53
-
54
- <% if defined?(Spree::Vendor) && can?(:manage, Spree::Vendor) && can?(:index, Spree::Vendor) %>
55
- <ul class="nav nav-sidebar" id="sidebarOrganizations">
56
- <%= main_menu_tree Spree.t(:organizations), icon: "building.svg", sub_menu: "organizations", url: "#sidebar-organizations" %>
57
- </ul>
58
- <% end %>
59
-
60
- <% if Spree.user_class && can?(:admin, Spree.user_class) %>
61
- <ul class="nav nav-sidebar" id="sidebarUser">
62
- <%= tab *Spree::Backend::Configuration::USER_TABS, url: spree.admin_users_path, icon: 'people-fill.svg' %>
63
- </ul>
64
- <% end %>
65
-
66
- <% if can? :admin, Spree::Menu %>
67
- <ul class="nav nav-sidebar" id="sidebarMenu">
68
- <%= main_menu_tree Spree.t('admin.tab.content'), icon: "card-heading.svg", sub_menu: "content", url: "#sidebar-content" %>
69
- </ul>
70
- <% end %>
71
-
72
- <% if can?(:admin, Spree::Webhooks::Subscriber) || can?(:admin, Spree::PaymentMethod) %>
73
- <ul class="nav nav-sidebar" id="sidebarIntegrations">
74
- <%= main_menu_tree Spree.t('admin.tab.integrations'), icon: "stack.svg", sub_menu: "integrations", url: "#sidebar-integrations" %>
75
- </ul>
76
- <% end %>
77
-
78
- <% if can? :admin, Spree::OauthApplication %>
79
- <ul class="nav nav-sidebar" id="sidebarApps">
80
- <%= main_menu_tree Spree.t('admin.tab.apps'), icon: "terminal-fill.svg", sub_menu: "apps", url: "#sidebar-apps" %>
81
- </ul>
82
- <% end %>
83
-
84
- <% if can? :admin, current_store %>
85
- <ul class="nav nav-sidebar" id="sidebarConfiguration">
86
- <%= main_menu_tree Spree.t('admin.settings'), icon: "gear-fill.svg", sub_menu: "configuration", url: "#sidebar-configuration" %>
87
- </ul>
88
- <% elsif defined?(current_spree_vendor) && current_spree_vendor.present? %>
89
- <ul class="nav nav-sidebar" id="sidebarConfiguration">
90
- <%= main_menu_tree Spree.t('admin.settings'), icon: "gear-fill.svg", sub_menu: "vendor_configuration", url: "#sidebar-configuration" %>
14
+ <% main_menu.items.each do |item| %>
15
+ <% next unless item.available?(current_ability, current_store) %>
16
+
17
+ <ul class="nav nav-sidebar" id="sidebar<%= item.key.upcase %>>">
18
+ <% if item.children? %>
19
+ <li class="sidebar-menu-item d-block w-100 text-muted">
20
+ <%= main_menu_item(Spree.t(item.label_translation_key), url: "#sidebar-#{item.key}", icon: item.icon_key) %>
21
+
22
+ <ul id="sidebar-<%= item.key %>" class="collapse nav nav-pills nav-stacked pb-2" data-hook="admin_orders">
23
+ <% item.items.each do |section_item| %>
24
+ <% next unless section_item.available?(current_ability, current_store) %>
25
+
26
+ <%= tab(Spree.t(section_item.label_translation_key), url: section_item.url.is_a?(Proc) ? section_item.url.call(current_store) : section_item.url, match_path: section_item.match_path, icon: section_item.icon_key) %>
27
+ <% end %>
28
+ </ul>
29
+ </li>
30
+ <% else %>
31
+ <%= tab(Spree.t(item.label_translation_key), url: item.url.is_a?(Proc) ? item.url.call(current_store) : item.url, match_path: item.match_path, icon: item.icon_key) %>
32
+ <% end %>
91
33
  </ul>
92
34
  <% end %>
93
35
  </nav>
@@ -4,88 +4,15 @@
4
4
  <% end %>
5
5
 
6
6
  <% content_for :page_tabs do %>
7
- <% if ((can? :update, @order) && (@order.shipments.size.zero? || @order.shipments.shipped.size.zero?)) %>
8
- <li class="nav-item" data-hook='admin_order_tabs_cart_details'>
9
- <%= link_to_with_icon 'cart-check.svg',
10
- Spree.t(:cart),
11
- cart_admin_order_url(@order),
12
- class: "#{'active' if current == :cart} nav-link" %>
13
- </li>
14
- <% end %>
15
-
16
- <% if can? :update, @order %>
17
- <li class="nav-item" data-hook='admin_order_tabs_channel_details'>
18
- <%= link_to_with_icon 'funnel.svg',
19
- Spree.t(:channel),
20
- channel_admin_order_url(@order),
21
- class: "#{'active' if current == :channel} nav-link" %>
22
- </li>
23
- <% end %>
24
-
25
- <% if can?(:update, @order) && @order.checkout_steps.include?("address") %>
26
- <li class="nav-item" data-hook='admin_order_tabs_customer_details'>
27
- <%= link_to_with_icon 'person-lines-fill.svg',
28
- Spree.t(:customer),
29
- spree.admin_order_customer_url(@order),
30
- class: "#{'active' if current == :customer_details} nav-link" %>
31
- </li>
32
- <% end %>
33
-
34
- <% if can? :update, @order %>
35
- <li class="nav-item" data-hook='admin_order_tabs_shipment_details'>
36
- <%= link_to_with_icon 'truck.svg',
37
- Spree.t(:shipments),
38
- edit_admin_order_url(@order),
39
- class: "#{'active' if current == :shipments} nav-link" %>
40
- </li>
41
- <% end %>
42
-
43
- <% if can? :index, Spree::Adjustment %>
44
- <li class="nav-item" data-hook='admin_order_tabs_adjustments'>
45
- <%= link_to_with_icon 'adjust.svg',
46
- Spree.t(:adjustments),
47
- spree.admin_order_adjustments_url(@order),
48
- class: "#{'active' if current == :adjustments} nav-link" %>
49
- </li>
50
- <% end %>
51
-
52
- <% if can?(:index, Spree::Payment) %>
53
- <li class="nav-item" data-hook='admin_order_tabs_payments'>
54
- <%= link_to_with_icon 'credit-card.svg',
55
- Spree.t(:payments),
56
- spree.admin_order_payments_url(@order),
57
- class: "#{'active' if current == :payments} nav-link" %>
58
- </li>
59
- <% end %>
60
-
61
- <% if can? :index, Spree::ReturnAuthorization %>
62
- <% if @order.completed? %>
63
- <li class="nav-item" data-hook='admin_order_tabs_return_authorizations'>
64
- <%= link_to_with_icon 'enter.svg',
65
- Spree.t(:return_authorizations),
66
- spree.admin_order_return_authorizations_url(@order),
67
- class: "#{'active' if current == :return_authorizations} nav-link" %>
68
- </li>
69
- <% end %>
70
- <% end %>
71
-
72
- <% if can? :index, Spree::CustomerReturn %>
73
- <% if @order.completed? %>
74
- <li class="nav-item">
75
- <%= link_to_with_icon 'returns.svg',
76
- Spree.t(:customer_returns),
77
- spree.admin_order_customer_returns_url(@order),
78
- class: "#{'active' if current == :customer_returns} nav-link" %>
79
- </li>
80
- <% end %>
81
- <% end %>
82
-
83
- <% if can? :update, @order %>
84
- <li class="nav-item" data-hook='admin_order_tabs_state_changes'>
85
- <%= link_to_with_icon 'calendar3.svg',
86
- Spree::StateChange.human_attribute_name(:state_changes),
87
- spree.admin_order_state_changes_url(@order),
88
- class: "#{'active' if current == :state_changes} nav-link" %>
89
- </li>
7
+ <% order_tabs.items.each do |tab| %>
8
+ <% next unless tab.available?(current_ability, @order) %>
9
+ <%= content_tag :li, class: 'nav-item', data: { hook: tab.data_hook } do %>
10
+ <%= link_to_with_icon(
11
+ tab.icon_key,
12
+ Spree.t(tab.label_translation_key),
13
+ tab.url(@order),
14
+ class: tab.active?(current) ? 'active nav-link' : 'nav-link'
15
+ ) %>
16
+ <% end %>
90
17
  <% end %>
91
18
  <% end %>
@@ -3,68 +3,16 @@
3
3
  <%= @product.name %>
4
4
  <% end %>
5
5
 
6
- <% content_for(:page_tabs) do %>
7
- <%= content_tag :li, class: 'nav-item' do %>
8
- <%= link_to_with_icon 'edit.svg',
9
- Spree.t(:details),
10
- edit_admin_product_url(@product),
11
- class: "nav-link #{'active' if current == :details}" %>
12
-
13
- <% end if can?(:admin, Spree::Product) %>
14
-
15
- <%= content_tag :li, class: 'nav-item' do %>
16
- <%= link_to_with_icon 'images.svg',
17
- Spree.t(:images),
18
- spree.admin_product_images_url(@product),
19
- class: "nav-link #{'active' if current == :images}" %>
20
-
21
- <% end if can?(:admin, Spree::Image) && !@product.deleted? %>
22
-
23
- <%= content_tag :li, class: 'nav-item' do %>
24
- <%= link_to_with_icon 'adjust.svg',
25
- Spree.t(:variants),
26
- spree.admin_product_variants_url(@product),
27
- class: "nav-link #{'active' if current == :variants}" %>
28
-
29
- <% end if can?(:admin, Spree::Variant) && !@product.deleted? %>
30
-
31
- <%= content_tag :li, class: 'nav-item' do %>
32
- <%= link_to_with_icon 'list.svg',
33
- Spree.t(:properties),
34
- spree.admin_product_product_properties_url(@product),
35
- class: "nav-link #{'active' if current == :properties}" %>
36
-
37
- <% end if can?(:admin, Spree::ProductProperty) && !@product.deleted? %>
38
-
39
- <%= content_tag :li, class: 'nav-item' do %>
40
- <%= link_to_with_icon 'box-seam.svg',
41
- Spree.t(:stock),
42
- stock_admin_product_url(@product),
43
- class: "nav-link #{'active' if current == :stock}" %>
44
-
45
- <% end if can?(:admin, Spree::StockItem) && !@product.deleted? %>
46
-
47
- <%= content_tag :li, class: 'nav-item' do %>
48
- <%= link_to_with_icon 'currency-exchange.svg',
49
- Spree.t(:prices),
50
- admin_product_prices_path(@product),
51
- class: "nav-link #{'active' if current == :prices}" %>
52
-
53
- <% end if can?(:admin, Spree::Price) && !@product.deleted? %>
54
-
55
- <%= content_tag :li, class: 'nav-item' do %>
56
- <%= link_to_with_icon 'download.svg',
57
- Spree.t('admin.digitals.digital_assets'),
58
- admin_product_digitals_path(@product),
59
- class: "nav-link #{'active' if current == :digitals} #{current}" %>
60
-
61
- <% end if can?(:admin, Spree::Digital) && !@product.deleted? %>
62
-
63
- <%= content_tag :li, class: 'nav-item' do %>
64
- <%= link_to_with_icon 'translate.svg',
65
- Spree.t(:translations),
66
- translations_admin_product_path(@product),
67
- class: "nav-link #{'active' if current == :translations}" %>
68
-
69
- <% end if can?(:admin, Spree::Product) && !@product.deleted? %>
6
+ <% content_for :page_tabs do %>
7
+ <% product_tabs.items.each do |tab| %>
8
+ <% next unless tab.available?(current_ability, @product) %>
9
+ <li class="nav-item">
10
+ <%= link_to_with_icon(
11
+ tab.icon_key,
12
+ Spree.t(tab.label_translation_key),
13
+ tab.url(@product),
14
+ class: tab.active?(current) ? 'active nav-link' : 'nav-link'
15
+ ) %>
16
+ </li>
17
+ <% end %>
70
18
  <% end %>
@@ -5,7 +5,15 @@
5
5
  <% end %>
6
6
 
7
7
  <% content_for :page_actions do %>
8
- <%= button_link_to Spree.t(:add_store_credit), spree.new_admin_user_store_credit_path(@user), class: "btn-success", icon: 'add.svg' if can?(:create, Spree::StoreCredit) %>
8
+ <% store_credits_actions.items.each do |action| %>
9
+ <% next unless action.available?(current_ability) %>
10
+ <%= button_link_to(
11
+ Spree.t(action.label_translation_key),
12
+ action.url(@user),
13
+ class: action.classes,
14
+ icon: action.icon_key
15
+ ) %>
16
+ <% end %>
9
17
  <% end %>
10
18
 
11
19
  <% if @store_credits.any? %>
@@ -4,34 +4,15 @@
4
4
  <% end %>
5
5
 
6
6
  <% content_for :page_tabs do %>
7
- <li class="nav-item">
8
- <%= link_to_with_icon 'person.svg',
9
- Spree.t(:"admin.user.account"),
10
- spree.edit_admin_user_path(@user),
11
- class: "nav-link #{'active' if current == :account}" %>
12
- </li>
13
- <li class="nav-item">
14
- <%= link_to_with_icon 'pin-map.svg',
15
- Spree.t(:"admin.user.addresses"),
16
- spree.addresses_admin_user_path(@user),
17
- class: "nav-link #{'active' if current == :address}" %>
18
- </li>
19
- <li class="nav-item">
20
- <%= link_to_with_icon 'inbox.svg',
21
- Spree.t(:"admin.user.orders"),
22
- spree.orders_admin_user_path(@user),
23
- class: "nav-link #{'active' if current == :orders}" %>
24
- </li>
25
- <li class="nav-item">
26
- <%= link_to_with_icon 'tag.svg',
27
- Spree.t(:"admin.user.items"),
28
- spree.items_admin_user_path(@user),
29
- class: "nav-link #{'active' if current == :items}" %>
30
- </li>
31
- <li class="nav-item">
32
- <%= link_to_with_icon 'gift.svg',
33
- Spree.t(:"admin.user.store_credits"),
34
- spree.admin_user_store_credits_path(@user),
35
- class: "nav-link #{'active' if current == :store_credits}" %>
36
- </li>
7
+ <% user_tabs.items.each do |tab| %>
8
+ <% next unless tab.available?(current_ability, @user) %>
9
+ <li class="nav-item">
10
+ <%= link_to_with_icon(
11
+ tab.icon_key,
12
+ Spree.t(tab.label_translation_key),
13
+ tab.url(@user),
14
+ class: tab.active?(current) ? 'active nav-link' : 'nav-link'
15
+ ) %>
16
+ </li>
17
+ <% end %>
37
18
  <% end %>
@@ -1,3 +1,11 @@
1
1
  <% content_for :page_actions do %>
2
- <%= button_link_to Spree.t(:create_new_order), spree.new_admin_order_path(user_id: @user.id), class: "btn-success", icon: 'add.svg' if can?(:create, Spree::Order) %>
2
+ <% user_actions.items.each do |action| %>
3
+ <% next unless action.available?(current_ability) %>
4
+ <%= button_link_to(
5
+ Spree.t(action.label_translation_key),
6
+ action.url(@user),
7
+ class: action.classes,
8
+ icon: action.icon_key
9
+ ) %>
10
+ <% end %>
3
11
  <% end %>
@@ -3,8 +3,17 @@
3
3
  <% end %>
4
4
 
5
5
  <% content_for :page_actions do %>
6
- <%= button_link_to Spree.t(:new_user), new_admin_user_url, class: "btn-success", icon: 'add.svg', id: 'admin_new_user_link' %>
7
- <% end if can? :create, Spree::user_class %>
6
+ <% users_actions.items.each do |action| %>
7
+ <% next unless action.available?(current_ability) %>
8
+ <%= button_link_to(
9
+ Spree.t(action.label_translation_key),
10
+ action.url,
11
+ class: action.classes,
12
+ icon: action.icon_key,
13
+ id: action.id
14
+ ) %>
15
+ <% end %>
16
+ <% end %>
8
17
 
9
18
  <% content_for :table_filter_title do %>
10
19
  <%= Spree.t(:search) %>
@@ -64,8 +64,18 @@
64
64
  <% end %>
65
65
  <% else %>
66
66
  <% content_for :page_actions do %>
67
- <%= external_page_preview_link(@product) %>
68
- <%= button_link_to(Spree.t(:new_variant), spree.new_admin_product_variant_url(@product), { icon: 'add.svg', :'data-update' => 'new_variant', class: 'btn-success', id: 'new_var_link' }) if can? :create, Spree::Variant %>
67
+ <% variants_actions.items.each do |action| %>
68
+ <% next unless action.available?(current_ability) %>
69
+ <%= button_link_to(
70
+ Spree.t(action.label_translation_key),
71
+ action.url(@product),
72
+ class: action.classes,
73
+ icon: action.icon_key,
74
+ id: action.id,
75
+ target: action.target,
76
+ data: action.data_attributes
77
+ ) %>
78
+ <% end %>
69
79
  <%= button_link_to (@deleted == '1' ? Spree.t(:show_active) : Spree.t(:show_deleted)), spree.admin_product_variants_url(@product, { q: { deleted_at_null: @deleted == '1' ? "0" : "1" } }), { class: 'btn-light', icon: 'filter.svg' } %>
70
80
  <% end %>
71
81
  <% end %>
@@ -15,7 +15,6 @@
15
15
  <% if defined?(Spree::Vendor) && can?(:manage, Spree::Vendor) && !current_spree_vendor %>
16
16
  <th><%= Spree.t(:vendor) %></th>
17
17
  <% end %>
18
- <th><%= Spree.t('admin.webhooks_subscribers.secret_key') %></th>
19
18
  <th><%= Spree.t('admin.active') %></th>
20
19
  <th><%= Spree.t('admin.webhooks_subscribers.subscriptions') %></th>
21
20
  <th><%= Spree.t('admin.webhooks_subscribers.time_of_last_event') %></th>
@@ -32,16 +31,6 @@
32
31
  <%= link_to webhooks_subscriber.vendor.name, spree.admin_vendor_path(webhooks_subscriber.vendor) if webhooks_subscriber.vendor.present? %>
33
32
  </td>
34
33
  <% end %>
35
- <td>
36
- <div class="input-group" data-controller="password-toggle">
37
- <%= password_field_tag :password, webhooks_subscriber.secret_key, class: 'form-control unhide text-muted border-0 shadow-none bg-transparent', data: { password_toggle_target: 'unhide' }, readonly: true %>
38
- <div class="input-group-append">
39
- <%= button_tag class: 'btn btn-link rounded', data: { action: 'click->password-toggle#password' } do %>
40
- <%= svg_icon name: "view.svg", width: '18', height: '18' %>
41
- <% end %>
42
- </div>
43
- </div>
44
- </td>
45
34
  <td><%= active_badge(webhooks_subscriber.active) %></td>
46
35
  <td><%= webhooks_subscriber.subscriptions&.sort&.join(', ') %></td>
47
36
  <td><%= webhooks_subscriber.events.order(:created_at).last&.created_at %></td>
@@ -133,10 +133,12 @@ en:
133
133
  taxons: Taxons
134
134
  users: Users
135
135
  return_authorizations: Return Authorizations
136
+ stock: Stock
136
137
  customer_returns: Customer Returns
137
138
  apps: Apps
138
139
  applications: Applications
139
140
  integrations: Integrations
141
+ webhook_subscribers: Webhook Subscribers
140
142
  taxon:
141
143
  nested_under_info: Nest this Taxon within the Taxonomy tree.
142
144
  taxonomies:
@@ -150,9 +152,9 @@ en:
150
152
  changing_store_warning: If you change the store this order belongs to, the order will be reset.
151
153
  once_an_order_is_complete_you_can_not_change_store: 'Sorry, once an order is complete, you can no longer change the store that the order belongs to.'
152
154
  events:
153
- approve: approve
154
- cancel: cancel
155
- resume: resume
155
+ approve: Approve
156
+ cancel: Cancel
157
+ resume: Resume
156
158
  resend: Resend
157
159
  orders:
158
160
  all: All
@@ -252,7 +254,7 @@ en:
252
254
  this_link_takes_you_to_your_stores_home_page: This link takes you to your stores home page.
253
255
  settings: Settings
254
256
  utilities:
255
- preview: Preview %{name}
257
+ preview: Preview
256
258
  webhooks_subscribers:
257
259
  webhooks_subscribers: Webhooks Subscribers
258
260
  new_webhooks_subscriber: New Webhooks Subscriber
@@ -15,23 +15,6 @@ module Spree
15
15
  preference :product_wysiwyg_editor_enabled, :boolean, default: true
16
16
  preference :taxon_wysiwyg_editor_enabled, :boolean, default: true
17
17
  preference :show_only_complete_orders_by_default, :boolean, default: true
18
-
19
- ORDER_TABS ||= [:orders, :payments, :creditcard_payments,
20
- :shipments, :credit_cards, :return_authorizations,
21
- :customer_returns, :adjustments, :customer_details]
22
- PRODUCT_TABS ||= [:products, :option_types, :properties, :prototypes,
23
- :variants, :product_properties, :taxonomies,
24
- :taxons]
25
- REPORT_TABS ||= [:reports]
26
- CONFIGURATION_TABS ||= [:configurations, :general_settings, :tax_categories,
27
- :tax_rates, :zones, :countries, :states,
28
- :payment_methods, :shipping_methods,
29
- :shipping_categories, :stock_transfers,
30
- :stock_locations, :trackers, :refund_reasons,
31
- :reimbursement_types, :return_authorization_reasons,
32
- :stores]
33
- PROMOTION_TABS ||= [:promotions, :promotion_categories]
34
- USER_TABS ||= [:users]
35
18
  end
36
19
  end
37
20
  end
@@ -3,10 +3,13 @@ require_relative 'configuration'
3
3
  module Spree
4
4
  module Backend
5
5
  class Engine < ::Rails::Engine
6
+ Environment = Struct.new(:main_menu, :tabs, :actions)
7
+
6
8
  config.middleware.use 'Spree::Backend::Middleware::SeoAssist'
7
9
 
8
- initializer 'spree.backend.environment', before: :load_config_initializers do |_app|
10
+ initializer 'spree.backend.environment', before: :load_config_initializers do |app|
9
11
  Spree::Backend::Config = Spree::Backend::Configuration.new
12
+ app.config.spree_backend = Environment.new
10
13
  end
11
14
 
12
15
  # filter sensitive information during logging
@@ -20,6 +23,30 @@ module Spree
20
23
  # warn "[DEPRECATION] Spree::Backend::Config[:#{pref[:name]}] is deprecated. #{pref[:message]}"
21
24
  end
22
25
  end
26
+
27
+ config.after_initialize do
28
+ Rails.application.reload_routes!
29
+ Rails.application.config.spree_backend.main_menu = Spree::Admin::MainMenu::DefaultConfigurationBuilder.new.build
30
+ Rails.application.config.spree_backend.tabs = {}
31
+ Rails.application.config.spree_backend.tabs[:order] = Spree::Admin::Tabs::OrderDefaultTabsBuilder.new.build
32
+ Rails.application.config.spree_backend.tabs[:user] = Spree::Admin::Tabs::UserDefaultTabsBuilder.new.build
33
+ Rails.application.config.spree_backend.tabs[:product] = Spree::Admin::Tabs::ProductDefaultTabsBuilder.new.build
34
+ Rails.application.config.spree_backend.actions = {}
35
+ Rails.application.config.spree_backend.actions[:orders] = Spree::Admin::Actions::OrdersDefaultActionsBuilder.new.build
36
+ Rails.application.config.spree_backend.actions[:order] = Spree::Admin::Actions::OrderDefaultActionsBuilder.new.build
37
+ Rails.application.config.spree_backend.actions[:users] = Spree::Admin::Actions::UsersDefaultActionsBuilder.new.build
38
+ Rails.application.config.spree_backend.actions[:user] = Spree::Admin::Actions::UserDefaultActionsBuilder.new.build
39
+ Rails.application.config.spree_backend.actions[:products] = Spree::Admin::Actions::ProductsDefaultActionsBuilder.new.build
40
+ Rails.application.config.spree_backend.actions[:product] = Spree::Admin::Actions::Root.new
41
+ Rails.application.config.spree_backend.actions[:stock] = Spree::Admin::Actions::Root.new
42
+ Rails.application.config.spree_backend.actions[:prices] = Spree::Admin::Actions::Root.new
43
+ Rails.application.config.spree_backend.actions[:images] = Spree::Admin::Actions::ImagesDefaultActionsBuilder.new.build
44
+ Rails.application.config.spree_backend.actions[:store_credits] = Spree::Admin::Actions::StoreCreditsDefaultActionsBuilder.new.build
45
+ Rails.application.config.spree_backend.actions[:adjustments] = Spree::Admin::Actions::AdjustmentsDefaultActionsBuilder.new.build
46
+ Rails.application.config.spree_backend.actions[:payments] = Spree::Admin::Actions::PaymentsDefaultActionsBuilder.new.build
47
+ Rails.application.config.spree_backend.actions[:variants] = Spree::Admin::Actions::VariantsDefaultActionsBuilder.new.build
48
+ Rails.application.config.spree_backend.actions[:product_properties] = Spree::Admin::Actions::ProductPropertiesDefaultActionsBuilder.new.build
49
+ end
23
50
  end
24
51
  end
25
52
  end
@@ -1,6 +1,6 @@
1
1
  module Spree
2
2
  module Backend
3
- VERSION = '4.6.2'.freeze
3
+ VERSION = '4.7.0'.freeze
4
4
 
5
5
  def self.version
6
6
  VERSION
@@ -19,13 +19,13 @@ Gem::Specification.new do |s|
19
19
  "source_code_uri" => "https://github.com/spree/spree_backend/tree/v#{s.version}",
20
20
  }
21
21
 
22
- s.required_ruby_version = '>= 2.5'
22
+ s.required_ruby_version = '>= 3.0'
23
23
 
24
24
  s.files = `git ls-files`.split("\n").reject { |f| f.match(/^spec/) && !f.match(/^spec\/fixtures/) }
25
25
  s.require_path = 'lib'
26
26
  s.requirements << 'none'
27
27
 
28
- s.add_dependency 'spree', ">= 4.6.0"
28
+ s.add_dependency 'spree', ">= 4.7.0"
29
29
 
30
30
  s.add_dependency 'babel-transpiler', '~> 0.7'
31
31
  s.add_dependency 'bootstrap', '~> 4.0'