<% broadcast = file.record %> <% show_delete = controller.class.module_parent.to_s == "Public" ? false : policy(broadcast).destroy_file? %> <% file_class = show_delete ? "col-8" : "col-12" %>
  • <% if file.variable? %> <%= link_to image_tag(file.variant(resize_and_pad: [300, 300, background: "#F7F8F9"]), class: "bg-light img-thumbnail img-fluid"), file, target: "_blank" %> <% else %>
    <%= link_to file, target: "_blank" do %> <%= fa_icon("file", style: "font-size: 2rem") %>
    <%= file.filename %>
    <% end %>
    <% end %>
  • <% if show_delete %>
    <% url = url_for [:destroy_file, broadcast.project, broadcast, { file_id: file.id }] %> <%= link_to fa_icon("trash fw", text: t('.actions.delete_file')), url, class: "btn btn-danger", remote: true, method: :delete, data: { confirm: t('.confirm_delete') } %>
    <% end %>