<% if (attachment = field.value(record)) && attachment.attached? %> <% if attachment.variable? %> <%= image_tag main_app.url_for(attachment), class: "max-h-32" %> <% else %> <%= link_to attachment.filename, main_app.url_for(attachment), target: :_blank, class: "text-blue-500 underline" %> <% end %> <%= link_to "Remove", Madmin.resource_for(attachment).show_path(attachment), data: { turbo_method: :delete, turbo_confirm: "Are you sure? You will lose any other changes."} %> <% end %>