|
61 | 61 | end |
62 | 62 | %> |
63 | 63 |
|
64 | | -<%# -------------------------------------------------- |
65 | | - # Inner content (NO LINKS HERE) |
66 | | - # -------------------------------------------------- %> |
| 64 | +<%# |
| 65 | + -------------------------------------------------- |
| 66 | + # Inner content (NO LINKS HERE) |
| 67 | + # -------------------------------------------------- |
| 68 | +%> |
| 69 | + |
67 | 70 | <% inner = capture do %> |
68 | 71 | <div class="<%= variant %>-item <%= resource&.class&.table_name %>-<%= idx %> <%= sizes[:wrapper] %>"> |
69 | 72 | <% if active_storage_file %> |
|
73 | 76 | class: "#{sizes[:image]} hover:opacity-95 transition-opacity", |
74 | 77 | alt: "#{item_type} preview #{idx + 1} (#{active_storage_file.blob.filename})" |
75 | 78 | ) %> |
76 | | - |
77 | 79 | <% elsif active_storage_file.content_type == "application/pdf" %> |
78 | 80 | <div class="flex items-center gap-3 p-4 border rounded-lg bg-gray-50"> |
79 | 81 | <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> |
83 | 83 | </div> |
84 | | - |
85 | 84 | <% else %> |
86 | 85 | <%= image_tag( |
87 | 86 | active_storage_file, |
88 | 87 | class: "#{sizes[:image]} hover:opacity-95 transition-opacity", |
89 | 88 | alt: "#{item_type} image #{idx + 1} (#{active_storage_file.blob.filename})" |
90 | 89 | ) %> |
91 | 90 | <% end %> |
92 | | - |
93 | 91 | <% elsif icon_display %> |
94 | 92 | <div class="<%= sizes[:image] %> hover:opacity-95 transition-opacity"> |
95 | 93 | <%= render "assets/display_icon", |
|
105 | 103 | class: sizes[:image], |
106 | 104 | alt: "#{item_type} fallback image #{idx + 1}" |
107 | 105 | ) %> |
108 | | - |
109 | 106 | <% end %> |
110 | | - |
111 | 107 | </div> |
112 | 108 | <% end %> |
113 | 109 |
|
114 | | -<%# -------------------------------------------------- |
115 | | - # Optional link wrapper |
116 | | - # -------------------------------------------------- %> |
| 110 | +<%# |
| 111 | + -------------------------------------------------- |
| 112 | + # Optional link wrapper |
| 113 | + # -------------------------------------------------- |
| 114 | +%> |
| 115 | + |
117 | 116 | <% if link && link_href.present? %> |
118 | 117 | <% 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 } } |
120 | 119 | else |
121 | 120 | { class: "display-image-link", target: "_blank", rel: "noopener noreferrer" } |
122 | | - end |
123 | | - %> |
124 | | - |
| 121 | + end %> |
125 | 122 | <%= link_to link_href, **link_options do %> |
126 | 123 | <%= inner %> |
127 | 124 | <% end %> |
128 | | - |
129 | 125 | <% if active_storage_file&.previewable? && display_open_pdf_link && |
130 | 126 | active_storage_file.content_type == "application/pdf" %> |
131 | 127 | <div class="mt-2 text-sm text-gray-600"> |
|
0 commit comments