solidus_backend 4.1.6 → 4.2.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 (36) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +0 -1
  3. data/app/assets/config/solidus_backend_manifest.js +2 -1
  4. data/app/assets/images/spree/backend/themes/solidus_admin/remixicon.symbol.svg +11 -0
  5. data/app/assets/javascripts/spree/backend/components/admin_nav.js +19 -1
  6. data/app/assets/javascripts/spree/backend/format_money.js +1 -1
  7. data/app/assets/javascripts/spree/backend/option_value_picker.js +0 -1
  8. data/app/assets/javascripts/spree/backend/views/promotions/option_values_rule.js +3 -3
  9. data/app/assets/stylesheets/spree/backend/components/_navigation.scss +11 -0
  10. data/app/assets/stylesheets/spree/backend/components/_navigation_solidus_admin.scss +274 -0
  11. data/app/assets/stylesheets/spree/backend/components/_switch_solidus_admin.scss +48 -0
  12. data/app/assets/stylesheets/spree/backend/shared/_layout.scss +1 -1
  13. data/app/assets/stylesheets/spree/backend/themes/solidus_admin/_colors.scss +44 -0
  14. data/app/assets/stylesheets/spree/backend/themes/solidus_admin/_tables.scss +8 -8
  15. data/app/assets/stylesheets/spree/backend/themes/solidus_admin/_variables.scss +28 -72
  16. data/app/controllers/spree/admin/payment_methods_controller.rb +1 -1
  17. data/app/controllers/spree/admin/products_controller.rb +2 -2
  18. data/app/controllers/spree/admin/resource_controller.rb +13 -9
  19. data/app/controllers/spree/admin/stock_items_controller.rb +22 -13
  20. data/app/helpers/spree/admin/navigation_helper.rb +46 -29
  21. data/app/views/spree/admin/shared/_js_locale_data.html.erb +1 -4
  22. data/app/views/spree/admin/shared/_navigation_solidus_admin.html.erb +101 -0
  23. data/app/views/spree/admin/shared/_product_sub_menu.html.erb +7 -5
  24. data/app/views/spree/admin/shared/_promotion_sub_menu.html.erb +4 -2
  25. data/app/views/spree/admin/shared/_settings_sub_menu.html.erb +8 -6
  26. data/app/views/spree/admin/shared/_tabs.html.erb +18 -6
  27. data/app/views/spree/admin/shared/_variant_search.html.erb +8 -1
  28. data/app/views/spree/admin/stock_items/_stock_management.html.erb +21 -9
  29. data/app/views/spree/admin/stock_items/index.html.erb +4 -1
  30. data/app/views/spree/layouts/admin.html.erb +6 -2
  31. data/lib/spree/backend_configuration/deprecated_tab_constants.rb +34 -0
  32. data/lib/spree/backend_configuration/menu_item.rb +68 -13
  33. data/lib/spree/backend_configuration.rb +131 -58
  34. data/vendor/assets/javascripts/solidus_admin/select2_locales/select2_locale_es-CL.js +10 -0
  35. data/vendor/assets/javascripts/solidus_admin/select2_locales/select2_locale_hy.js +37 -0
  36. metadata +15 -7
@@ -193,7 +193,7 @@ class Spree::Admin::ResourceController < Spree::Admin::BaseController
193
193
  .find_by!(self.class.parent_data[:find_by] => params["#{parent_model_name}_id"])
194
194
  instance_variable_set("@#{parent_model_name}", @parent)
195
195
  rescue ActiveRecord::RecordNotFound => e
196
- resource_not_found(flash_class: e.model.constantize, redirect_url: spree.polymorphic_url([:admin, parent_model_name.pluralize.to_sym]))
196
+ resource_not_found(flash_class: e.model.constantize, redirect_url: routes_proxy.polymorphic_url([:admin, parent_model_name.pluralize.to_sym]))
197
197
  end
198
198
 
199
199
  def parent?
@@ -238,17 +238,17 @@ class Spree::Admin::ResourceController < Spree::Admin::BaseController
238
238
 
239
239
  def new_object_url(options = {})
240
240
  if parent?
241
- spree.new_polymorphic_url([:admin, parent, model_class], options)
241
+ routes_proxy.new_polymorphic_url([:admin, parent, model_class], options)
242
242
  else
243
- spree.new_polymorphic_url([:admin, model_class], options)
243
+ routes_proxy.new_polymorphic_url([:admin, model_class], options)
244
244
  end
245
245
  end
246
246
 
247
247
  def edit_object_url(object, options = {})
248
248
  if parent?
249
- spree.polymorphic_url([:edit, :admin, parent, object], options)
249
+ routes_proxy.polymorphic_url([:edit, :admin, parent, object], options)
250
250
  else
251
- spree.polymorphic_url([:edit, :admin, object], options)
251
+ routes_proxy.polymorphic_url([:edit, :admin, object], options)
252
252
  end
253
253
  end
254
254
 
@@ -256,20 +256,24 @@ class Spree::Admin::ResourceController < Spree::Admin::BaseController
256
256
  target = object ? object : @object
257
257
 
258
258
  if parent?
259
- spree.polymorphic_url([:admin, parent, target], options)
259
+ routes_proxy.polymorphic_url([:admin, parent, target], options)
260
260
  else
261
- spree.polymorphic_url([:admin, target], options)
261
+ routes_proxy.polymorphic_url([:admin, target], options)
262
262
  end
263
263
  end
264
264
 
265
265
  def collection_url(options = {})
266
266
  if parent?
267
- spree.polymorphic_url([:admin, parent, model_class], options)
267
+ routes_proxy.polymorphic_url([:admin, parent, model_class], options)
268
268
  else
269
- spree.polymorphic_url([:admin, model_class], options)
269
+ routes_proxy.polymorphic_url([:admin, model_class], options)
270
270
  end
271
271
  end
272
272
 
273
+ def routes_proxy
274
+ spree
275
+ end
276
+
273
277
  # Allow all attributes to be updatable.
274
278
  #
275
279
  # Other controllers can, should, override it to set custom logic
@@ -40,24 +40,33 @@ module Spree
40
40
  end
41
41
 
42
42
  def load_stock_management_data
43
- @stock_locations = Spree::StockLocation.accessible_by(current_ability)
44
- @stock_item_stock_locations = params[:stock_location_id].present? ? @stock_locations.where(id: params[:stock_location_id]) : @stock_locations
43
+ @stock_locations = Spree::StockLocation.accessible_by(current_ability, :read)
44
+ @stock_item_stock_locations = Spree::DeprecatedInstanceVariableProxy.new(
45
+ view_context,
46
+ :@stock_locations,
47
+ :stock_item_stock_locations,
48
+ Spree.deprecator,
49
+ "Please, do not use @stock_item_stock_locations anymore in the views, use @stock_locations",
50
+ )
45
51
  @variant_display_attributes = self.class.variant_display_attributes
46
- @variants = Spree::Config.variant_search_class.new(params[:variant_search_term], scope: variant_scope).results
47
- @variants = @variants.includes(:images, stock_items: :stock_location, product: :variant_images)
48
- @variants = @variants.includes(option_values: :option_type)
49
- @variants = @variants.order(id: :desc).page(params[:page]).per(params[:per_page] || Spree::Config[:orders_per_page])
52
+ @variants = Spree::Config.variant_search_class.new(params[:variant_search_term], scope: variant_scope).results.
53
+ order(id: :desc).page(params[:page]).per(params[:per_page] || Spree::Config[:orders_per_page])
50
54
  end
51
55
 
52
56
  def variant_scope
53
- scope = Spree::Variant.accessible_by(current_ability)
54
- if @product
55
- scope = scope.where(
56
- product: @product,
57
- is_master: !@product.has_variants?
57
+ scope = Spree::Variant
58
+ .accessible_by(current_ability)
59
+ .distinct.order(:sku)
60
+ .includes(
61
+ :images,
62
+ stock_items: :stock_location,
63
+ product: :variant_images,
64
+ option_values: :option_type
58
65
  )
59
- end
60
- scope = scope.order(:sku)
66
+
67
+ scope = scope.where(product: @product, is_master: !@product.has_variants?) if @product
68
+ scope = scope.by_stock_location(params[:stock_location_id]) if params[:stock_location_id].present?
69
+
61
70
  scope
62
71
  end
63
72
 
@@ -42,45 +42,49 @@ module Spree
42
42
  # Make an admin tab that covers one or more resources supplied by symbols
43
43
  # Option hash may follow. Valid options are
44
44
  # * :label to override link text, otherwise based on the first resource name (translated)
45
- # * :route to override automatically determining the default route
46
45
  # * :match_path as an alternative way to control when the tab is active, /products would match /admin/products, /admin/products/5/variants etc.
47
46
  # * :match_path can also be a callable that takes a request and determines whether the menu item is selected for the request.
48
- def tab(*args, &_block)
49
- options = { label: args.first.to_s }
47
+ # * :selected to explicitly control whether the tab is active
48
+ def tab(*args, &block)
49
+ options = args.last.is_a?(Hash) ? args.pop.dup : {}
50
+ css_classes = Array(options[:css_class])
51
+
52
+ if options.key?(:route)
53
+ Spree.deprecator.warn "Passing a route to #tab is deprecated. Please pass a url instead."
54
+ options[:url] ||= spree.send("#{options[:route]}_path")
55
+ end
50
56
 
51
- if args.last.is_a?(Hash)
52
- options = options.merge(args.pop)
57
+ if args.any?
58
+ Spree.deprecator.warn "Passing resources to #tab is deprecated. Please use the `label:` and `match_path:` options instead."
59
+ options[:label] ||= args.first
60
+ options[:url] ||= spree.send("admin_#{args.first}_path")
61
+ options[:selected] = args.include?(controller.controller_name.to_sym)
53
62
  end
54
- options[:route] ||= "admin_#{args.first}"
55
63
 
56
- destination_url = options[:url] || spree.send("#{options[:route]}_path")
64
+ options[:url] ||= spree.send("admin_#{options[:label]}_path")
57
65
  label = t(options[:label], scope: [:spree, :admin, :tab])
58
66
 
59
- css_classes = []
67
+ options[:selected] ||=
68
+ if options[:match_path].is_a? Regexp
69
+ request.fullpath =~ options[:match_path]
70
+ elsif options[:match_path].respond_to?(:call)
71
+ options[:match_path].call(request)
72
+ elsif options[:match_path]
73
+ request.fullpath.starts_with?("#{spree.admin_path}#{options[:match_path]}")
74
+ else
75
+ request.fullpath.starts_with?(options[:url])
76
+ end
77
+
78
+ css_classes << 'selected' if options[:selected]
60
79
 
61
80
  if options[:icon]
62
- link = link_to_with_icon(options[:icon], label, destination_url)
81
+ link = link_to_with_icon(options[:icon], label, options[:url])
63
82
  css_classes << 'tab-with-icon'
64
83
  else
65
- link = link_to(label, destination_url)
66
- end
67
-
68
- selected = if options[:match_path].is_a? Regexp
69
- request.fullpath =~ options[:match_path]
70
- elsif options[:match_path].respond_to?(:call)
71
- options[:match_path].call(request)
72
- elsif options[:match_path]
73
- request.fullpath.starts_with?("#{spree.admin_path}#{options[:match_path]}")
74
- else
75
- request.fullpath.starts_with?(destination_url) ||
76
- args.include?(controller.controller_name.to_sym)
84
+ link = link_to(label, options[:url])
77
85
  end
78
- css_classes << 'selected' if selected
79
-
80
- if options[:css_class]
81
- css_classes << options[:css_class]
82
- end
83
- content_tag('li', link + (yield if block_given?), class: css_classes.join(' ') )
86
+ block_content = capture(&block) if block_given?
87
+ content_tag('li', link + block_content.to_s, class: css_classes.join(' ') )
84
88
  end
85
89
 
86
90
  def link_to_clone(resource, options = {})
@@ -115,12 +119,25 @@ module Spree
115
119
  end
116
120
 
117
121
  def link_to_with_icon(icon_name, text, url, options = {})
118
- options[:class] = (options[:class].to_s + " fa fa-#{icon_name} icon_link with-tip").strip
122
+ options[:class] = "#{options[:class]} icon_link with-tip".strip
123
+
124
+ if icon_name.starts_with?('ri-')
125
+ svg_map = image_path('spree/backend/themes/solidus_admin/remixicon.symbol.svg')
126
+ icon_tag = tag.svg(
127
+ tag.use('xlink:href': "#{svg_map}##{icon_name}"),
128
+ 'aria-hidden': true,
129
+ style: "fill: currentColor;",
130
+ )
131
+ else
132
+ options[:class] << " fa fa-#{icon_name}"
133
+ icon_tag = ''.html_safe
134
+ end
135
+
119
136
  options[:class] += ' no-text' if options[:no_text]
120
137
  options[:title] = text if options[:no_text]
121
138
  text = options[:no_text] ? '' : content_tag(:span, text, class: 'text')
122
139
  options.delete(:no_text)
123
- link_to(text, url, options)
140
+ link_to(icon_tag + text, url, options)
124
141
  end
125
142
 
126
143
  def solidus_icon(icon_name)
@@ -17,14 +17,11 @@
17
17
  JSON.dump(
18
18
  Spree::Config.available_currencies.map { |c|
19
19
  format =
20
- if c.format.present?
21
- c.format.gsub("%u", "%s").gsub("%n", "%v")
22
- elsif c.symbol == "" || c.symbol_first
20
+ if c.symbol == "" || c.symbol_first
23
21
  "%s%v"
24
22
  else
25
23
  "%v %s"
26
24
  end
27
-
28
25
  [c.id.to_s.upcase, [
29
26
  c.symbol || "¤",
30
27
  c.exponent,
@@ -0,0 +1,101 @@
1
+ <% default_store = Spree::Store.default %>
2
+
3
+ <div class="solidus-admin--nav--wrapper">
4
+ <aside class="solidus-admin--nav">
5
+ <header class="solidus-admin--nav--section">
6
+ <%= link_to spree.admin_path, class: 'solidus-admin--nav--logo' do %>
7
+ <%= image_tag(Spree::Config[:admin_interface_logo]) %>
8
+ <%- end %>
9
+
10
+ <%= link_to "//#{default_store.url}", target: '_blank', class: 'solidus-admin--nav--store-link' do %>
11
+ <div style="flex-grow: 1">
12
+ <span class="solidus-admin--nav--store-link--name"><%= default_store.name %></span>
13
+ <span class="solidus-admin--nav--store-link--url"><%= default_store.url %></span>
14
+ </div>
15
+ <svg aria-hidden="true"><use xlink:href="<%= image_path('spree/backend/themes/solidus_admin/remixicon.symbol.svg') %>#ri-arrow-right-up-line"></use></svg>
16
+ <% end %>
17
+ </header>
18
+
19
+ <nav class="solidus-admin--nav--section">
20
+ <ul class="solidus-admin--nav--menu">
21
+ <%= render 'spree/admin/shared/tabs' %>
22
+ </ul>
23
+ </nav>
24
+
25
+ <footer class="solidus-admin--nav--section">
26
+ <% if defined? SolidusAdmin %>
27
+ <ul class="solidus-admin--nav--menu">
28
+ <li class="tab-with-icon">
29
+ <label class="icon_link with-tip">
30
+ <span
31
+ id="solidus-admin-switch-label"
32
+ class="text"
33
+ data-legacy-label="<%= 'spree.navigation.switch_to_legacy'.then { t(_1, default: t(_1, locale: :en)) } %>"
34
+ data-admin-label="<%= 'spree.navigation.switch_to_solidus_admin'.then { t(_1, default: t(_1, locale: :en)) } %>"
35
+ ></span>
36
+ <span><input type="checkbox" id="solidus-admin-switch" class="solidus-admin--nav--switch"/></span>
37
+ </label>
38
+ </li>
39
+ </ul>
40
+ <% end %>
41
+
42
+ <% if spree_current_user %>
43
+ <details class="solidus-admin--nav--footer" aria-label="Account">
44
+ <summary>
45
+ <svg aria-hidden="true"><use xlink:href="<%= image_path('spree/backend/themes/solidus_admin/remixicon.symbol.svg') %>#ri-user-smile-fill"></use></svg>
46
+ <div>
47
+ <%= spree_current_user&.email || "Test user" %>
48
+ </div>
49
+ </summary>
50
+
51
+ <ul>
52
+ <% if (available_locales = Spree.i18n_available_locales).any? %>
53
+ <li>
54
+ <label>
55
+ <svg aria-hidden="true"><use xlink:href="<%= image_path('spree/backend/themes/solidus_admin/remixicon.symbol.svg') %>#ri-global-line"></use></svg>
56
+ <select class="js-locale-selection">
57
+ <%= options_for_select(
58
+ available_locales
59
+ .map do |locale|
60
+ [
61
+ t(
62
+ "spree.i18n.this_file_language",
63
+ locale: locale,
64
+ default: locale.to_s,
65
+ fallback: false
66
+ ),
67
+ locale
68
+ ]
69
+ end
70
+ .sort,
71
+ selected: I18n.locale
72
+ ) %>
73
+ </select>
74
+ <svg aria-hidden="true"><use xlink:href="<%= image_path('spree/backend/themes/solidus_admin/remixicon.symbol.svg') %>#ri-expand-up-down-line"></use></svg>
75
+ </label>
76
+ </li>
77
+ <% end %>
78
+
79
+ <% if can?(:admin, spree_current_user) %>
80
+ <li data-hook="user-account-link">
81
+ <%= link_to(spree.edit_admin_user_path(spree_current_user)) do %>
82
+ <svg aria-hidden="true"><use xlink:href="<%= image_path('spree/backend/themes/solidus_admin/remixicon.symbol.svg') %>#ri-user-3-line"></use></svg>
83
+ <span><%= t('spree.my_account') %></span>
84
+ <% end %>
85
+ </li>
86
+ <% end %>
87
+
88
+ <% if spree.respond_to? :admin_logout_path %>
89
+ <li data-hook="user-logout-link">
90
+ <%= link_to spree.admin_logout_path, method: Devise.sign_out_via, rel: "nofollow" do %>
91
+ <svg aria-hidden="true"><use xlink:href="<%= image_path('spree/backend/themes/solidus_admin/remixicon.symbol.svg') %>#ri-logout-box-line"></use></svg>
92
+ <span><%= t("spree.logout") %></span>
93
+ <% end %>
94
+ </li>
95
+ <% end %>
96
+ </ul>
97
+ </details>
98
+ <% end %>
99
+ </footer>
100
+ </aside>
101
+ </div>
@@ -1,17 +1,19 @@
1
+ <% Spree.deprecator.warn "Using the #{@virtual_path.inspect} partial is deprecated, please use MenuItem#children instead." %>
2
+
1
3
  <ul class="admin-subnav" data-hook="admin_product_sub_tabs">
2
4
  <% if can? :admin, Spree::Product %>
3
- <%= tab :products, match_path: '/products' %>
5
+ <%= tab label: :products, match_path: '/products' %>
4
6
  <% end %>
5
7
  <% if can? :admin, Spree::OptionType %>
6
- <%= tab :option_types, match_path: '/option_types' %>
8
+ <%= tab label: :option_types, match_path: '/option_types' %>
7
9
  <% end %>
8
10
  <% if can? :admin, Spree::Property %>
9
- <%= tab :properties %>
11
+ <%= tab label: :properties %>
10
12
  <% end %>
11
13
  <% if can? :admin, Spree::Taxonomy %>
12
- <%= tab :taxonomies %>
14
+ <%= tab label: :taxonomies %>
13
15
  <% end %>
14
16
  <% if can? :admin, Spree::Taxon %>
15
- <%= tab :taxons, label: :display_order, match_path: '/taxons' %>
17
+ <%= tab url: spree.admin_taxons_path, label: :display_order, match_path: '/taxons' %>
16
18
  <% end %>
17
19
  </ul>
@@ -1,8 +1,10 @@
1
+ <% Spree.deprecator.warn "Using the #{@virtual_path.inspect} partial is deprecated, please use MenuItem#children instead." %>
2
+
1
3
  <ul class="admin-subnav" data-hook="admin_promotion_sub_tabs">
2
4
  <% if can? :admin, Spree::Promotion %>
3
- <%= tab :promotions %>
5
+ <%= tab label: :promotions %>
4
6
  <% end %>
5
7
  <% if can? :admin, Spree::PromotionCategory %>
6
- <%= tab :promotion_categories %>
8
+ <%= tab label: :promotion_categories %>
7
9
  <% end %>
8
10
  </ul>
@@ -1,26 +1,28 @@
1
+ <% Spree.deprecator.warn "Using the #{@virtual_path.inspect} partial is deprecated, please use MenuItem#children instead." %>
2
+
1
3
  <ul class="admin-subnav" data-hook="admin_settings_sub_tabs">
2
4
  <% if can?(:admin, Spree::Store) %>
3
- <%= tab :stores, label: :stores, url: spree.admin_stores_path %>
5
+ <%= tab label: :stores, url: spree.admin_stores_path %>
4
6
  <% end %>
5
7
 
6
8
  <% if can?(:admin, Spree::PaymentMethod) %>
7
- <%= tab :payments, url: spree.admin_payment_methods_path %>
9
+ <%= tab label: :payments, url: spree.admin_payment_methods_path %>
8
10
  <% end %>
9
11
 
10
12
  <% if can?(:admin, Spree::TaxCategory) || can?(:admin, Spree::TaxRate) %>
11
- <%= tab :taxes, url: spree.admin_tax_categories_path, match_path: %r(tax_categories|tax_rates) %>
13
+ <%= tab label: :taxes, url: spree.admin_tax_categories_path, match_path: %r(tax_categories|tax_rates) %>
12
14
  <% end %>
13
15
 
14
16
  <% if can?(:admin, Spree::RefundReason) || can?(:admin, Spree::ReimbursementType) ||
15
17
  can?(:show, Spree::ReturnReason) || can?(:show, Spree::AdjustmentReason) %>
16
- <%= tab :checkout, url: spree.admin_refund_reasons_path, match_path: %r(refund_reasons|reimbursement_types|return_reasons|adjustment_reasons|store_credit_reasons) %>
18
+ <%= tab label: :checkout, url: spree.admin_refund_reasons_path, match_path: %r(refund_reasons|reimbursement_types|return_reasons|adjustment_reasons|store_credit_reasons) %>
17
19
  <% end %>
18
20
 
19
21
  <% if can?(:admin, Spree::ShippingMethod) || can?(:admin, Spree::ShippingCategory) || can?(:admin, Spree::StockLocation) %>
20
- <%= tab :shipping, url: spree.admin_shipping_methods_path, match_path: %r(shipping_methods|shipping_categories|stock_locations) %>
22
+ <%= tab label: :shipping, url: spree.admin_shipping_methods_path, match_path: %r(shipping_methods|shipping_categories|stock_locations) %>
21
23
  <% end %>
22
24
 
23
25
  <% if can?(:admin, Spree::Zone) %>
24
- <%= tab :zones, url: spree.admin_zones_path %>
26
+ <%= tab label: :zones, url: spree.admin_zones_path %>
25
27
  <% end %>
26
28
  </ul>
@@ -1,15 +1,27 @@
1
- <% Spree::Backend::Config.menu_items.sort_by { |item| item.position || Float::INFINITY }.each do |menu_item| %>
2
- <% if instance_exec(&menu_item.condition) %>
1
+ <% Spree::Backend::Config.menu_items.each do |menu_item| %>
2
+ <% if menu_item.render_in?(self) %>
3
3
  <%=
4
4
  tab(
5
- *menu_item.sections,
6
5
  icon: menu_item.icon,
7
6
  label: menu_item.label,
8
- url: menu_item.url.is_a?(Symbol) ? spree.public_send(menu_item.url) : menu_item.url,
9
- match_path: menu_item.match_path,
7
+ url: menu_item.url,
8
+ selected: menu_item.match_path?(request) || menu_item.children.any? { _1.match_path?(request) },
10
9
  ) do
11
10
  %>
12
- <%- render partial: menu_item.partial if menu_item.partial %>
11
+ <% if menu_item.render_partial? %>
12
+ <%- render partial: menu_item.partial %>
13
+ <% elsif menu_item.children.present? %>
14
+ <ul class="admin-subnav" data-hook="<%= menu_item.data_hook %>">
15
+ <%- menu_item.children.each do |child| %>
16
+ <%= tab(
17
+ icon: child.icon,
18
+ label: child.label,
19
+ url: child.url,
20
+ selected: child.match_path?(request),
21
+ ) if child.render_in?(self) %>
22
+ <% end %>
23
+ </ul>
24
+ <% end %>
13
25
  <%- end %>
14
26
  <% end %>
15
27
  <% end %>
@@ -4,7 +4,14 @@
4
4
  <div class="field-block col-3">
5
5
  <div class="field">
6
6
  <%= label_tag nil, Spree::StockLocation.model_name.human %>
7
- <%= select_tag :stock_location_id, options_from_collection_for_select(stock_locations, :id, :name, params[:stock_location_id]), { include_blank: t('spree.all'), class: 'custom-select fullwidth', "data-placeholder" => t('spree.select_a_stock_location') } %>
7
+ <%= select_tag(
8
+ :stock_location_id,
9
+ options_from_collection_for_select(stock_locations, :id, :name, params[:stock_location_id]),
10
+ include_blank: t('spree.all'),
11
+ class: 'select2 fullwidth',
12
+ "data-placeholder" => t('spree.select_a_stock_location'),
13
+ multiple: true,
14
+ ) %>
8
15
  </div>
9
16
  </div>
10
17
  <div class="<%= if content_for?(:sidebar) then 'col-6' else 'col-9' end %>">
@@ -1,6 +1,6 @@
1
1
  <% admin_layout "full-width" %>
2
2
 
3
- <%= paginate @variants, theme: "solidus_admin" %>
3
+ <%= paginate variants, theme: "solidus_admin" %>
4
4
 
5
5
  <table class="index stock-table" id="listing_product_stock">
6
6
  <colgroup>
@@ -71,18 +71,30 @@
71
71
  <col style="width: 15%">
72
72
  </colgroup>
73
73
  <% variant.stock_items.each do |item| %>
74
- <% if @stock_item_stock_locations.include?(item.stock_location) %>
75
- <tr class="js-edit-stock-item stock-item-edit-row" data-variant-id="<%= variant.id %>" data-stock-item="<%= item.to_json %>" data-stock-location-name="<%= item.stock_location.name %>" data-track-inventory="<%= variant.should_track_inventory? %>" data-can-edit="<%= can?(:edit, Spree::StockItem) %>" data-variant-sku="<%= variant.sku %>">
76
- <%# This is rendered in JS %>
77
- </tr>
78
- <% end %>
74
+ <tr
75
+ class="js-edit-stock-item stock-item-edit-row"
76
+ data-variant-id="<%= variant.id %>"
77
+ data-stock-item="<%= item.to_json %>"
78
+ data-stock-location-name="<%= item.stock_location.name %>"
79
+ data-track-inventory="<%= variant.should_track_inventory? %>"
80
+ data-can-edit="<%= can?(:admin, Spree::StockItem) %>"
81
+ data-variant-sku="<%= variant.sku %>"
82
+ >
83
+ <%# This is rendered in JS %>
84
+ </tr>
79
85
  <% end %>
80
- <% locations_without_items = @stock_item_stock_locations - variant.stock_items.flat_map(&:stock_location) %>
86
+ <% locations_without_items = stock_locations - variant.stock_items.flat_map(&:stock_location) %>
81
87
  <% if locations_without_items.any? && can?(:create, Spree::StockItem) %>
82
88
  <tr class="js-add-stock-item stock-item-edit-row" data-variant-id="<%= variant.id %>">
83
89
  <form>
84
90
  <td class='location-name-cell'>
85
- <%= select_tag :stock_location_id, options_from_collection_for_select(locations_without_items, :id, :name), class: 'custom-select', prompt: t('spree.add_to_stock_location'), id: "variant-stock-location-#{variant.id}" %>
91
+ <%= select_tag(
92
+ :stock_location_id,
93
+ options_from_collection_for_select(locations_without_items, :id, :name),
94
+ class: 'custom-select',
95
+ prompt: t('spree.add_to_stock_location'),
96
+ id: "variant-stock-location-#{variant.id}",
97
+ ) %>
86
98
  </td>
87
99
  <td class="align-center">
88
100
  <%= check_box_tag :backorderable, 'backorderable', false, id: "variant-backorderable-#{variant.id}" %>
@@ -104,4 +116,4 @@
104
116
  <% end %>
105
117
  </table>
106
118
 
107
- <%= paginate @variants, theme: "solidus_admin" %>
119
+ <%= paginate variants, theme: "solidus_admin" %>
@@ -19,7 +19,10 @@
19
19
  <% end %>
20
20
 
21
21
  <% if @variants.any? %>
22
- <%= render partial: 'stock_management', locals: { variants: @variants } %>
22
+ <%= render partial: 'stock_management', locals: {
23
+ variants: @variants,
24
+ stock_locations: @stock_locations,
25
+ } %>
23
26
  <% else %>
24
27
  <div class="fullwidth no-objects-found">
25
28
  <%= t('spree.no_variants_found_try_again') %>
@@ -3,8 +3,12 @@
3
3
  <head data-hook="admin_inside_head">
4
4
  <%= render 'spree/admin/shared/head' %>
5
5
  </head>
6
- <body class="admin <%= "admin-nav-hidden" if cookies[:admin_nav_hidden] == "true" %>">
7
- <%= render "spree/admin/shared/navigation" %>
6
+ <body class="admin <%= "admin-nav-hidden" if !Spree::Backend::Config.admin_updated_navbar && cookies[:admin_nav_hidden] == "true" %>">
7
+ <% if Spree::Backend::Config.admin_updated_navbar %>
8
+ <%= render partial: 'spree/admin/shared/navigation_solidus_admin' %>
9
+ <% else %>
10
+ <%= render "spree/admin/shared/navigation" %>
11
+ <% end %>
8
12
  <%= render "spree/admin/shared/header" %>
9
13
  <%= render "spree/admin/shared/flash" %>
10
14
  <%= render "spree/admin/shared/spinner" %>
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ Spree.deprecator.warn(
4
+ "Spree::BackendConfiguration::*_TABS is deprecated. Please use Spree::BackendConfiguration::MenuItem(match_path:) instead."
5
+ )
6
+
7
+ Spree::BackendConfiguration::ORDER_TABS ||= [
8
+ :orders, :payments, :creditcard_payments,
9
+ :shipments, :credit_cards, :return_authorizations,
10
+ :customer_returns, :adjustments, :customer_details
11
+ ]
12
+ Spree::BackendConfiguration::PRODUCT_TABS ||= [
13
+ :products, :option_types, :properties,
14
+ :variants, :product_properties, :taxonomies,
15
+ :taxons
16
+ ]
17
+ Spree::BackendConfiguration::PROMOTION_TABS ||= [
18
+ :promotions, :promotion_categories
19
+ ]
20
+ Spree::BackendConfiguration::STOCK_TABS ||= [
21
+ :stock_items
22
+ ]
23
+ Spree::BackendConfiguration::USER_TABS ||= [
24
+ :users, :store_credits
25
+ ]
26
+ Spree::BackendConfiguration::CONFIGURATION_TABS ||= [
27
+ :stores, :tax_categories,
28
+ :tax_rates, :zones,
29
+ :payment_methods, :shipping_methods,
30
+ :shipping_categories, :stock_locations,
31
+ :refund_reasons, :reimbursement_types,
32
+ :return_reasons, :adjustment_reasons,
33
+ :store_credit_reasons
34
+ ]