<% add_decidim_page_title(t(".attachments_title")) %>

<%= t(".attachments_title") %> <% if allowed_to? :create, :attachment %> <%= link_to t("actions.attachment.new", scope: "decidim.admin"), url_for(action: :new), class: "button button__sm button__secondary new" %> <% end %>

<%= cell("decidim/admin/attachments_privacy_warning", attached_to.attachments) %> <% if attached_to.attachments.any? %>
<% attached_to.attachments.each do |attachment| %> <% end %>
<%= t("models.attachment.fields.title", scope: "decidim.admin") %> <%= t("models.attachment.fields.collection", scope: "decidim.admin") %> <%= t("models.attachment.fields.content_type", scope: "decidim.admin") %> <%= t("models.attachment.fields.file_size", scope: "decidim.admin") %>
<%= link_to translated_attribute(attachment.title), edit_polymorphic_path([attached_to, attachment]) %>
<%= translated_attribute(attachment.attachment_collection&.name) %> <%= attachment.file_type %> <%= attachment.file? ? number_to_human_size(attachment.file_size) : "-" %> <% if allowed_to? :update, :attachment, attachment: attachment %> <%= icon_link_to "pencil-line", edit_polymorphic_path([attached_to, attachment]), t("actions.edit", scope: "decidim.admin"), class: "action-icon--edit" %> <% end %> <% if allowed_to? :destroy, :attachment, attachment: attachment %> <%= icon_link_to "delete-bin-line", polymorphic_path([attached_to, attachment]), t("actions.destroy", scope: "decidim.admin"), class: "action-icon--remove", method: :delete, data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } %> <% end %>
<% end %>