Sha256: 6f83f9cb4fb7ed476d2853979bf36dabb387ceb238f0d2e69f4158e25cc98212

Contents?: true

Size: 1.24 KB

Versions: 15

Compression:

Stored size: 1.24 KB

Contents

<%
  id ||= "error-summary-#{SecureRandom.hex(4)}"
  title ||= false
  description ||= false
  items ||= []
  title_id ||= "error-summary-title-#{SecureRandom.hex(4)}"
  if items.empty? && !title
    raise ArgumentError, "The error_summary component needs at least one item or a title in order to render."
  end
%>
<div
  class="gem-c-error-summary"
  data-module="error-summary"
  aria-labelledby="<%= title_id %>"
  role="alert"
  tabindex="-1"
  id="<%= id %>"
>
  <% if title %>
    <h2 class="gem-c-error-summary__title" id="<%= title_id %>">
      <%= title %>
    </h2>
  <% end %>
  <div class="gem-c-error-summary__body">
    <% if description %>
      <p class="gem-c-error-summary__text"><%= description %></p>
    <% end %>
    <% if items.present? %>
      <ul class="gem-c-error-summary__list">
        <% items.each_with_index do |item, index| %>
          <li class="gem-c-error-summary__list__item">
            <% if item[:href] %>
              <a
                class="js-error-summary__link gem-c-error-summary__link"
                href="<%= item[:href] %>"
              ><%= item[:text] %></a>
            <% else %>
              <%= item[:text] %>
            <% end %>
          </li>
        <% end %>
      </ul>
    <% end %>
  </div>
</div>

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
govuk_publishing_components-12.19.0 app/views/govuk_publishing_components/components/_error_summary.html.erb
govuk_publishing_components-12.18.0 app/views/govuk_publishing_components/components/_error_summary.html.erb
govuk_publishing_components-12.17.0 app/views/govuk_publishing_components/components/_error_summary.html.erb
govuk_publishing_components-12.16.0 app/views/govuk_publishing_components/components/_error_summary.html.erb
govuk_publishing_components-12.15.0 app/views/govuk_publishing_components/components/_error_summary.html.erb
govuk_publishing_components-12.14.1 app/views/govuk_publishing_components/components/_error_summary.html.erb
govuk_publishing_components-12.14.0 app/views/govuk_publishing_components/components/_error_summary.html.erb
govuk_publishing_components-12.13.0 app/views/govuk_publishing_components/components/_error_summary.html.erb
govuk_publishing_components-12.12.1 app/views/govuk_publishing_components/components/_error_summary.html.erb
govuk_publishing_components-12.12.0 app/views/govuk_publishing_components/components/_error_summary.html.erb
govuk_publishing_components-12.11.0 app/views/govuk_publishing_components/components/_error_summary.html.erb
govuk_publishing_components-12.10.0 app/views/govuk_publishing_components/components/_error_summary.html.erb
govuk_publishing_components-12.9.1 app/views/govuk_publishing_components/components/_error_summary.html.erb
govuk_publishing_components-12.9.0 app/views/govuk_publishing_components/components/_error_summary.html.erb
govuk_publishing_components-12.8.0 app/views/govuk_publishing_components/components/_error_summary.html.erb