Sha256: 6d3b494e40fe9d41aa03e4e382fa121e8ea8441c45d28a2993d1b77f92bee14a

Contents?: true

Size: 1.2 KB

Versions: 93

Compression:

Stored size: 1.2 KB

Contents

<%
  attachment = GovukPublishingComponents::Presenters::Attachment.new(attachment)
  target ||= nil
  data_attributes ||= {}
  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-link__abbr")
              else
                attachment.content_type_name
              end

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

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

  if attachment.number_of_pages
    attributes << tag.span(
      I18n.t("components.attachment.page", count: attachment.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,
              data: data_attributes) -%>
  <%= raw("(#{attributes.join(', ')})") if attributes.any? -%>
<% end %>

Version data entries

93 entries across 93 versions & 1 rubygems

Version Path
govuk_publishing_components-29.6.0 app/views/govuk_publishing_components/components/_attachment_link.html.erb
govuk_publishing_components-29.5.0 app/views/govuk_publishing_components/components/_attachment_link.html.erb
govuk_publishing_components-29.4.0 app/views/govuk_publishing_components/components/_attachment_link.html.erb
govuk_publishing_components-29.3.0 app/views/govuk_publishing_components/components/_attachment_link.html.erb
govuk_publishing_components-29.2.0 app/views/govuk_publishing_components/components/_attachment_link.html.erb
govuk_publishing_components-29.1.0 app/views/govuk_publishing_components/components/_attachment_link.html.erb
govuk_publishing_components-29.0.1 app/views/govuk_publishing_components/components/_attachment_link.html.erb
govuk_publishing_components-29.0.0 app/views/govuk_publishing_components/components/_attachment_link.html.erb
govuk_publishing_components-28.9.2 app/views/govuk_publishing_components/components/_attachment_link.html.erb
govuk_publishing_components-28.9.1 app/views/govuk_publishing_components/components/_attachment_link.html.erb
govuk_publishing_components-28.9.0 app/views/govuk_publishing_components/components/_attachment_link.html.erb
govuk_publishing_components-28.8.1 app/views/govuk_publishing_components/components/_attachment_link.html.erb
govuk_publishing_components-28.8.0 app/views/govuk_publishing_components/components/_attachment_link.html.erb
govuk_publishing_components-28.7.1 app/views/govuk_publishing_components/components/_attachment_link.html.erb
govuk_publishing_components-28.6.0 app/views/govuk_publishing_components/components/_attachment_link.html.erb
govuk_publishing_components-28.5.0 app/views/govuk_publishing_components/components/_attachment_link.html.erb
govuk_publishing_components-28.4.0 app/views/govuk_publishing_components/components/_attachment_link.html.erb
govuk_publishing_components-28.3.0 app/views/govuk_publishing_components/components/_attachment_link.html.erb
govuk_publishing_components-28.2.0 app/views/govuk_publishing_components/components/_attachment_link.html.erb
govuk_publishing_components-28.1.0 app/views/govuk_publishing_components/components/_attachment_link.html.erb