Sha256: 568d9582694aa9281bfb3ab9f6a6eddf293303c41fadd75ebabbd6720e5f0922
Contents?: true
Size: 1.31 KB
Versions: 10
Compression:
Stored size: 1.31 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", data: { module: "error-summary" }.merge(data_attributes), aria: { labelledby: title_id }, role: "alert", tabindex: -1, id: id, ) do %> <% 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> <% end %>
Version data entries
10 entries across 10 versions & 1 rubygems