spree_admin 5.0.3 → 5.0.4

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/app/controllers/spree/admin/dashboard_controller.rb +11 -12
  3. data/app/controllers/spree/admin/webhooks_subscribers_controller.rb +32 -13
  4. data/app/helpers/spree/admin/base_helper.rb +1 -1
  5. data/app/helpers/spree/admin/navigation_helper.rb +1 -1
  6. data/app/helpers/spree/admin/orders_helper.rb +3 -1
  7. data/app/javascript/spree/admin/application.js +0 -2
  8. data/app/javascript/spree/admin/controllers/asset_uploader_controller.js +3 -2
  9. data/app/javascript/spree/admin/controllers/variants_form_controller.js +3 -2
  10. data/app/javascript/spree/admin/helpers/trix/video_embed.js +2 -2
  11. data/app/views/spree/admin/dashboard/_top_products.html.erb +1 -1
  12. data/app/views/spree/admin/orders/_filters.html.erb +11 -1
  13. data/app/views/spree/admin/orders/_summary.html.erb +1 -1
  14. data/app/views/spree/admin/page_blocks/forms/_image.html.erb +9 -0
  15. data/app/views/spree/admin/page_builder/_sidebar_block.html.erb +10 -9
  16. data/app/views/spree/admin/page_builder/_sidebar_sections_toolbar.html.erb +152 -39
  17. data/app/views/spree/admin/payment_methods/_form.html.erb +1 -1
  18. data/app/views/spree/admin/products/form/_variants.html.erb +1 -0
  19. data/app/views/spree/admin/shared/_head.html.erb +6 -1
  20. data/app/views/spree/admin/shared/_tax_nav.html.erb +1 -0
  21. data/app/views/spree/admin/shared/sidebar/_store_nav.html.erb +3 -2
  22. data/app/views/spree/admin/shared/sidebar/_storefront_nav.html.erb +2 -0
  23. data/app/views/spree/admin/stores/form/_basic.html.erb +1 -1
  24. data/app/views/spree/admin/users/_form.html.erb +1 -1
  25. data/app/views/spree/admin/users/index.html.erb +3 -3
  26. data/app/views/spree/admin/variants/form/_media.html.erb +1 -0
  27. data/app/views/spree/admin/webhooks_subscribers/_form.html.erb +37 -19
  28. data/app/views/spree/admin/webhooks_subscribers/_webhooks_subscriber.html.erb +12 -6
  29. data/app/views/spree/admin/webhooks_subscribers/edit.html.erb +2 -2
  30. data/app/views/spree/admin/webhooks_subscribers/show.html.erb +58 -47
  31. data/config/importmap.rb +2 -2
  32. data/lib/spree/admin/engine.rb +9 -1
  33. data/vendor/javascript/bootstrap--dist--js--bootstrap.bundle.min.js.js +4 -4
  34. data/vendor/javascript/dompurify.js +24 -24
  35. metadata +8 -9
  36. data/app/javascript/spree/admin/controllers/webhook_subscriber_events_controller.js +0 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2314972e804657e3746e099913f84a2ffe364d955005ecd2ad0f441f6d38f44c
4
- data.tar.gz: b5b4bc046008b7f3077c12dccb7571f5fc965f2196d3a1d077f044d911da0dd2
3
+ metadata.gz: 896d26ce5c5cefb448bf77753fbb39af32b548d26aad748b20eae32ac51f1972
4
+ data.tar.gz: c51934c9b3763132ad0978789d770645819016286aa505a065e0257a1bbb517d
5
5
  SHA512:
6
- metadata.gz: 0f823382a162659d30e565ff7dfc2299f4c8b5ce4e73e11c7b3a146dc0560ebadd289653d09b6c40eb33e30300f4d2032b91389b2a2eebad43657c236d2065df
7
- data.tar.gz: 7e104c97735e15737d3b9d209a632ac7cdd8c53b0229e8482225e57e023d44d74228833fef8cb7f2fd54c1f56e696b634fff5d7d289bc6a3bdb5d2e14aa56c23
6
+ metadata.gz: 3e4045b8196f7e9d3464942a40d5d8875ee37b0511df0e41a91876f83f052ea84ac94623ead5f91eff08fb1be514cb268894af96cd1b678045fb2f21ab6d26b6
7
+ data.tar.gz: 2845718bc86d3007d26c8482fe14b566d72a51b5b0159557969ce53c42cc2ddba9abd853da9458ee3914901cdce1341212babe1010e7b8dab81109d6cc0cf090
@@ -111,9 +111,11 @@ module Spree
111
111
  @audience_growth_rate = calc_growth_rate(@audience_total, previous_audience_total)
112
112
 
113
113
  @audience = if same_day?
114
- @audience_scope.group_by_hour(:created_at, range: analytics_time_range, time_zone: current_store.preferred_timezone, default_value: 0)
114
+ @audience_scope.group_by_hour(:created_at, range: analytics_time_range, time_zone: current_store.preferred_timezone,
115
+ default_value: 0)
115
116
  else
116
- @audience_scope.group_by_day(:created_at, range: analytics_time_range, time_zone: current_store.preferred_timezone, default_value: 0)
117
+ @audience_scope.group_by_day(:created_at, range: analytics_time_range, time_zone: current_store.preferred_timezone,
118
+ default_value: 0)
117
119
  end
118
120
 
119
121
  return unless defined?(Ahoy)
@@ -123,25 +125,22 @@ module Spree
123
125
  previous_visits_total = Ahoy::Visit.where(started_at: previous_analytics_time_range).count
124
126
  @visits_growth_rate = calc_growth_rate(@visits_total, previous_visits_total)
125
127
 
126
- @visits_scope = Ahoy::Visit.where(started_at: analytics_time_range)
127
- @visits_total = @visits_scope.count
128
- previous_visits_total = Ahoy::Visit.where(started_at: previous_analytics_time_range).count
129
- @visits_growth_rate = calc_growth_rate(@visits_total, previous_visits_total)
130
-
131
128
  @visits = if same_day?
132
- @visits_scope.group_by_hour(:started_at, range: analytics_time_range, time_zone: current_store.preferred_timezone, default_value: 0)
129
+ @visits_scope.group_by_hour(:started_at, range: analytics_time_range, time_zone: current_store.preferred_timezone,
130
+ default_value: 0)
133
131
  else
134
- @visits_scope.group_by_day(:started_at, range: analytics_time_range, time_zone: current_store.preferred_timezone, default_value: 0)
132
+ @visits_scope.group_by_day(:started_at, range: analytics_time_range, time_zone: current_store.preferred_timezone,
133
+ default_value: 0)
135
134
  end
136
135
 
137
- @top_landing_pages = @visits_scope.where.not(landing_page_title: [nil, '']).top(:landing_page_title, 10)
136
+ @top_landing_pages = @visits_scope.where.not(landing_page: [nil, '']).top(:landing_page, 10)
138
137
  @top_referrers = @visits_scope.where.not(referring_domain: current_store.custom_domains.pluck(:url) << current_store.url).top(
139
138
  :referring_domain, 10
140
139
  )
141
140
  @top_locations = @visits_scope.top(:country, 10)
142
141
  @top_devices = @visits_scope.group(:device_type).count.transform_keys do |device|
143
- device.nil? ? 'N/A' : device
144
- end.map { |series| [series.first, (series.second.to_f / @visits_scope.count) * 100] }
142
+ device.nil? ? 'N/A' : device
143
+ end.map { |series| [series.first, (series.second.to_f / @visits_scope.count) * 100] }
145
144
  end
146
145
  end
147
146
  end
@@ -1,20 +1,11 @@
1
1
  module Spree
2
2
  module Admin
3
3
  class WebhooksSubscribersController < ResourceController
4
+ before_action :set_supported_events, except: [:index, :show]
5
+
4
6
  create.before :process_subscriptions
5
7
  update.before :process_subscriptions
6
8
 
7
- def index
8
- params[:q] ||= {}
9
- params[:q][:s] ||= 'created_at desc'
10
-
11
- search = Webhooks::Subscriber.accessible_by(current_ability).ransack(params[:q])
12
- @webhooks_subscribers = search.result.
13
- includes(:events).
14
- page(params[:page]).
15
- per(params[:per_page])
16
- end
17
-
18
9
  def show
19
10
  @webhooks_subscriber = Webhooks::Subscriber.find(params[:id])
20
11
  @events = @webhooks_subscriber.events.order(created_at: :desc).page(params[:page]).per(params[:per_page])
@@ -26,7 +17,19 @@ module Spree
26
17
  @resource ||= Spree::Admin::Resource.new 'spree/admin/webhooks/subscribers', 'subscribers', nil
27
18
  end
28
19
 
20
+ def collection
21
+ params[:q] ||= {}
22
+ params[:q][:s] ||= 'created_at desc'
23
+
24
+ @search = Webhooks::Subscriber.accessible_by(current_ability).ransack(params[:q])
25
+ @collection = @search.result.
26
+ page(params[:page]).
27
+ per(params[:per_page])
28
+ end
29
+
29
30
  def process_subscriptions
31
+ return if params[:webhooks_subscriber].blank?
32
+
30
33
  params[:webhooks_subscriber][:subscriptions] = if params[:subscribe_to_all_events] == 'true'
31
34
  ['*']
32
35
  else
@@ -37,12 +40,28 @@ module Spree
37
40
  end
38
41
 
39
42
  def selected_events
40
- supported_events.select { |resource, _events| params[:webhooks_subscriber][resource] == 'true' }.values.flatten
43
+ @supported_events.select { |resource, _events| params[:webhooks_subscriber][resource] == 'true' }.values.flatten
41
44
  end
42
45
 
43
- def supported_events
46
+ def set_supported_events
44
47
  @supported_events ||= Spree::Webhooks::Subscriber.supported_events
45
48
  end
49
+
50
+ def supported_events
51
+ @supported_events
52
+ end
53
+
54
+ def permitted_resource_params
55
+ params.require(:webhooks_subscriber).permit(:url, :active, subscriptions: [])
56
+ end
57
+
58
+ def location_after_create
59
+ location_after_save
60
+ end
61
+
62
+ def location_after_save
63
+ spree.admin_webhooks_subscriber_path(@object)
64
+ end
46
65
  end
47
66
  end
48
67
  end
@@ -10,7 +10,7 @@ module Spree
10
10
  end
11
11
 
12
12
  def enterprise_edition?
13
- defined?(Vendo)
13
+ defined?(SpreeEnterprise)
14
14
  end
15
15
 
16
16
  def spree_updater
@@ -190,7 +190,7 @@ module Spree
190
190
  # @return [String] the badge with the icon
191
191
  def active_badge(condition, options = {})
192
192
  label = options[:label]
193
- label ||= condition ? Spree.t(:say_yes) : Spree.t(:say_no)
193
+ label ||= condition ? Spree.t(:say_yes).to_s : Spree.t(:say_no).to_s
194
194
  label = icon('check') + label if condition
195
195
 
196
196
  css_class = condition ? 'badge-active' : 'badge-inactive'
@@ -25,8 +25,10 @@ module Spree
25
25
  icon('credit-card-refund') + Spree.t('payment_states.refunded')
26
26
  elsif order.partially_refunded?
27
27
  icon('credit-card-refund') + Spree.t('payment_states.partially_refunded')
28
- elsif order.payment_state == 'failed' || order.payment_state == 'void'
28
+ elsif order.payment_state == 'failed'
29
29
  icon('cancel') + Spree.t('payment_states.failed')
30
+ elsif order.payment_state == 'void'
31
+ icon('cancel') + Spree.t('payment_states.void')
30
32
  elsif order.payment_state == 'paid'
31
33
  icon('check') + Spree.t('payment_states.paid')
32
34
  else
@@ -78,7 +78,6 @@ import StockTransferController from 'spree/admin/controllers/stock_transfer_cont
78
78
  import StoreFormController from 'spree/admin/controllers/store_form_controller'
79
79
  import UnitSystemController from 'spree/admin/controllers/unit_system_controller'
80
80
  import VariantsFormController from 'spree/admin/controllers/variants_form_controller'
81
- import WebhooksSubscriberEventsController from 'spree/admin/controllers/webhook_subscriber_events_controller'
82
81
  import AddressAutocompleteController from 'spree/core/controllers/address_autocomplete_controller'
83
82
  import AddressFormController from 'spree/core/controllers/address_form_controller'
84
83
  import EnableButtonController from 'spree/core/controllers/enable_button_controller'
@@ -131,7 +130,6 @@ application.register('tabs', Tabs)
131
130
  application.register('textarea-autogrow', TextareaAutogrow)
132
131
  application.register('unit-system', UnitSystemController)
133
132
  application.register('variants-form', VariantsFormController)
134
- application.register('webhooks-subscriber-events', WebhooksSubscriberEventsController)
135
133
 
136
134
  LocalTime.start()
137
135
 
@@ -11,7 +11,8 @@ export default class extends Controller {
11
11
  viewableType: String,
12
12
  multiple: { type: Boolean, default: false },
13
13
  type: { type: String, default: 'image' },
14
- allowedFileTypes: { type: Array, default: [] }
14
+ allowedFileTypes: { type: Array, default: [] },
15
+ adminAssetsPath: String
15
16
  }
16
17
 
17
18
  connect() {
@@ -43,7 +44,7 @@ export default class extends Controller {
43
44
  }
44
45
 
45
46
  handleSuccessResult(response) {
46
- post('/admin/assets', {
47
+ post(this.adminAssetsPathValue, {
47
48
  body: JSON.stringify({
48
49
  asset: {
49
50
  type: this.assetClassValue,
@@ -37,7 +37,8 @@ export default class extends CheckboxSelectAll {
37
37
  currentStockLocationId: String,
38
38
  stockLocations: Array,
39
39
  optionValuesSelectOptions: Array,
40
- locale: String
40
+ locale: String,
41
+ adminPath: String
41
42
  }
42
43
 
43
44
  connect() {
@@ -724,7 +725,7 @@ export default class extends CheckboxSelectAll {
724
725
  this.lastOptionNameId = targetInput.value
725
726
 
726
727
  if (this.lastOptionNameId) {
727
- const response = await get(`/admin/option_types/${this.lastOptionNameId}/option_values/select_options`)
728
+ const response = await get(`${this.adminPathValue}/option_types/${this.lastOptionNameId}/option_values/select_options`)
728
729
 
729
730
  if (response.ok) {
730
731
  this.currentOptionValues[this.lastOptionNameId] = await response.json
@@ -90,7 +90,7 @@ document.addEventListener("trix-attachment-remove", async function(event) {
90
90
  const { attachment } = event
91
91
  const { sgid } = attachment.attachment.attributes.values
92
92
 
93
- destroy(`/admin/action_text/video_embeds/${sgid}`, { responseKind: 'json' })
93
+ destroy(`${Spree.adminPath}/action_text/video_embeds/${sgid}`, { responseKind: 'json' })
94
94
  })
95
95
 
96
96
  function initializeTrixEditor(editor) {
@@ -129,7 +129,7 @@ function initializeTrixEditor(editor) {
129
129
 
130
130
  errorMessage.innerHTML = ''
131
131
 
132
- const response = await post('/admin/action_text/video_embeds', { body: JSON.stringify({ url: input.value }), responseKind: 'json' })
132
+ const response = await post(`${Spree.adminPath}/action_text/video_embeds`, { body: JSON.stringify({ url: input.value }), responseKind: 'json' })
133
133
 
134
134
  if (response.ok) {
135
135
  const { sgid, content } = await response.json
@@ -45,7 +45,7 @@
45
45
  <%= product.name %>
46
46
  <% end %>
47
47
  </td>
48
- <% if enterprise_edition? && defined?(vendor_logo_link) && !@vendor %>
48
+ <% if defined?(vendor_logo_link) && !@vendor %>
49
49
  <td>
50
50
  <%= vendor_logo_link(product.vendor) if product.vendor.present? %>
51
51
  </td>
@@ -1,7 +1,17 @@
1
1
  <% frame_name ||= nil %>
2
2
 
3
+ <% search_form_path = if @user.present?
4
+ spree.admin_user_orders_path(@user)
5
+ elsif @vendor.present? && spree.respond_to?(:admin_vendor_orders_path)
6
+ spree.admin_vendor_orders_path(@vendor)
7
+ elsif controller_name == 'checkouts'
8
+ spree.admin_checkouts_path
9
+ else
10
+ spree.admin_orders_path
11
+ end %>
12
+
3
13
  <%= search_form_for [:admin, @vendor || @user, @search],
4
- url: controller_name == 'checkouts' ? spree.admin_checkouts_path : nil,
14
+ url: search_form_path,
5
15
  class: "filter-wrap",
6
16
  data: {
7
17
  controller: "filters reveal",
@@ -74,7 +74,7 @@
74
74
  <%= render 'tax_lines', tax_lines: tax_lines, id: 'tax-lines-additional' %>
75
75
  </li>
76
76
 
77
- <%= render_admin_partials(:order_page_body_partials, order: @order) %>
77
+ <%= render_admin_partials(:order_page_summary_partials, order: @order) %>
78
78
 
79
79
  <li class="list-group-item d-flex justify-content-between align-items-center border-0">
80
80
  <span data-hook='admin_order_tab_total_title'><%= Spree.t(:total) %></span>
@@ -1 +1,10 @@
1
1
  <%= render 'active_storage/upload_form', form: f, field_name: :asset, width: 512, height: 512, auto_submit: true %>
2
+
3
+ <% content_for(:design_tab) do %>
4
+ <%= render 'spree/admin/page_builder/labeled_range_input',
5
+ f: f, field: :preferred_height, min: 1, max: 1024, unit: 'px', _label: 'Max image height on desktop'
6
+ %>
7
+ <%= render 'spree/admin/page_builder/labeled_range_input',
8
+ f: f, field: :preferred_mobile_height, min: 1, max: 512, unit: 'px', _label: 'Max image height on mobile'
9
+ %>
10
+ <% end %>
@@ -7,15 +7,16 @@
7
7
  } do %>
8
8
  <div class="d-flex align-items-center justify-content-between sidebar-block-title p-1 rounded-sm">
9
9
  <div class="d-flex align-items-center flex-fill">
10
- <%= icon "#{block.icon_name}", class: 'mr-2' if block.icon_name.present? %>
11
- <%= link_to block.display_name, edit_admin_page_section_block_path(block.section, block),
12
- class: 'block-edit-link flex-fill text-dark',
13
- data: {
14
- turbo_frame: :page_sidebar,
15
- action: 'click->page-builder#makeOverlayActive',
16
- page_builder_editor_id_param: "block-#{block.id}"
17
- }
18
- %>
10
+ <%= link_to(edit_admin_page_section_block_path(block.section, block),
11
+ class: 'block-edit-link flex-fill text-dark',
12
+ data: {
13
+ turbo_frame: :page_sidebar,
14
+ action: 'click->page-builder#makeOverlayActive',
15
+ page_builder_editor_id_param: "block-#{block.id}"
16
+ }) do %>
17
+ <%= icon "#{block.icon_name}", class: 'mr-2' if block.icon_name.present? %>
18
+ <%= block.display_name %>
19
+ <% end %>
19
20
  </div>
20
21
  <div class="d-flex align-items-center d-none">
21
22
  <% if block.section.can_sort_blocks? %>
@@ -1,64 +1,177 @@
1
1
  <%= turbo_frame_tag :page_sidebar_toolbar do %>
2
2
  <div class="d-none">
3
- <% @page_preview.sections.includes(:blocks).each do |section| %>
3
+ <% sections =
4
+ @page_preview.sections.includes(:blocks).map { |s| [@page_preview, s] } %>
5
+
6
+ <% sections +=
7
+ @theme_preview.sections.includes(:blocks).map { |s| [@theme_preview, s] } %>
8
+
9
+ <% sections.each do |parent, section| %>
4
10
  <% next if section.new_record? %>
5
11
 
6
- <div id="editor-toolbar-section-<%= section.id %>">
7
- <button class="editor-toolbar-lower">
8
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-down" viewBox="0 0 16 16">
9
- <path fill-rule="evenodd" d="M8 1a.5.5 0 0 1 .5.5v11.793l3.146-3.147a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 .708-.708L7.5 13.293V1.5A.5.5 0 0 1 8 1z"/>
10
- </svg>
11
- </button>
12
- <button class="editor-toolbar-higher">
13
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-up" viewBox="0 0 16 16">
14
- <path fill-rule="evenodd" d="M8 15a.5.5 0 0 0 .5-.5V2.707l3.146 3.147a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 1 0 .708.708L7.5 2.707V14.5a.5.5 0 0 0 .5.5z"/>
15
- </svg>
16
- </button>
17
- <button class="editor-toolbar-edit">
18
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pencil" viewBox="0 0 16 16">
19
- <path d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10zM11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207 11.207 2.5zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293l6.5-6.5zm-9.761 5.175-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325z"/>
20
- </svg>
21
- </button>
22
- <button class="editor-toolbar-delete">
23
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash" viewBox="0 0 16 16">
24
- <path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5Zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5Zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6Z"/>
25
- <path d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1ZM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118ZM2.5 3h11V2h-11v1Z"/>
26
- </svg>
27
- </button>
28
- </div>
12
+ <% unless parent.is_a?(Spree::Theme) %>
13
+ <div id="editor-toolbar-section-<%= section.id %>">
14
+ <button class="editor-toolbar-lower">
15
+ <svg
16
+ xmlns="http://www.w3.org/2000/svg"
17
+ width="16"
18
+ height="16"
19
+ fill="currentColor"
20
+ class="bi bi-arrow-down"
21
+ viewBox="0 0 16 16"
22
+ >
23
+ <path
24
+ fill-rule="evenodd"
25
+ d="M8 1a.5.5 0 0 1 .5.5v11.793l3.146-3.147a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 .708-.708L7.5 13.293V1.5A.5.5 0 0 1 8 1z"
26
+ />
27
+ </svg>
28
+ </button>
29
+ <button class="editor-toolbar-higher">
30
+ <svg
31
+ xmlns="http://www.w3.org/2000/svg"
32
+ width="16"
33
+ height="16"
34
+ fill="currentColor"
35
+ class="bi bi-arrow-up"
36
+ viewBox="0 0 16 16"
37
+ >
38
+ <path
39
+ fill-rule="evenodd"
40
+ d="M8 15a.5.5 0 0 0 .5-.5V2.707l3.146 3.147a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 1 0 .708.708L7.5 2.707V14.5a.5.5 0 0 0 .5.5z"
41
+ />
42
+ </svg>
43
+ </button>
44
+ <button class="editor-toolbar-edit">
45
+ <svg
46
+ xmlns="http://www.w3.org/2000/svg"
47
+ width="16"
48
+ height="16"
49
+ fill="currentColor"
50
+ class="bi bi-pencil"
51
+ viewBox="0 0 16 16"
52
+ >
53
+ <path
54
+ d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10zM11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207 11.207 2.5zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293l6.5-6.5zm-9.761 5.175-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325z"
55
+ />
56
+ </svg>
57
+ </button>
58
+ <button class="editor-toolbar-delete">
59
+ <svg
60
+ xmlns="http://www.w3.org/2000/svg"
61
+ width="16"
62
+ height="16"
63
+ fill="currentColor"
64
+ class="bi bi-trash"
65
+ viewBox="0 0 16 16"
66
+ >
67
+ <path
68
+ d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5Zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5Zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6Z"
69
+ />
70
+ <path
71
+ d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1ZM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118ZM2.5 3h11V2h-11v1Z"
72
+ />
73
+ </svg>
74
+ </button>
75
+ </div>
29
76
 
30
- <%= button_to Spree.t(:move_up), spree.move_higher_admin_page_section_path(@page_preview, section), method: :patch, id: "editor-toolbar-higher-section-#{section.id}" %>
31
- <%= button_to Spree.t(:move_down), spree.move_lower_admin_page_section_path(@page_preview, section), method: :patch, id: "editor-toolbar-lower-section-#{section.id}" %>
32
- <%= link_to Spree.t(:destroy), spree.admin_page_section_path(section), data: { turbo_confirm: Spree.t(:are_you_sure), turbo_method: :delete }, id: "editor-toolbar-delete-section-#{section.id}" %>
77
+ <%= button_to Spree.t(:move_up),
78
+ spree.move_higher_admin_page_section_path(parent, section),
79
+ method: :patch,
80
+ id: "editor-toolbar-higher-section-#{section.id}" %>
81
+ <%= button_to Spree.t(:move_down),
82
+ spree.move_lower_admin_page_section_path(parent, section),
83
+ method: :patch,
84
+ id: "editor-toolbar-lower-section-#{section.id}" %>
85
+ <%= link_to Spree.t(:destroy),
86
+ spree.admin_page_section_path(section),
87
+ data: {
88
+ turbo_confirm: Spree.t(:are_you_sure),
89
+ turbo_method: :delete,
90
+ },
91
+ id: "editor-toolbar-delete-section-#{section.id}" %>
92
+
93
+ <% end %>
33
94
 
34
95
  <% section.blocks.each do |block| %>
35
96
  <div id="editor-toolbar-block-<%= block.id %>">
36
97
  <button class="editor-toolbar-lower">
37
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-down" viewBox="0 0 16 16">
38
- <path fill-rule="evenodd" d="M8 1a.5.5 0 0 1 .5.5v11.793l3.146-3.147a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 .708-.708L7.5 13.293V1.5A.5.5 0 0 1 8 1z"/>
98
+ <svg
99
+ xmlns="http://www.w3.org/2000/svg"
100
+ width="16"
101
+ height="16"
102
+ fill="currentColor"
103
+ class="bi bi-arrow-down"
104
+ viewBox="0 0 16 16"
105
+ >
106
+ <path
107
+ fill-rule="evenodd"
108
+ d="M8 1a.5.5 0 0 1 .5.5v11.793l3.146-3.147a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 .708-.708L7.5 13.293V1.5A.5.5 0 0 1 8 1z"
109
+ />
39
110
  </svg>
40
111
  </button>
41
112
  <button class="editor-toolbar-higher">
42
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-up" viewBox="0 0 16 16">
43
- <path fill-rule="evenodd" d="M8 15a.5.5 0 0 0 .5-.5V2.707l3.146 3.147a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 1 0 .708.708L7.5 2.707V14.5a.5.5 0 0 0 .5.5z"/>
113
+ <svg
114
+ xmlns="http://www.w3.org/2000/svg"
115
+ width="16"
116
+ height="16"
117
+ fill="currentColor"
118
+ class="bi bi-arrow-up"
119
+ viewBox="0 0 16 16"
120
+ >
121
+ <path
122
+ fill-rule="evenodd"
123
+ d="M8 15a.5.5 0 0 0 .5-.5V2.707l3.146 3.147a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 1 0 .708.708L7.5 2.707V14.5a.5.5 0 0 0 .5.5z"
124
+ />
44
125
  </svg>
45
126
  </button>
46
127
  <button class="editor-toolbar-edit">
47
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pencil" viewBox="0 0 16 16">
48
- <path d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10zM11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207 11.207 2.5zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293l6.5-6.5zm-9.761 5.175-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325z"/>
128
+ <svg
129
+ xmlns="http://www.w3.org/2000/svg"
130
+ width="16"
131
+ height="16"
132
+ fill="currentColor"
133
+ class="bi bi-pencil"
134
+ viewBox="0 0 16 16"
135
+ >
136
+ <path
137
+ d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10zM11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207 11.207 2.5zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293l6.5-6.5zm-9.761 5.175-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325z"
138
+ />
49
139
  </svg>
50
140
  </button>
51
141
  <button class="editor-toolbar-delete">
52
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash" viewBox="0 0 16 16">
53
- <path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5Zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5Zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6Z"/>
54
- <path d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1ZM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118ZM2.5 3h11V2h-11v1Z"/>
142
+ <svg
143
+ xmlns="http://www.w3.org/2000/svg"
144
+ width="16"
145
+ height="16"
146
+ fill="currentColor"
147
+ class="bi bi-trash"
148
+ viewBox="0 0 16 16"
149
+ >
150
+ <path
151
+ d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5Zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5Zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6Z"
152
+ />
153
+ <path
154
+ d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1ZM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118ZM2.5 3h11V2h-11v1Z"
155
+ />
55
156
  </svg>
56
157
  </button>
57
158
  </div>
58
159
 
59
- <%= button_to Spree.t(:move_up), spree.move_higher_admin_page_section_block_path(section, block), method: :patch, id: "editor-toolbar-higher-block-#{block.id}" %>
60
- <%= button_to Spree.t(:move_down), spree.move_lower_admin_page_section_block_path(section, block), method: :patch, id: "editor-toolbar-lower-block-#{block.id}" %>
61
- <%= link_to Spree.t(:destroy), spree.admin_page_section_block_path(section, block), data: { turbo_confirm: Spree.t(:are_you_sure), turbo_method: :delete }, id: "editor-toolbar-delete-block-#{block.id}" %>
160
+ <%= button_to Spree.t(:move_up),
161
+ spree.move_higher_admin_page_section_block_path(section, block),
162
+ method: :patch,
163
+ id: "editor-toolbar-higher-block-#{block.id}" %>
164
+ <%= button_to Spree.t(:move_down),
165
+ spree.move_lower_admin_page_section_block_path(section, block),
166
+ method: :patch,
167
+ id: "editor-toolbar-lower-block-#{block.id}" %>
168
+ <%= link_to Spree.t(:destroy),
169
+ spree.admin_page_section_block_path(section, block),
170
+ data: {
171
+ turbo_confirm: Spree.t(:are_you_sure),
172
+ turbo_method: :delete,
173
+ },
174
+ id: "editor-toolbar-delete-block-#{block.id}" %>
62
175
  <% end %>
63
176
  <% end %>
64
177
  </div>
@@ -55,7 +55,7 @@
55
55
  </div>
56
56
  <div class="form-group">
57
57
  <%= label_tag :payment_method_auto_capture, Spree.t(:auto_capture) %>
58
- <%= select(:payment_method, :auto_capture, [["#{Spree.t(:use_app_default)} (#{Spree::Config[:auto_capture]})", ''], [Spree.t(:say_yes), true], [Spree.t(:say_no), false]], {}, {class: 'custom-select'}) %>
58
+ <%= select(:payment_method, :auto_capture, [["#{Spree.t(:use_app_default)} (#{Spree::Config[:auto_capture]})", ''], [Spree.t(:say_yes).to_s, true], [Spree.t(:say_no).to_s, false]], {}, {class: 'custom-select'}) %>
59
59
  </div>
60
60
 
61
61
  <div class="form-group">
@@ -15,6 +15,7 @@
15
15
  data-variants-form-currencies-value="<%= supported_currencies.map(&:to_s).to_json %>"
16
16
  data-variants-form-current-stock-location-id-value="<%= default_stock_location_for_product(@product).id %>"
17
17
  data-variants-form-stock-locations-value="<%= available_stock_locations_for_product(@product).ids.map(&:to_s).to_json %>"
18
+ data-variants-form-admin-path-value="<%= spree.admin_path %>"
18
19
  <% if @product_options.present? %> data-variants-form-options-value="<%= @product_options.to_json %>" <% end %>
19
20
  <% if @product_available_options.present? %> data-variants-form-available-options-value="<%= @product_available_options.to_json %>" <% end %>
20
21
  <% if @product_stock.present? %> data-variants-form-stock-value="<%= @product_stock.to_json %>" <% end %>
@@ -51,4 +51,9 @@
51
51
 
52
52
  <%= render 'spree/shared/google_places_api_loader' %>
53
53
 
54
- <%= render_admin_partials(:head_partials) %>
54
+ <%= render_admin_partials(:head_partials) %>
55
+
56
+ <script>
57
+ window.Spree = window.Spree || {}
58
+ Spree.adminPath = '<%= spree.admin_path %>'
59
+ </script>
@@ -1,4 +1,5 @@
1
1
  <%= content_for(:page_tabs) do %>
2
2
  <%= nav_item(Spree.t(:tax_rates), spree.admin_tax_rates_path) if can?(:manage, Spree::TaxRate) %>
3
3
  <%= nav_item(Spree.t(:tax_categories), spree.admin_tax_categories_path) if can?(:manage, Spree::TaxCategory) %>
4
+ <%= render_admin_partials(:tax_nav_partials) %>
4
5
  <% end %>
@@ -17,6 +17,7 @@
17
17
  <%= nav_item(Spree.t(:emails), spree.edit_admin_store_path(section: 'emails'), icon: 'send', active: params[:section] == 'emails') %>
18
18
  <%= nav_item(Spree.t(:policies), spree.edit_admin_store_path(section: 'policies'), icon: 'list-check', active: params[:section] == 'policies') %>
19
19
  <%= nav_item(Spree.t(:checkout), spree.edit_admin_store_path(section: 'checkout'), icon: 'shopping-cart', active: params[:section] == 'checkout') %>
20
+ <%= render_admin_partials(:store_settings_nav_partials) %>
20
21
  <% end %>
21
22
 
22
23
  <% if can?(:manage, Spree::CustomDomain) %>
@@ -48,7 +49,7 @@
48
49
  <% end %>
49
50
 
50
51
  <% if can?(:manage, Spree::Store) %>
51
- <% if enterprise_edition? %>
52
+ <% if spree.respond_to?(:admin_audits_path) %>
52
53
  <%= nav_item(Spree.t('admin.audit_log'), spree.admin_audits_path, icon: 'history', active: %w[audits exports imports].include?(controller_name)) %>
53
54
  <% else %>
54
55
  <li class="nav-item">
@@ -66,7 +67,7 @@
66
67
  <%= nav_item(Spree.t(:developers), spree.admin_oauth_applications_path, icon: 'terminal', active: %w[oauth_applications webhooks_subscribers].include?(controller_name)) %>
67
68
  <% end %>
68
69
 
69
- <%= render_admin_partials(:store_settings_nav_partials) %>
70
+ <%= render_admin_partials(:settings_nav_partials) %>
70
71
  </ul>
71
72
  <% else %>
72
73
  <%= render 'spree/admin/shared/sidebar/store_dropdown' %>
@@ -17,6 +17,8 @@
17
17
  <% if can?(:manage, current_store) %>
18
18
  <%= nav_item(Spree.t(:settings), spree.edit_admin_storefront_path) %>
19
19
  <% end %>
20
+
21
+ <%= render_admin_partials(:storefront_nav_partials) %>
20
22
  </ul>
21
23
  <% end %>
22
24
  <% end %>
@@ -157,4 +157,4 @@
157
157
  </div>
158
158
  </div>
159
159
 
160
- <%= render_admin_partials(:store_form_partials, f: f) %>
160
+ <%= render_admin_partials(:store_form_partials, f: f, store: @store) %>