<% attachment = GovukPublishingComponents::Presenters::Attachment.new(attachment) target ||= "_self" hide_help_text ||= false attributes = [] if attachment.content_type_name content = if attachment.content_type_abbr raw tag.abbr(attachment.content_type.abbr, title: attachment.content_type_name, class: "gem-c-attachment__abbr") else attachment.content_type_name end attributes << tag.span(content, class: "gem-c-attachment__attribute") end if attachment.file_size attributes << tag.span( number_to_human_size(attachment.file_size), class: "gem-c-attachment__attribute", ) end if attachment.number_of_pages attributes << tag.span( pluralize(attachment.number_of_pages, "page"), class: "gem-c-attachment__attribute", ) end %> <%= tag.section class: "gem-c-attachment" do %> <%= tag.div class: "gem-c-attachment__thumbnail" do %> <%= link_to attachment.url, class: "govuk-link", target: target, tabindex: "-1", "aria-hidden": true do %> <% if attachment.document? %> <%= render "govuk_publishing_components/components/attachment/thumbnail_document.svg" %> <% elsif attachment.spreadsheet? %> <%= render "govuk_publishing_components/components/attachment/thumbnail_spreadsheet.svg" %> <% else %> <%= render "govuk_publishing_components/components/attachment/thumbnail_generic.svg" %> <% end %> <% end %> <% end %> <%= tag.h2 class: "gem-c-attachment__title" do %> <%= link_to attachment.title, attachment.url, class: "govuk-link", target: target %> <% end %> <% if attributes.any? %> <%= tag.p raw(attributes.join(', ')), class: "gem-c-attachment__metadata" %> <% end %> <% unless hide_help_text %> <% if attachment.opendocument? %> <%= tag.p class: "gem-c-attachment__metadata" do %> <%= t("components.attachment.opendocument_html", target: target) %> <% end %> <% end %> <% end %> <% end %>