spree_admin 5.4.0.beta → 5.4.0.beta2

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 (67) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/spree/admin/api_keys_controller.rb +21 -0
  3. data/app/controllers/spree/admin/exports_controller.rb +2 -1
  4. data/app/controllers/spree/admin/products_controller.rb +0 -12
  5. data/app/helpers/spree/admin/api_keys_helper.rb +6 -2
  6. data/app/helpers/spree/admin/navigation_helper.rb +2 -4
  7. data/app/helpers/spree/admin/products_helper.rb +0 -3
  8. data/app/helpers/spree/admin/tags_helper.rb +0 -11
  9. data/app/javascript/spree/admin/controllers/search_clear_controller.js +1 -1
  10. data/app/models/action_text/video_embed.rb +13 -0
  11. data/app/presenters/spree/admin/order_summary_presenter.rb +12 -0
  12. data/app/views/action_text/video_embeds/_thumbnail.html.erb +1 -0
  13. data/app/views/action_text/video_embeds/_video_embed.html.erb +3 -0
  14. data/app/views/layouts/action_text/contents/_content.html.erb +3 -0
  15. data/app/views/spree/admin/api_keys/_token_card.html.erb +36 -9
  16. data/app/views/spree/admin/api_keys/_usage_info.html.erb +3 -2
  17. data/app/views/spree/admin/exports/create.turbo_stream.erb +1 -1
  18. data/app/views/spree/admin/exports/new.html.erb +3 -3
  19. data/app/views/spree/admin/payment_methods/descriptions/_gateway.html.erb +1 -1
  20. data/app/views/spree/admin/payment_methods/index.html.erb +12 -11
  21. data/app/views/spree/admin/products/_form.html.erb +0 -2
  22. data/app/views/spree/admin/shared/sidebar/_store_nav.html.erb +3 -125
  23. data/config/initializers/oembed.rb +1 -0
  24. data/config/initializers/spree_admin_navigation.rb +0 -15
  25. data/config/initializers/spree_admin_tables.rb +0 -99
  26. data/config/locales/en.yml +4 -1
  27. data/config/routes.rb +0 -12
  28. data/db/migrate/20250217171018_create_action_text_video_embeds.rb +11 -0
  29. data/lib/spree/admin/engine.rb +8 -0
  30. data/lib/spree/admin.rb +1 -0
  31. metadata +26 -42
  32. data/app/controllers/spree/admin/post_categories_controller.rb +0 -21
  33. data/app/controllers/spree/admin/posts_controller.rb +0 -37
  34. data/app/controllers/spree/admin/properties_controller.rb +0 -26
  35. data/app/helpers/spree/admin/posts_helper.rb +0 -9
  36. data/app/views/spree/admin/post_categories/_form.html.erb +0 -6
  37. data/app/views/spree/admin/post_categories/_table_header.html.erb +0 -5
  38. data/app/views/spree/admin/post_categories/_table_row.html.erb +0 -9
  39. data/app/views/spree/admin/post_categories/edit.html.erb +0 -1
  40. data/app/views/spree/admin/post_categories/index.html.erb +0 -10
  41. data/app/views/spree/admin/post_categories/new.html.erb +0 -1
  42. data/app/views/spree/admin/posts/_extra_actions.html.erb +0 -0
  43. data/app/views/spree/admin/posts/_form.html.erb +0 -54
  44. data/app/views/spree/admin/posts/_table_header.html.erb +0 -7
  45. data/app/views/spree/admin/posts/_table_row.html.erb +0 -22
  46. data/app/views/spree/admin/posts/edit.html.erb +0 -5
  47. data/app/views/spree/admin/posts/filters.html.erb +0 -39
  48. data/app/views/spree/admin/posts/index.html.erb +0 -10
  49. data/app/views/spree/admin/posts/new.html.erb +0 -1
  50. data/app/views/spree/admin/products/form/_properties.html.erb +0 -46
  51. data/app/views/spree/admin/properties/_filters.html.erb +0 -5
  52. data/app/views/spree/admin/properties/_form.html.erb +0 -8
  53. data/app/views/spree/admin/properties/_table_header.html.erb +0 -9
  54. data/app/views/spree/admin/properties/_table_row.html.erb +0 -25
  55. data/app/views/spree/admin/properties/edit.html.erb +0 -2
  56. data/app/views/spree/admin/properties/index.html.erb +0 -22
  57. data/app/views/spree/admin/properties/new.html.erb +0 -1
  58. data/app/views/spree/admin/properties/update.turbo_stream.erb +0 -1
  59. data/app/views/spree/admin/shared/_posts_tabs.html.erb +0 -8
  60. data/app/views/spree/admin/shared/sidebar/_customers_nav.html.erb +0 -15
  61. data/app/views/spree/admin/shared/sidebar/_integrations_nav.html.erb +0 -3
  62. data/app/views/spree/admin/shared/sidebar/_orders_nav.html.erb +0 -45
  63. data/app/views/spree/admin/shared/sidebar/_products_nav.html.erb +0 -42
  64. data/app/views/spree/admin/shared/sidebar/_promotions_nav.html.erb +0 -15
  65. data/app/views/spree/admin/shared/sidebar/_returns_nav.html.erb +0 -26
  66. data/app/views/spree/admin/shared/sidebar/_storefront_nav.html.erb +0 -46
  67. data/app/views/spree/admin/shared/sidebar/_vendors_nav.html.erb +0 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c3c1bcea62974a037285f20685e3d926e15bf03b1865b82f5a98b11f8c83a9b
4
- data.tar.gz: a3c6ec7ac7ad5d4e0e3d941bc34d2b68b8a8c63122b0c4e12162f38cd3f85faa
3
+ metadata.gz: 4f57b463a1f1a46360341017872bff19562f612a9f2fd6a040a5a340e8ad04b9
4
+ data.tar.gz: ab57b308e0087992c563e520a5d3312b1f49f8eaf0d07445700cd374f150f4f6
5
5
  SHA512:
6
- metadata.gz: 564215eebe42f983fc907cf5f53fbc17e4282fe1af905580cdcefff52d053d6f258a64069196823527e6727de062f77fdf274fd98b9f9731aff86469c8e23257
7
- data.tar.gz: 77f2de97d0af53f65de94783e9182ff3a97007e656ab3b19667cea55716d7928f14a39a3988993a7433d0dc61be976c1fd652251d2077084c14c5faf362dbb40
6
+ metadata.gz: 38b26c705f3a4445a0fe84f122a04ee8e1f209437573b6e1fad9a7f60cbf943a3cdc6130fbd12dc5af5b0b80cf80c90b7fa9d5b544f518b59a648ff8f91ec89e
7
+ data.tar.gz: 751ee61e2e785860e87f0677e3d2b3693f5c0c88586f38cd2fbeb38caafb779d0ea2c33129b46315109017da12acc59c39bdca974189e064a282d3610dcbf7cc
@@ -8,6 +8,27 @@ module Spree
8
8
 
9
9
  helper 'spree/admin/api_keys'
10
10
 
11
+ def create
12
+ invoke_callbacks(:create, :before)
13
+ set_created_by
14
+ @object.attributes = permitted_resource_params
15
+ if @object.save
16
+ invoke_callbacks(:create, :after)
17
+ if @object.secret?
18
+ # Pass plaintext token via flash so the show page can display it once.
19
+ # Flash is stored in the encrypted session cookie and auto-cleared after one request.
20
+ # Skip the success flash — the token warning banner is sufficient feedback.
21
+ flash[:plaintext_token] = @object.plaintext_token
22
+ else
23
+ flash[:success] = message_after_create
24
+ end
25
+ redirect_to location_after_create, status: :see_other
26
+ else
27
+ invoke_callbacks(:create, :fails)
28
+ render action: :new, status: :unprocessable_content
29
+ end
30
+ end
31
+
11
32
  def revoke
12
33
  @object = scope.find_by_prefix_id!(params[:id])
13
34
  @object.revoke!(try_spree_current_user)
@@ -35,7 +35,8 @@ module Spree
35
35
  end
36
36
 
37
37
  def assign_params
38
- @object.type = permitted_resource_params[:type] if available_types.map(&:to_s).include?(permitted_resource_params[:type])
38
+ available_type = available_types.map(&:to_s).find { |t| t == permitted_resource_params[:type] }
39
+ @object = @object.becomes!(available_type.constantize) if available_type.present?
39
40
  @object.search_params = permitted_resource_params[:search_params]
40
41
  end
41
42
 
@@ -19,10 +19,8 @@ module Spree
19
19
 
20
20
  new_action.before :build_master_prices
21
21
  new_action.before :build_master_stock_items
22
- new_action.before :build_product_properties
23
22
  edit_action.before :build_master_prices
24
23
  edit_action.before :build_master_stock_items
25
- edit_action.before :build_product_properties
26
24
  create.after :assign_master_images
27
25
  update.before :skip_updating_status
28
26
  update.before :update_status
@@ -271,16 +269,6 @@ module Spree
271
269
  {}
272
270
  end
273
271
 
274
- def build_product_properties
275
- return unless Spree::Config[:product_properties_enabled]
276
-
277
- Spree::Property.all.each do |property|
278
- @product.product_properties.build(property: property) unless @product.product_properties.find do |product_property|
279
- product_property.property_id == property.id
280
- end
281
- end
282
- end
283
-
284
272
  def assign_master_images
285
273
  return unless @product.master.persisted?
286
274
 
@@ -24,8 +24,12 @@ module Spree
24
24
  end
25
25
 
26
26
  def masked_api_key(api_key)
27
- token = api_key.token
28
- "#{token[0..6]}#{'*' * 16}#{token[-4..]}"
27
+ if api_key.secret?
28
+ "#{api_key.token_prefix}#{'*' * 15}"
29
+ else
30
+ token = api_key.token
31
+ "#{token[0..6]}#{'*' * 16}#{token[-4..]}"
32
+ end
29
33
  end
30
34
  end
31
35
  end
@@ -273,13 +273,13 @@ module Spree
273
273
  end
274
274
 
275
275
  # renders a link to preview a resource on the storefront using the spree_storefront_resource_url helper
276
- # @param resource [Spree::Product, Spree::Post] the resource to preview
276
+ # @param resource [Spree::Product] the resource to preview
277
277
  # @param options [Hash] the options for the link
278
278
  # @return [String] the link to preview the resource
279
279
  def external_page_preview_link(resource, options = {})
280
280
  resource_name = options[:name] || resource.class.name.demodulize
281
281
 
282
- url = if [Spree::Product, Spree::Post].include?(resource.class)
282
+ url = if resource.instance_of?(Spree::Product)
283
283
  spree_storefront_resource_url(resource, preview_id: resource.id)
284
284
  else
285
285
  spree_storefront_resource_url(resource)
@@ -318,8 +318,6 @@ module Spree
318
318
  # @param options [Hash] additional options for rendering
319
319
  # @return [String] the rendered navigation HTML
320
320
  def render_navigation(context = :sidebar, **options)
321
- return '' if Spree::Admin::RuntimeConfig.legacy_sidebar_navigation
322
-
323
321
  items = navigation_items(context)
324
322
  return '' if items.empty?
325
323
 
@@ -111,9 +111,6 @@ module Spree
111
111
  [:admin, @search]
112
112
  end
113
113
 
114
- def sorted_product_properties(product)
115
- product.product_properties.sort_by { |product_property| product_property.property.position }
116
- end
117
114
  end
118
115
  end
119
116
  end
@@ -9,17 +9,6 @@ module Spree
9
9
  @tags_json_array ||= tags_scope.pluck(:id, :name).map { |id, name| { id: id, name: name } }.as_json
10
10
  end
11
11
 
12
- def post_tags_scope
13
- @post_tags_scope ||= ActsAsTaggableOn::Tag.
14
- joins(:taggings).
15
- where(ActsAsTaggableOn.taggings_table => { taggable_type: 'Spree::Post' }).
16
- for_context(:tags).for_tenant(current_store.id)
17
- end
18
-
19
- def post_tags_json_array
20
- @post_tags_json_array ||= post_tags_scope.pluck(:id, :name).map { |id, name| { id: id, name: name } }.as_json
21
- end
22
-
23
12
  def user_tags_scope
24
13
  @user_tags_scope ||= ActsAsTaggableOn::Tag.
25
14
  joins(:taggings).
@@ -3,7 +3,7 @@ import { Controller } from "@hotwired/stimulus"
3
3
  export default class extends Controller {
4
4
  static targets = ["input", "clear"]
5
5
 
6
- connect() {
6
+ inputTargetConnected() {
7
7
  this.toggleClearButton()
8
8
  }
9
9
 
@@ -0,0 +1,13 @@
1
+ module ActionText
2
+ class VideoEmbed < ApplicationRecord
3
+ include ActionText::Attachable
4
+
5
+ validates :url, :raw_html, :thumbnail_url, presence: true
6
+
7
+ # `to_partial_path` for the storefront render is by default "action_text/video_embeds/video_embed"
8
+
9
+ def to_trix_content_attachment_partial_path
10
+ 'action_text/video_embeds/thumbnail'
11
+ end
12
+ end
13
+ end
@@ -13,6 +13,7 @@ module Spree
13
13
  [
14
14
  *metadata_rows,
15
15
  :separator,
16
+ locale_row,
16
17
  currency_row,
17
18
  subtotal_row,
18
19
  shipping_row,
@@ -71,6 +72,17 @@ module Spree
71
72
  rows
72
73
  end
73
74
 
75
+ def locale_row
76
+ return nil if order.locale.blank?
77
+
78
+ {
79
+ label: Spree.t(:locale),
80
+ value: order.locale,
81
+ id: 'locale',
82
+ type: :code
83
+ }
84
+ end
85
+
74
86
  def currency_row
75
87
  {
76
88
  label: Spree.t(:currency),
@@ -0,0 +1 @@
1
+ <%= image_tag video_embed.thumbnail_url %>
@@ -0,0 +1,3 @@
1
+ <div class="video-embed-container mt-4 mb-4">
2
+ <%= video_embed.raw_html.html_safe %>
3
+ </div>
@@ -0,0 +1,3 @@
1
+ <div class="trix-content">
2
+ <%= yield -%>
3
+ </div>
@@ -3,25 +3,52 @@
3
3
  <h5 class="card-title"><%= Spree.t(:api_key) %></h5>
4
4
  </div>
5
5
  <div class="card-body">
6
- <% if @api_key.active? %>
6
+ <% if !@api_key.active? %>
7
+ <div class="bg-red-50 border border-red-200 rounded-md p-4">
8
+ <div class="flex items-center">
9
+ <%= icon 'alert-triangle', class: 'text-red-500 mr-2' %>
10
+ <span class="text-red-700"><%= Spree.t('admin.api_keys.key_revoked_message') %></span>
11
+ </div>
12
+ </div>
13
+ <% elsif @api_key.secret? && flash[:plaintext_token].present? %>
14
+ <div class="bg-yellow-50 border border-yellow-200 rounded-md p-4 mb-4">
15
+ <div class="flex items-center">
16
+ <%= icon 'alert-triangle', class: 'text-yellow-600 mr-2' %>
17
+ <span class="text-yellow-800 text-sm font-medium"><%= Spree.t('admin.api_keys.token_warning') %></span>
18
+ </div>
19
+ </div>
7
20
  <div data-controller="password-visibility" class="input-group gap-0 pr-1">
8
- <input type="password" class="grow text-truncate" data-password-visibility-target="input" spellcheck="false" value="<%= @api_key.token %>" readonly>
21
+ <input type="password" class="grow text-truncate" data-password-visibility-target="input" spellcheck="false" value="<%= flash[:plaintext_token] %>" readonly>
9
22
 
10
23
  <button type="button" class="btn hover:bg-gray-100 p-1 mr-1 rounded" data-action="password-visibility#toggle">
11
24
  <span data-password-visibility-target="icon"><%= icon 'eye', class: 'mr-0' %></span>
12
25
  <span data-password-visibility-target="icon" class="hidden"><%= icon 'eye-off', class: 'mr-0' %></span>
13
26
  </button>
14
27
 
15
- <%= clipboard_component(@api_key.token,
16
- button_class: 'btn hover:bg-gray-100 p-1 rounded',
28
+ <%= clipboard_component(flash[:plaintext_token],
29
+ button_class: 'btn hover:bg-gray-100 p-1 rounded',
17
30
  icon_class: 'mr-0') %>
18
31
  </div>
19
- <% else %>
20
- <div class="bg-red-50 border border-red-200 rounded-md p-4">
21
- <div class="flex items-center">
22
- <%= icon 'alert-triangle', class: 'text-red-500 mr-2' %>
23
- <span class="text-red-700"><%= Spree.t('admin.api_keys.key_revoked_message') %></span>
32
+ <% elsif @api_key.secret? %>
33
+ <div class="bg-gray-50 border border-gray-200 rounded-md p-4">
34
+ <div class="flex items-center mb-2">
35
+ <%= icon 'lock', class: 'text-gray-500 mr-2' %>
36
+ <span class="text-gray-700 text-sm font-medium"><%= Spree.t('admin.api_keys.secret_key_hidden') %></span>
24
37
  </div>
38
+ <code class="text-sm text-gray-500"><%= @api_key.token_prefix %><%= '***************' %></code>
39
+ </div>
40
+ <% else %>
41
+ <div data-controller="password-visibility" class="input-group gap-0 pr-1">
42
+ <input type="password" class="grow text-truncate" data-password-visibility-target="input" spellcheck="false" value="<%= @api_key.token %>" readonly>
43
+
44
+ <button type="button" class="btn hover:bg-gray-100 p-1 mr-1 rounded" data-action="password-visibility#toggle">
45
+ <span data-password-visibility-target="icon"><%= icon 'eye', class: 'mr-0' %></span>
46
+ <span data-password-visibility-target="icon" class="hidden"><%= icon 'eye-off', class: 'mr-0' %></span>
47
+ </button>
48
+
49
+ <%= clipboard_component(@api_key.token,
50
+ button_class: 'btn hover:bg-gray-100 p-1 rounded',
51
+ icon_class: 'mr-0') %>
25
52
  </div>
26
53
  <% end %>
27
54
  </div>
@@ -8,9 +8,10 @@
8
8
  </p>
9
9
 
10
10
  <h6 class="font-medium text-sm mb-2"><%= Spree.t('admin.api_keys.example_request') %></h6>
11
+ <% example_token = flash[:plaintext_token] || @api_key.token || "#{@api_key.token_prefix}..." %>
11
12
  <div class="bg-gray-900 rounded-md p-4 overflow-x-auto">
12
- <pre class="text-green-400 text-sm font-mono whitespace-pre-wrap"><code>curl -X GET "https://your-store.com/api/v3/store/products" \
13
- -H "X-Spree-Api-Key: <%= @api_key.token %>"</code></pre>
13
+ <pre class="text-green-400 text-sm font-mono"><code class="bg-transparent text-green-500">curl -X GET "<%= spree.api_v3_store_products_url(host: current_store.url_or_custom_domain) %>" \
14
+ -H "x-spree-api-key: <strong class="text-white"><%= example_token %></strong>"</code></pre>
14
15
  </div>
15
16
  </div>
16
17
  </div>
@@ -1,5 +1,5 @@
1
1
  <%= turbo_render_alerts %>
2
2
 
3
3
  <%= turbo_stream.replace 'export-dialog' do %>
4
- <%= render 'spree/admin/shared/export_modal', export_type: @export.type %>
4
+ <%= render 'spree/admin/shared/export_modal', export_type: @object.type %>
5
5
  <% end %>
@@ -1,15 +1,15 @@
1
1
  <%= turbo_frame_tag :export_dialog do %>
2
- <%= form_for @export, url: spree.admin_exports_path do |f| %>
2
+ <%= form_for @object, url: spree.admin_exports_path, as: :export do |f| %>
3
3
  <%= f.hidden_field :type %>
4
4
  <%= f.hidden_field :search_params %>
5
5
  <div class="dialog-header">
6
6
  <h5 class="dialog-title">
7
- <%= Spree.t(:export) + ' ' + plural_resource_name(@export.model_class) %>
7
+ <%= Spree.t(:export) + ' ' + plural_resource_name(@object.model_class) %>
8
8
  </h5>
9
9
  <button type="button" class="btn-close" data-action="click->export-dialog#close" aria-label="Close"></button>
10
10
  </div>
11
11
  <div class="dialog-body">
12
- <%= render 'spree/admin/shared/error_messages', target: @export %>
12
+ <%= render 'spree/admin/shared/error_messages', target: @object %>
13
13
  <div class="custom-control custom-radio hover:bg-gray-50 rounded-lg p-3">
14
14
  <%= f.radio_button :record_selection, 'filtered', class: 'custom-control-input' %>
15
15
  <%= f.label :record_selection, for: :export_record_selection_filtered, class: 'custom-control-label flex-col items-start' do %>
@@ -1 +1 @@
1
- Classic ActiveMerchant gateway provided by community.
1
+ Classic payment gateway provided by community.
@@ -31,19 +31,20 @@
31
31
  <div class="table-responsive">
32
32
  <table class="table">
33
33
  <thead>
34
- <tr>
35
- <th scope="col"><%= Spree.t(:name) %></th>
36
- <th scope="col"><%= Spree.t(:description) %></th>
37
- <th scope="col"></th>
38
- </tr>
39
- </thead>
40
- <tbody>
41
- <%= render partial: 'spree/admin/payment_methods/available_payment_method', collection: available_payment_methods, as: :payment_method %>
42
- </tbody>
43
- </table>
34
+ <tr>
35
+ <th scope="col"><%= Spree.t(:name) %></th>
36
+ <th scope="col"><%= Spree.t(:description) %></th>
37
+ <th scope="col"></th>
38
+ </tr>
39
+ </thead>
40
+ <tbody>
41
+ <%= render partial: 'spree/admin/payment_methods/available_payment_method', collection: available_payment_methods, as: :payment_method %>
42
+ </tbody>
43
+ </table>
44
+ </div>
44
45
  </div>
45
46
  <% end %>
46
47
 
47
48
  <p class="text-gray-600 text-center my-12">
48
49
  Find more payment methods in <%= external_link_to 'Integrations Directory', 'https://spreecommerce.org/docs/integrations/integrations', target: '_blank' %>
49
- </p>
50
+ </p>
@@ -7,8 +7,6 @@
7
7
  <% end unless @product.has_variants? %>
8
8
  <%= render 'spree/admin/products/form/variants', f: f %>
9
9
  <%= render 'spree/admin/products/form/inventory', f: f unless @product.has_variants? %>
10
- <%= render 'spree/admin/products/form/properties', f: f if Spree::Config[:product_properties_enabled] %>
11
-
12
10
  <%= render_admin_partials(:product_form_partials, f: f, product: @product) %>
13
11
  </div>
14
12
  <div class="col-span-12 md:col-span-4">
@@ -1,131 +1,9 @@
1
- <% if Spree::Admin::RuntimeConfig.legacy_sidebar_navigation %>
2
- <%# Legacy navigation system %>
3
- <% if settings_area? %>
4
- <ul class="nav flex-col">
5
- <% if can?(:manage, current_store) %>
6
- <%= nav_item(Spree.t(:store_details), spree.edit_admin_store_path(section: 'general-settings'), icon: 'building-store', active: params[:section] == 'general-settings') %>
7
- <% end %>
8
-
9
- <% if can?(:manage, Spree.admin_user_class) %>
10
- <%= nav_item(Spree.t(:users), spree.admin_admin_users_path, icon: 'users', active: %w[admin_users invitations roles].include?(controller_name)) %>
11
- <% end %>
12
-
13
- <%= nav_item(Spree.t(:emails), spree.edit_admin_store_path(section: 'emails'), icon: 'send', active: params[:section] == 'emails') if can?(:manage, current_store) %>
14
- <%= nav_item(Spree.t(:policies), spree.admin_policies_path, icon: 'list-check') if can?(:manage, Spree::Policy) %>
15
- <%= nav_item(Spree.t(:checkout), spree.edit_admin_store_path(section: 'checkout'), icon: 'shopping-cart', active: params[:section] == 'checkout') if can?(:manage, current_store) %>
16
- <%= render_admin_partials(:store_settings_nav_partials) %>
17
-
18
- <% if defined?(Spree::CustomDomain) && can?(:manage, Spree::CustomDomain) %>
19
- <%= nav_item(Spree.t(:domains), spree.admin_custom_domains_path, icon: 'world-www') %>
20
- <% end %>
21
-
22
- <% if can?(:manage, Spree::PaymentMethod) %>
23
- <%= nav_item(Spree.t(:payments), spree.admin_payment_methods_path, icon: 'credit-card') %>
24
- <% end %>
25
-
26
- <% if can?(:manage, Spree::Zone) %>
27
- <%= nav_item(Spree.t(:zones), spree.admin_zones_path, icon: 'world', active: %w[zones countries states].include?(controller_name)) %>
28
- <% end %>
29
-
30
- <% if can?(:manage, Spree::ShippingMethod) %>
31
- <%= nav_item(Spree.t(:shipping), spree.admin_shipping_methods_path, icon: 'truck', active: %w[shipping_methods shipping_categories].include?(controller_name)) %>
32
- <% end %>
33
-
34
- <% if can?(:manage, Spree::TaxRate) %>
35
- <%= nav_item(Spree.t(:tax), spree.admin_tax_rates_path, icon: 'receipt-tax', active: %w[tax_rates tax_categories stripe_tax_registrations].include?(controller_name)) %>
36
- <% end %>
37
-
38
- <% if can?(:manage, Spree::ReturnAuthorizationReason) %>
39
- <%= nav_item(Spree.t(:returns), spree.admin_return_authorization_reasons_path, icon: 'receipt-refund', active: %w[refund_reasons reimbursement_types return_authorization_reasons].include?(controller_name)) %>
40
- <% end %>
41
-
42
- <% if can?(:manage, Spree::StockLocation) %>
43
- <%= nav_item(Spree.t(:stock_locations), spree.admin_stock_locations_path, icon: 'map-pin') %>
44
- <% end %>
45
-
46
- <% if can?(:manage, Spree::MetafieldDefinition) %>
47
- <%= nav_item(Spree.t(:metafield_definitions), spree.admin_metafield_definitions_path, icon: 'list-details') %>
48
- <% end %>
49
-
50
- <% if can?(:manage, Spree::Store) %>
51
- <% if spree.respond_to?(:admin_audits_path) %>
52
- <%= nav_item(Spree.t('admin.audit_log'), spree.admin_audits_path, icon: 'history', active: %w[audits exports imports].include?(controller_name)) %>
53
- <% else %>
54
- <li class="nav-item">
55
- <%= external_link_to nil, 'https://spreecommerce.org/pricing', class: 'nav-link flex items-center w-full' do %>
56
- <%= icon 'history' %>
57
- <%= Spree.t('admin.audit_log') %>
58
-
59
- <span class="badge ml-auto rounded-full" data-controller="tooltip">
60
- Enterprise
61
- <%= tooltip("This feature is part of the Enterprise Edition.") %>
62
- </span>
63
- <% end %>
64
- </li>
65
- <% end %>
66
- <% end %>
67
-
68
- <% if defined?(Spree::OauthApplication) && can?(:manage, Spree::OauthApplication) %>
69
- <%= nav_item(Spree.t(:developers), spree.admin_oauth_applications_path, icon: 'terminal', active: %w[oauth_applications webhooks_subscribers].include?(controller_name)) %>
70
- <% end %>
71
-
72
- <%= nav_item(Spree.t('admin.edit_profile'), spree.edit_admin_profile_path, icon: 'user-scan') %>
73
-
74
- <%= render_admin_partials(:settings_nav_partials) %>
75
- </ul>
1
+ <% if settings_area? %>
2
+ <%= render_navigation(:settings) %>
76
3
  <% else %>
77
- <ul class="nav flex-col">
78
- <% if can?(:manage, current_store) %>
79
- <% unless current_store.setup_completed? %>
80
- <%= nav_item(nil, spree.admin_getting_started_path, icon: 'map') do %>
81
- <%= icon 'map' %>
82
- <%= Spree.t('admin.getting_started') %>
83
- <span class="badge ml-auto badge-info">
84
- <%= current_store.setup_tasks_done %><span class="opacity-50">/<%= current_store.setup_tasks_total %></span>
85
- </span>
86
- <% end %>
87
- <% end %>
88
- <% end %>
89
-
90
- <%= nav_item(Spree.t(:home), spree.admin_path, icon: 'home', active: controller_name == 'dashboard' && action_name == 'show') %>
91
-
92
- <%= render 'spree/admin/shared/sidebar/orders_nav' %>
93
- <%= render 'spree/admin/shared/sidebar/returns_nav' %>
94
- <%= render 'spree/admin/shared/sidebar/products_nav' %>
95
- <%= render 'spree/admin/shared/sidebar/vendors_nav' %>
96
- <%= render 'spree/admin/shared/sidebar/customers_nav' %>
97
- <%= render 'spree/admin/shared/sidebar/promotions_nav' %>
98
-
99
- <% if can?(:manage, Spree::Report) %>
100
- <%= nav_item(Spree.t(:reports), spree.admin_reports_path, icon: 'chart-bar') %>
101
- <% end %>
102
-
103
- <%= render_admin_partials(:store_nav_partials) %>
104
-
105
- <%= render 'spree/admin/shared/sidebar/storefront_nav' %>
106
- <%= render 'spree/admin/shared/sidebar/integrations_nav' %>
107
- </ul>
4
+ <%= render_navigation(:sidebar) %>
108
5
 
109
6
  <div class="mt-auto flex flex-col">
110
7
  <%= render 'spree/admin/shared/sidebar/enterprise_edition_notice' %>
111
-
112
- <ul class="nav flex-col mb-2">
113
- <% if can?(:manage, current_store) %>
114
- <%= nav_item(Spree.t(:settings), spree.edit_admin_store_path(section: 'general-settings'), icon: 'settings', active: params[:section] == 'general-settings') %>
115
- <%= nav_item(Spree.t(:users), spree.admin_admin_users_path, icon: 'users') %>
116
- <% end %>
117
- </ul>
118
8
  </div>
119
- <% end %>
120
- <% else %>
121
- <%# New navigation system %>
122
- <% if settings_area? %>
123
- <%= render_navigation(:settings) %>
124
- <% else %>
125
- <%= render_navigation(:sidebar) %>
126
-
127
- <div class="mt-auto flex flex-col">
128
- <%= render 'spree/admin/shared/sidebar/enterprise_edition_notice' %>
129
- </div>
130
- <% end %>
131
9
  <% end %>
@@ -0,0 +1 @@
1
+ OEmbed::Providers.register_all
@@ -126,12 +126,6 @@ Rails.application.config.after_initialize do
126
126
  active: -> { %w[option_types option_values].include?(controller_name) },
127
127
  if: -> { can?(:manage, Spree::OptionType) }
128
128
 
129
- # Properties
130
- products.add :properties,
131
- label: :properties,
132
- url: :admin_properties_path,
133
- position: 50,
134
- if: -> { can?(:manage, Spree::Property) && Spree::Config.product_properties_enabled }
135
129
  end
136
130
 
137
131
  # Customers with submenu
@@ -179,15 +173,6 @@ Rails.application.config.after_initialize do
179
173
  position: 60,
180
174
  if: -> { can?(:manage, Spree::Report) }
181
175
 
182
- # Posts (Blog)
183
- sidebar_nav.add :posts,
184
- label: :posts,
185
- url: :admin_posts_path,
186
- icon: 'article',
187
- position: 70,
188
- active: -> { %w[posts post_categories].include?(controller_name) },
189
- if: -> { can?(:manage, Spree::Post) }
190
-
191
176
  # Integrations
192
177
  sidebar_nav.add :integrations,
193
178
  label: :integrations,
@@ -1175,105 +1175,6 @@ Rails.application.config.after_initialize do
1175
1175
  default: false,
1176
1176
  position: 70
1177
1177
 
1178
- # ==========================================
1179
- # Posts Table
1180
- # ==========================================
1181
- Spree.admin.tables.register(:posts, model_class: Spree::Post, search_param: :title_cont)
1182
-
1183
- Spree.admin.tables.posts.add :title,
1184
- label: :title,
1185
- type: :link,
1186
- sortable: true,
1187
- filterable: true,
1188
- default: true,
1189
- position: 10
1190
-
1191
- Spree.admin.tables.posts.add :post_category,
1192
- label: :category,
1193
- type: :string,
1194
- filter_type: :autocomplete,
1195
- sortable: false,
1196
- filterable: true,
1197
- default: true,
1198
- position: 20,
1199
- method: ->(post) { post.post_category_title },
1200
- ransack_attribute: 'post_category_id',
1201
- search_url: ->(view_context) { view_context.spree.select_options_admin_post_categories_path(format: :json) }
1202
-
1203
- Spree.admin.tables.posts.add :author,
1204
- label: :author,
1205
- type: :string,
1206
- filter_type: :autocomplete,
1207
- sortable: false,
1208
- filterable: true,
1209
- default: true,
1210
- position: 30,
1211
- method: ->(post) { post.author_name },
1212
- ransack_attribute: 'author_id',
1213
- search_url: ->(view_context) { view_context.spree.select_options_admin_admin_users_path(format: :json) }
1214
-
1215
- Spree.admin.tables.posts.add :published_at,
1216
- label: :published_at,
1217
- type: :date,
1218
- sortable: true,
1219
- filterable: true,
1220
- default: true,
1221
- position: 40
1222
-
1223
- Spree.admin.tables.posts.add :created_at,
1224
- label: :created_at,
1225
- type: :datetime,
1226
- sortable: true,
1227
- filterable: true,
1228
- default: false,
1229
- position: 50
1230
-
1231
- Spree.admin.tables.posts.add :updated_at,
1232
- label: :updated_at,
1233
- type: :datetime,
1234
- sortable: true,
1235
- filterable: true,
1236
- default: false,
1237
- position: 60
1238
-
1239
- # ==========================================
1240
- # Post Categories Table
1241
- # ==========================================
1242
- Spree.admin.tables.register(:post_categories, model_class: Spree::PostCategory, search_param: :title_cont)
1243
-
1244
- Spree.admin.tables.post_categories.add :title,
1245
- label: :title,
1246
- type: :link,
1247
- sortable: true,
1248
- filterable: true,
1249
- default: true,
1250
- position: 10
1251
-
1252
- Spree.admin.tables.post_categories.add :posts_count,
1253
- label: :posts,
1254
- type: :number,
1255
- sortable: false,
1256
- filterable: false,
1257
- default: true,
1258
- position: 20,
1259
- method: ->(post_category) { post_category.posts.count }
1260
-
1261
- Spree.admin.tables.post_categories.add :created_at,
1262
- label: :created_at,
1263
- type: :datetime,
1264
- sortable: true,
1265
- filterable: true,
1266
- default: false,
1267
- position: 30
1268
-
1269
- Spree.admin.tables.post_categories.add :updated_at,
1270
- label: :updated_at,
1271
- type: :datetime,
1272
- sortable: true,
1273
- filterable: true,
1274
- default: false,
1275
- position: 40
1276
-
1277
1178
  # ==========================================
1278
1179
  # Webhook Endpoints Table
1279
1180
  # ==========================================