Sha256: deac2cb5893622b9c179765a7fb2c5d321d45ebd28849546940a86c940befa01
Contents?: true
Size: 1.29 KB
Versions: 25
Compression:
Stored size: 1.29 KB
Contents
<% id ||= "error-summary-#{SecureRandom.hex(4)}" title ||= false description ||= false data_attributes ||= {} items ||= [] 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: "govuk-error-summary" }.merge(data_attributes), id: id, ) do %> <%= tag.div( role: "alert", ) do %> <% if title %> <h2 class="govuk-error-summary__title"> <%= 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 %> <% end %>
Version data entries
25 entries across 25 versions & 1 rubygems