Sha256: 695b9d9148092942a411bda415937bb765091ab9df8f9d3aa5f9358a3b46fa75
Contents?: true
Size: 1.33 KB
Versions: 27
Compression:
Stored size: 1.33 KB
Contents
<% id ||= "error-summary-#{SecureRandom.hex(4)}" title ||= false description ||= false data_attributes ||= {} 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 %> <%= tag.div( class: "gem-c-error-summary govuk-error-summary", data: { module: "error-summary" }.merge(data_attributes), aria: { labelledby: title_id }, role: "alert", tabindex: -1, id: id, ) do %> <% if title %> <h2 class="govuk-error-summary__title" id="<%= title_id %>"> <%= title %> </h2> <% end %> <div class="govuk-error-summary__body"> <% if description %> <p><%= description %></p> <% end %> <% if items.present? %> <ul class="govuk-list govuk-error-summary__list"> <% items.each_with_index do |item, index| %> <li class="gem-c-error-summary__list-item"> <% if item[:href] %> <%= link_to item[:text], item[:href], target: item[:target], data: item[:data_attributes] %> <% else %> <%= tag.span data: item[:data_attributes] do %> <%= item[:text] %> <% end %> <% end %> </li> <% end %> </ul> <% end %> </div> <% end %>
Version data entries
27 entries across 27 versions & 1 rubygems