Sha256: 3b3ab2e6e740657dd52bcd925f0d04c7829486da796065564ccf0f00a4fc0cd9

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 KB

Contents

<%
  attachment = GovukPublishingComponents::Presenters::Attachment.new(attachment)
  target ||= nil
  attributes = []
  if attachment.readable_content_type
    content = if attachment.content_type_abbr
                raw tag.abbr(attachment.content_type.abbr,
                             title: attachment.readable_content_type,
                             class: "gem-c-attachment-link__abbr")
              else
                attachment.readable_content_type
              end

    attributes << tag.span(content, class: "gem-c-attachment-link__attribute")
  end

  if attachment.readable_file_size
    attributes << tag.span(attachment.readable_file_size, class: "gem-c-attachment-link__attribute")
  end

  if attachment.readable_number_of_pages
    attributes << tag.span(attachment.readable_number_of_pages, class: "gem-c-attachment-link__attribute")
  end
%>
<%= tag.span(class: "gem-c-attachment-link") do %>
  <%= link_to(attachment.title, attachment.url, class: "govuk-link", target: target) %>
  <%= raw("(#{attributes.join(', ')})") if attributes.any? %>
<% end %>

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
govuk_publishing_components-16.16.0 app/views/govuk_publishing_components/components/_attachment_link.html.erb
govuk_publishing_components-16.15.0 app/views/govuk_publishing_components/components/_attachment_link.html.erb
govuk_publishing_components-16.14.1 app/views/govuk_publishing_components/components/_attachment_link.html.erb
govuk_publishing_components-16.14.0 app/views/govuk_publishing_components/components/_attachment_link.html.erb