Sha256: a62024a4dd2ea06a269bf96e9b83b309d976c3dbf4a3f0f67e661e067244ecd5

Contents?: true

Size: 1.07 KB

Versions: 29

Compression:

Stored size: 1.07 KB

Contents

<%
  aria_label ||= nil
  extra_spacing ||= nil
  id ||= nil
  items ||= []
  list_type ||= "unordered"
  visible_counters ||= nil

  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)

  classes = %w[gem-c-list govuk-list]
  classes << "govuk-list--bullet" if visible_counters and list_type === "unordered"
  classes << "govuk-list--number" if visible_counters and list_type === "number"
  classes << "govuk-list--spaced" if extra_spacing
  # Setting the  `margin_bottom` to 4 is the same as the default margin - so we
  # can omit the override class. To do this we leave out `4` from the array:
  classes << (shared_helper.get_margin_bottom) if [0,1,2,3,5,6,7,8,9].include?(local_assigns[:margin_bottom])

  # Default list type is unordered list.
  list_tag = "ul"

  # Set to ordered list to override default.
  list_tag = "ol" if list_type === "number"
%>
<% if items.any? %>
  <%= content_tag list_tag, class: classes, id: id, "aria-label": aria_label do %>
    <% items.each do |item| %>
      <li><%= raw(item) %></li>
    <% end %>
  <% end %>
<% end %>

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
govuk_publishing_components-28.4.0 app/views/govuk_publishing_components/components/_list.html.erb
govuk_publishing_components-28.3.0 app/views/govuk_publishing_components/components/_list.html.erb
govuk_publishing_components-28.2.0 app/views/govuk_publishing_components/components/_list.html.erb
govuk_publishing_components-28.1.0 app/views/govuk_publishing_components/components/_list.html.erb
govuk_publishing_components-28.0.0 app/views/govuk_publishing_components/components/_list.html.erb
govuk_publishing_components-27.20.0 app/views/govuk_publishing_components/components/_list.html.erb
govuk_publishing_components-27.19.0 app/views/govuk_publishing_components/components/_list.html.erb
govuk_publishing_components-27.18.0 app/views/govuk_publishing_components/components/_list.html.erb
govuk_publishing_components-27.17.0 app/views/govuk_publishing_components/components/_list.html.erb
govuk_publishing_components-27.16.0 app/views/govuk_publishing_components/components/_list.html.erb
govuk_publishing_components-27.15.0 app/views/govuk_publishing_components/components/_list.html.erb
govuk_publishing_components-27.14.2 app/views/govuk_publishing_components/components/_list.html.erb
govuk_publishing_components-27.14.1 app/views/govuk_publishing_components/components/_list.html.erb
govuk_publishing_components-27.14.0 app/views/govuk_publishing_components/components/_list.html.erb
govuk_publishing_components-27.13.0 app/views/govuk_publishing_components/components/_list.html.erb
govuk_publishing_components-27.12.0 app/views/govuk_publishing_components/components/_list.html.erb
govuk_publishing_components-27.11.0 app/views/govuk_publishing_components/components/_list.html.erb
govuk_publishing_components-27.10.5 app/views/govuk_publishing_components/components/_list.html.erb
govuk_publishing_components-27.10.4 app/views/govuk_publishing_components/components/_list.html.erb
govuk_publishing_components-27.10.3 app/views/govuk_publishing_components/components/_list.html.erb