Skip to content

Commit 8c2610f

Browse files
authored
set turbo_frame to top (#607)
* set turbo_frame to top * revert back to prefetch false
1 parent c8f1ab0 commit 8c2610f

File tree

3 files changed

+20
-24
lines changed

3 files changed

+20
-24
lines changed

app/views/assets/_display_image.html.erb

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,12 @@
6161
end
6262
%>
6363

64-
<%# --------------------------------------------------
65-
# Inner content (NO LINKS HERE)
66-
# -------------------------------------------------- %>
64+
<%#
65+
--------------------------------------------------
66+
# Inner content (NO LINKS HERE)
67+
# --------------------------------------------------
68+
%>
69+
6770
<% inner = capture do %>
6871
<div class="<%= variant %>-item <%= resource&.class&.table_name %>-<%= idx %> <%= sizes[:wrapper] %>">
6972
<% if active_storage_file %>
@@ -73,23 +76,18 @@
7376
class: "#{sizes[:image]} hover:opacity-95 transition-opacity",
7477
alt: "#{item_type} preview #{idx + 1} (#{active_storage_file.blob.filename})"
7578
) %>
76-
7779
<% elsif active_storage_file.content_type == "application/pdf" %>
7880
<div class="flex items-center gap-3 p-4 border rounded-lg bg-gray-50">
7981
<i class="fas fa-file-pdf text-red-600 text-2xl"></i>
80-
<span class="font-medium underline hover:no-underline">
81-
<%= active_storage_file.blob.filename %>
82-
</span>
82+
<span class="font-medium underline hover:no-underline"><%= active_storage_file.blob.filename %></span>
8383
</div>
84-
8584
<% else %>
8685
<%= image_tag(
8786
active_storage_file,
8887
class: "#{sizes[:image]} hover:opacity-95 transition-opacity",
8988
alt: "#{item_type} image #{idx + 1} (#{active_storage_file.blob.filename})"
9089
) %>
9190
<% end %>
92-
9391
<% elsif icon_display %>
9492
<div class="<%= sizes[:image] %> hover:opacity-95 transition-opacity">
9593
<%= render "assets/display_icon",
@@ -105,27 +103,25 @@
105103
class: sizes[:image],
106104
alt: "#{item_type} fallback image #{idx + 1}"
107105
) %>
108-
109106
<% end %>
110-
111107
</div>
112108
<% end %>
113109

114-
<%# --------------------------------------------------
115-
# Optional link wrapper
116-
# -------------------------------------------------- %>
110+
<%#
111+
--------------------------------------------------
112+
# Optional link wrapper
113+
# --------------------------------------------------
114+
%>
115+
117116
<% if link && link_href.present? %>
118117
<% link_options = if link_to_object
119-
{ class: "display-image-link", data: { turbo_prefetch: false } }
118+
{ class: "display-image-link", data: { turbo_frame: "_top", turbo_prefetch: false } }
120119
else
121120
{ class: "display-image-link", target: "_blank", rel: "noopener noreferrer" }
122-
end
123-
%>
124-
121+
end %>
125122
<%= link_to link_href, **link_options do %>
126123
<%= inner %>
127124
<% end %>
128-
129125
<% if active_storage_file&.previewable? && display_open_pdf_link &&
130126
active_storage_file.content_type == "application/pdf" %>
131127
<div class="mt-2 text-sm text-gray-600">

app/views/resources/_resource_card.html.erb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<!-- IMAGE -->
2121
<div class="relative w-32 h-32">
2222
<%= link_to resource_path(resource),
23-
data: { turbo_prefetch: false },
23+
data: { turbo_frame: "_top", turbo_prefetch: false },
2424
class: "block w-full h-full" do %>
2525

2626
<!-- fallback icon -->
@@ -47,7 +47,7 @@
4747
<div class="flex-1 min-w-0 pl-4 pr-10 pb-12 mt-2 relative">
4848
<div class="mt-3 mb-2">
4949
<%= link_to resource_path(resource),
50-
data: { turbo_prefetch: false },
50+
data: { turbo_frame: "_top", turbo_prefetch: false },
5151
class: "inline-flex min-w-0 max-w-full text-lg font-semibold
5252
text-gray-900 leading-tight hover:underline" do %>
5353
<%= title_with_badges(resource, show_hidden_badge: current_user.super_user?).html_safe %>
@@ -61,7 +61,7 @@
6161
<%= link_to(
6262
content_tag(:span, "", class: "fa fa-download"),
6363
resource_download_path(resource.object),
64-
data: { turbo_prefetch: false },
64+
data: { turbo_frame: "_top", turbo_prefetch: false },
6565
class: "btn btn-utility"
6666
) %>
6767
<% end %>
@@ -71,7 +71,7 @@
7171
content_tag(:span, "", class: "far fa-edit"),
7272
edit_resource_path(resource.object),
7373
class: "admin-only bg-blue-100 btn btn-secondary-outline",
74-
data: {turbo: false}
74+
data: {turbo_frame: "_top", turbo_prefetch: false }
7575
) %>
7676
<% end %>
7777

app/views/workshops/_index_row.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
<!-- Title with badges (single column, bookmark stays separate) -->
4646
<%= link_to link_route,
4747
class: "hover:underline block",
48-
data: { turbo_prefetch: false, turbo: false } do %>
48+
data: { turbo_frame: "_top", turbo_prefetch: false } do %>
4949
<%= title_with_badges(workshop,
5050
show_hidden_badge: current_user.super_user?,
5151
display_windows_type: true).html_safe %>

0 commit comments

Comments
 (0)