Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Admin: Disable turbo prefetch for links to page builder (#13122)

Damian Legawiec4bcd6e98e4cc
diff --git a/admin/app/views/spree/admin/dashboard/_store_preview.html.erb b/admin/app/views/spree/admin/dashboard/_store_preview.html.erb
index fd17b8e8cf..f0ce6686a8 100644
--- a/admin/app/views/spree/admin/dashboard/_store_preview.html.erb
+++ b/admin/app/views/spree/admin/dashboard/_store_preview.html.erb
@@ -1,6 +1,6 @@
<% if current_store.default_theme %>
<div class="card mb-4">
- <%= link_to spree.edit_admin_theme_path(current_store.default_theme), class: 'd-block border rounded mx-2 mt-2 mb-0 overflow-auto bg-light position-relative store-preview-link' do %>
+ <%= link_to spree.edit_admin_theme_path(current_store.default_theme), class: 'd-block border rounded mx-2 mt-2 mb-0 overflow-auto bg-light position-relative store-preview-link', data: { turbo_prefetch: false } do %>
<div class="position-absolute w-100 h-100 align-items-center justify-content-center overlay-background store-preview-actions">
<button class="btn btn-primary">
<%= icon('tools') %>
@@ -23,7 +23,7 @@
&nbsp;
<%= Spree.t(:view_store) %>
<% end %>
- <%= link_to spree.edit_admin_theme_path(current_store.default_theme), class: 'btn btn-light w-50' do %>
+ <%= link_to spree.edit_admin_theme_path(current_store.default_theme), class: 'btn btn-light w-50', data: { turbo_prefetch: false } do %>
<%= icon 'tools', class: 'mr-1' %>
&nbsp;
<%= Spree.t('admin.edit_theme') %>
diff --git a/admin/app/views/spree/admin/pages/_table_row.html.erb b/admin/app/views/spree/admin/pages/_table_row.html.erb
index 0e7184f609..285a0e519a 100644
--- a/admin/app/views/spree/admin/pages/_table_row.html.erb
+++ b/admin/app/views/spree/admin/pages/_table_row.html.erb
@@ -1,6 +1,6 @@
<tr id="<%= dom_id page %>" data-controller="row-link" class="cursor-pointer">
<td scope="row" data-action="click->row-link#openLink" class="w-60">
- <%= link_to page.name, spree.edit_admin_theme_path(current_store.default_theme, page_id: page.id), data: { row_link_target: :link, turbo_frame: '_top' } %>
+ <%= link_to page.name, spree.edit_admin_theme_path(current_store.default_theme, page_id: page.id), data: { row_link_target: :link, turbo_frame: '_top', turbo_prefetch: false } %>
</td>
<td data-action="click->row-link#openLink" class="w-15">
<%= spree_time_ago(page.created_at, class: 'with-tip') %>
@@ -15,7 +15,7 @@
</button>
<ul class="dropdown-menu">
<li>
- <%= link_to_with_icon 'edit', Spree.t(:edit), spree.edit_admin_theme_path(current_store.default_theme, page_id: page.id), class: 'dropdown-item', data: { turbo_frame: '_top' } %>
+ <%= link_to_with_icon 'edit', Spree.t(:edit), spree.edit_admin_theme_path(current_store.default_theme, page_id: page.id), class: 'dropdown-item', data: { turbo_frame: '_top', turbo_prefetch: false } %>
</li>
<li>
<%= link_to_delete(page, class: 'dropdown-item btn-danger', icon: 'trash') %>
diff --git a/admin/app/views/spree/admin/shared/sidebar/_store_dropdown.html.erb b/admin/app/views/spree/admin/shared/sidebar/_store_dropdown.html.erb
index f6432beb6b..2e6221a206 100644
--- a/admin/app/views/spree/admin/shared/sidebar/_store_dropdown.html.erb
+++ b/admin/app/views/spree/admin/shared/sidebar/_store_dropdown.html.erb
@@ -10,7 +10,7 @@
<%= icon 'eye' %>
<%= Spree.t(:view_store) %>
<% end %>
- <%= link_to spree.edit_admin_theme_path(current_store.default_theme), class: 'dropdown-item' do %>
+ <%= link_to spree.edit_admin_theme_path(current_store.default_theme), class: 'dropdown-item', data: { turbo_prefetch: false } do %>
<%= icon 'tools' %>
<%= Spree.t('admin.edit_theme') %>
<% end if current_store.default_theme && can?(:manage, Spree::Theme) %>
diff --git a/admin/app/views/spree/admin/themes/_theme.html.erb b/admin/app/views/spree/admin/themes/_theme.html.erb
index 1ed6515a12..a4ee89f98e 100644
--- a/admin/app/views/spree/admin/themes/_theme.html.erb
+++ b/admin/app/views/spree/admin/themes/_theme.html.erb
@@ -1,6 +1,6 @@
<tr id="<%= spree_dom_id theme %>">
<td class="w-70 p-0">
- <%= link_to theme.ready? ? spree.edit_admin_theme_path(theme) : '#', class: 'd-flex align-items-top p-3' do %>
+ <%= link_to theme.ready? ? spree.edit_admin_theme_path(theme) : '#', class: 'd-flex align-items-top p-3', data: { turbo_prefetch: false } do %>
<div class="w-20">
<%= render 'spree/admin/themes/theme_preview_image', theme: theme, css_class: 'img-thumbnail w-100' %>
</div>
@@ -43,7 +43,7 @@
<%= icon('dots-vertical', class: 'mr-0') %>
</button>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuButton">
- <%= link_to_edit theme, class: 'dropdown-item' %>
+ <%= link_to_edit theme, class: 'dropdown-item', data: { turbo_prefetch: false } %>
<%= link_to_with_icon 'copy', Spree.t(:clone), spree.clone_admin_theme_path(theme), class: 'dropdown-item', data: { turbo_method: :post } %>
<% unless theme.default? %>
<%= link_to_delete(theme, icon: 'trash', class: 'dropdown-item btn-danger shadow-none') if can?(:delete, theme) %>